Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Profiling tool?
2019-02-20 08:44
ChristopherJam

Registered: Aug 2004
Posts: 1409
Profiling tool?

Has anyone come across or written a tool that lets you execute a chunk of 6502 that then reports back a disassembly where each instruction is annotated with the total number of cycles it consumed?

Something like unp64 but with added instrumentation, basically.

Closest a quick google found for me was a tool for generating such reports from logs produced by a hardware bus monitor..
 
... 23 posts hidden. Click here to view all posts....
 
2019-02-22 15:06
oziphantom

Registered: Oct 2014
Posts: 490
VICE PDB Monitor 1.0 (get the extra files from github as per comments ) has a limited profiler, Martin did it so I'm not a 100% sure how it works. But I think it uses the memmap operations to count how often an address is executed. So its doesn't give you clocks but it does give hotspots. Its open source so if you wish to extend it to be better, feel free ;)
2019-02-22 15:08
chatGPZ

Registered: Dec 2001
Posts: 11386
windows specific hack though, and requires a custom non supported acme hack. meh
2019-02-22 15:16
oziphantom

Registered: Oct 2014
Posts: 490
hack? what hack? It makes no modifications to VICE at all and will even connect to a Linux instance if you set up a tunnel for it. To be clear it only uses the Remote Debugger Protocol to communicate to VICE.

It can use Martin's custom ACME, however ACME is for morons and 64Tass is also supported(with more features) for true sensible people ;)
2019-02-22 15:31
chatGPZ

Registered: Dec 2001
Posts: 11386
Now i'd like to know what cybermodo has to say about this topic :)
2019-02-22 15:42
oziphantom

Registered: Oct 2014
Posts: 490
I can't believe he uses ACME, that would mean he knows assembly...
2019-02-22 16:14
chatGPZ

Registered: Dec 2001
Posts: 11386
Obviously he doesnt - but he'd sure have to say something about it =D
2019-02-22 16:41
oziphantom

Registered: Oct 2014
Posts: 490
you could copy paste it for him to lemon
2019-02-22 16:43
chatGPZ

Registered: Dec 2001
Posts: 11386
NO :)
2019-02-23 10:46
ChristopherJam

Registered: Aug 2004
Posts: 1409
Ah, thanks Slajerek, that's an excellent start.

I'm not seeing any cyclecounts or timestamps in the log output though?

So yes, JackAsser, I am indeed currently writing a python script to parse c64debugger logs and the source PRG to add that information..


I'm sure CyberMojoJoJo could whip up a native profiling tool in C in no time at all, assuming someone else has provided some libraries to do all the heavy lifting. Maybe to scroll flamegraphs in ifli?
2019-02-24 00:04
ChristopherJam

Registered: Aug 2004
Posts: 1409
Whee, this is fun.

First bash at collecting stats from the output from c64 debugger; this is a run of tinycrunch (fast variant) decrunching 7.bin from the Pearls for Pigs corpus.

(well ok, second .prg profiled; started building this for a sekret project, output of that one's under wraps for now)

Columns are address, instruction, total cycles spent by that instruction, cumulative percentage of cycles expended, and an ASCII graph of the latter.

Clearly I'd save a fucktonne of cycles if I relocated the decruncher to zero page and inlined the pointers at 0a30 and 0a32 :)

  0a00  stx $07              3     0.00%  
  0a02  ldy #$02             2     0.00%  
  0a04  sta $0004,y         15     0.00%  
  0a07  lda ($06),y         15     0.01%  
  0a09  dey                  6     0.01%  
  0a0a  bpl $0a04            8     0.01%  
  0a0c  pha                  3     0.01%  
  0a0d  sec                  2     0.01%  
  0a0e  bcs $0a40            3     0.01%  
  0a10  pla                  4     0.01%  
  0a11  iny                  2     0.01%  
  0a12  sta ($04),y          6     0.01%  
  0a14  rts                  6     0.01%  
  0a15  inc $05            255     0.06%  
  0a17  clc                102     0.08%  
  0a18  bcc $0a40          153     0.11%  
  0a1a  beq $0a10         3577     0.80%  
  0a1c  iny               3574     1.49%  #
  0a1d  clc               3574     2.17%  #
  0a1e  lda ($06),y       8935     3.89%  ##
  0a20  adc $04           5361     4.92%  ##
  0a22  sta $08           5361     5.95%  ###
  0a24  txa               3574     6.64%  ###
  0a25  ora #$f8          3574     7.33%  ####
  0a27  adc $05           5361     8.36%  ####
  0a29  sta $09           5361     9.39%  #####
  0a2b  lda ($08),y       8935    11.11%  ######
  0a2d  sta ($04),y      10722    13.17%  #######
  0a2f  iny              22824    17.56%  #########
  0a30  lda ($08),y      57060    28.53%  ##############
  0a32  sta ($04),y      68472    41.69%  #####################
  0a34  txa              22824    46.08%  #######################
  0a35  sbx #$08         22824    50.47%  #########################
  0a37  bpl $0a2f        32449    56.71%  ############################
  0a39  tya               3574    57.40%  #############################
  0a3a  adc $04           5361    58.43%  #############################
  0a3c  sta $04           5361    59.46%  ##############################
  0a3e  bcs $0a15         3625    60.16%  ##############################
  0a40  lda #$02          3576    60.84%  ##############################
  0a42  adc $06           5364    61.88%  ###############################
  0a44  sta $06           5364    62.91%  ###############################
  0a46  bcs $0a96         3586    63.60%  ################################
  0a48  ldy #$00          4884    64.54%  ################################
  0a4a  lax ($06),y      12210    66.88%  #################################
  0a4c  bpl $0a1a         6341    68.10%  ##################################
  0a4e  asl               1970    68.48%  ##################################
  0a4f  bmi $0a75         2466    68.96%  ##################################
  0a51  iny              11768    71.22%  ####################################
  0a52  lda ($06),y      29420    76.87%  ######################################
  0a54  sta ($04),y      35304    83.66%  ##########################################
  0a56  dex              11768    85.93%  ###########################################
  0a57  bmi $0a51        17155    89.22%  #############################################
  0a59  tya                994    89.42%  #############################################
  0a5a  adc $06           1491    89.70%  #############################################
  0a5c  sta $06           1491    89.99%  #############################################
  0a5e  bcc $0a63         1463    90.27%  #############################################
  0a60  inc $07            140    90.30%  #############################################
  0a62  clc                 56    90.31%  #############################################
  0a63  tya                994    90.50%  #############################################
  0a64  adc $04           1491    90.79%  #############################################
  0a66  sta $04           1491    91.07%  ##############################################
  0a68  bcc $0a6c         1464    91.35%  ##############################################
  0a6a  inc $05            135    91.38%  ##############################################
  0a6c  ldy #$00           994    91.57%  ##############################################
  0a6e  lax ($06),y       2485    92.05%  ##############################################
  0a70  bpl $0a1a         1325    92.30%  ##############################################
  0a72  asl                332    92.37%  ##############################################
  0a73  bpl $0a51          340    92.43%  ##############################################
  0a75  txa               1308    92.68%  ##############################################
  0a76  adc $04           1962    93.06%  ###############################################
  0a78  sta $08           1962    93.44%  ###############################################
  0a7a  lda #$ff          1308    93.69%  ###############################################
  0a7c  adc $05           1962    94.07%  ###############################################
  0a7e  sta $09           1962    94.44%  ###############################################
  0a80  iny               1308    94.70%  ###############################################
  0a81  lda ($08),y       3270    95.32%  ################################################
  0a83  sta ($04),y       3924    96.08%  ################################################
  0a85  iny               1308    96.33%  ################################################
  0a86  lda ($08),y       3270    96.96%  ################################################
  0a88  sta ($04),y       3924    97.71%  #################################################
  0a8a  lda #$01          1308    97.97%  #################################################
  0a8c  adc $04           1962    98.34%  #################################################
  0a8e  sta $04           1962    98.72%  #################################################
  0a90  bcs $0a9b         1310    98.97%  #################################################
  0a92  inc $06           3270    99.60%  ##################################################
  0a94  bne $0a48         1959    99.98%  ##################################################
  0a96  inc $07             65    99.99%  ##################################################
  0a98  jmp $0a48           39   100.00%  ##################################################
  0a9b  inc $05             10   100.00%  ##################################################
  0a9d  bcs $0a92            6   100.00%  ##################################################
Previous - 1 | 2 | 3 | 4 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Flashback
Guests online: 94
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Sabbi  (9.5)
4 Morpheus  (9.4)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.055 sec.