Skip to content

Instantly share code, notes, and snippets.

@charasyn
Created May 30, 2021 04:40
Show Gist options
  • Save charasyn/ee6adce8a4d2796d322a2587cdc42fdb to your computer and use it in GitHub Desktop.
Save charasyn/ee6adce8a4d2796d322a2587cdc42fdb to your computer and use it in GitHub Desktop.
Earthbound VWF engine profiling

Summary

I took a debug trace from Earthbound of loading the status screen, and analyzed it.

The sorted-regions.txt file here is a list of routines sorted by the amount of time they took overall.

The *.log files contain the number of times each instruction was executed in the most time consuming routines, as well as the amount of time spent and the average time spent per.

This should be used to get an idea of which functions to optimize and where, in order to speed up VWF rendering.

Region: c107af -> c10a03
c107af: count=6 time=41 cyc=6.83
c107b1: count=6 time=43 cyc=7.17
c107b2: count=6 time=43 cyc=7.17
c107b3: count=6 time=19 cyc=3.17
c107b4: count=6 time=25 cyc=4.17
c107b7: count=6 time=19 cyc=3.17
c107b8: count=6 time=55 cyc=9.17
c107b9: count=6 time=49 cyc=8.17
c107bb: count=6 time=30 cyc=5.00
c107be: count=6 time=79 cyc=13.17
c107c2: count=6 time=19 cyc=3.17
c107c3: count=6 time=61 cyc=10.17
c107c6: count=6 time=55 cyc=9.17
c107c8: count=6 time=60 cyc=10.00
c107cb: count=6 time=19 cyc=3.17
c107cc: count=6 time=49 cyc=8.17
c107ce: count=6 time=61 cyc=10.17
c107d1: count=6 time=19 cyc=3.17
c107d2: count=6 time=18 cyc=3.00
c107d3: count=6 time=19 cyc=3.17
c107d4: count=6 time=18 cyc=3.00
c107d5: count=6 time=19 cyc=3.17
c107d6: count=6 time=29 cyc=4.83
c107d7: count=6 time=19 cyc=3.17
c107d8: count=6 time=55 cyc=9.17
c107da: count=6 time=19 cyc=3.17
c107db: count=6 time=25 cyc=4.17
c107de: count=6 time=19 cyc=3.17
c107df: count=6 time=61 cyc=10.17
c107e2: count=6 time=55 cyc=9.17
c107e4: count=6 time=49 cyc=8.17
c107e6: count=6 time=61 cyc=10.17
c107e9: count=6 time=55 cyc=9.17
c107eb: count=6 time=61 cyc=10.17
c107ee: count=6 time=19 cyc=3.17
c107f0: count=6 time=25 cyc=4.17
c107f3: count=6 time=21 cyc=3.50
c107f5: count=5 time=25 cyc=5.00
c107f8: count=5 time=50 cyc=10.00
c107fb: count=5 time=16 cyc=3.20
c107fc: count=5 time=26 cyc=5.20
c107fd: count=5 time=16 cyc=3.20
c107fe: count=5 time=41 cyc=8.20
c10800: count=5 time=26 cyc=5.20
c10802: count=1 time=5 cyc=5.00
c10805: count=1 time=11 cyc=11.00
c10808: count=1 time=4 cyc=4.00
c10809: count=1 time=4 cyc=4.00
c1080a: count=1 time=4 cyc=4.00
c1080b: count=1 time=10 cyc=10.00
c1080d: count=6 time=59 cyc=9.83
c1080f: count=6 time=31 cyc=5.17
c10812: count=6 time=89 cyc=14.83
c10816: count=6 time=55 cyc=9.17
c10818: count=6 time=19 cyc=3.17
c10819: count=6 time=25 cyc=4.17
c1081b: count=6 time=49 cyc=8.17
c1081e: count=6 time=53 cyc=8.83
c10820: count=6 time=25 cyc=4.17
c10822: count=6 time=65 cyc=10.83
c10824: count=6 time=25 cyc=4.17
c10827: count=6 time=21 cyc=3.50
c10829: count=5 time=26 cyc=5.20
c1082c: count=1 time=9 cyc=9.00
c1082e: count=1 time=4 cyc=4.00
c1082f: count=1 time=6 cyc=6.00
c10832: count=1 time=9 cyc=9.00
c10834: count=1 time=10 cyc=10.00
c10836: count=1 time=5 cyc=5.00
c10839: count=1 time=4 cyc=4.00
c1083a: count=1 time=4 cyc=4.00
c1083b: count=1 time=4 cyc=4.00
c1083c: count=1 time=4 cyc=4.00
c1083d: count=1 time=4 cyc=4.00
c1083e: count=1 time=3 cyc=3.00
c1083f: count=1 time=6 cyc=6.00
c10842: count=1 time=9 cyc=9.00
c10844: count=1 time=6 cyc=6.00
c10847: count=1 time=9 cyc=9.00
c10849: count=1 time=11 cyc=11.00
c1084c: count=1 time=4 cyc=4.00
c1084d: count=1 time=4 cyc=4.00
c1084e: count=1 time=4 cyc=4.00
c1084f: count=1 time=10 cyc=10.00
c10851: count=1 time=9 cyc=9.00
c10853: count=1 time=4 cyc=4.00
c10854: count=1 time=10 cyc=10.00
c10856: count=1 time=9 cyc=9.00
c10858: count=1 time=10 cyc=10.00
c1085a: count=1 time=9 cyc=9.00
c1085c: count=1 time=6 cyc=6.00
c1085d: count=1 time=6 cyc=6.00
c1085f: count=1 time=7 cyc=7.00
c10860: count=1 time=8 cyc=8.00
c10862: count=1 time=7 cyc=7.00
c10864: count=1 time=6 cyc=6.00
c10866: count=1 time=9 cyc=9.00
c10868: count=1 time=20 cyc=20.00
c1086a: count=1 time=9 cyc=9.00
c1086c: count=1 time=10 cyc=10.00
c1086e: count=1 time=14 cyc=14.00
c10872: count=1 time=10 cyc=10.00
c10874: count=1 time=4 cyc=4.00
c10875: count=1 time=9 cyc=9.00
c10877: count=1 time=4 cyc=4.00
c10878: count=1 time=3 cyc=3.00
c10879: count=1 time=6 cyc=6.00
c1087c: count=1 time=4 cyc=4.00
c1087d: count=1 time=4 cyc=4.00
c1087e: count=1 time=4 cyc=4.00
c1087f: count=1 time=9 cyc=9.00
c10881: count=1 time=6 cyc=6.00
c10883: count=3 time=27 cyc=9.00
c10885: count=3 time=10 cyc=3.33
c10886: count=3 time=14 cyc=4.67
c10889: count=3 time=27 cyc=9.00
c1088b: count=3 time=31 cyc=10.33
c1088e: count=3 time=42 cyc=14.00
c10890: count=3 time=10 cyc=3.33
c10891: count=3 time=10 cyc=3.33
c10892: count=3 time=26 cyc=8.67
c10894: count=3 time=27 cyc=9.00
c10896: count=3 time=26 cyc=8.67
c10898: count=3 time=10 cyc=3.33
c10899: count=3 time=27 cyc=9.00
c1089b: count=3 time=26 cyc=8.67
c1089d: count=3 time=27 cyc=9.00
c1089f: count=3 time=10 cyc=3.33
c108a0: count=3 time=36 cyc=12.00
c108a2: count=4 time=17 cyc=4.25
c108a4: count=1 time=6 cyc=6.00
c108a7: count=1 time=9 cyc=9.00
c108a9: count=1 time=11 cyc=11.00
c108ac: count=1 time=4 cyc=4.00
c108ad: count=1 time=4 cyc=4.00
c108ae: count=1 time=4 cyc=4.00
c108af: count=1 time=10 cyc=10.00
c108b1: count=1 time=9 cyc=9.00
c108b3: count=1 time=10 cyc=10.00
c108b5: count=1 time=4 cyc=4.00
c108b6: count=1 time=9 cyc=9.00
c108b8: count=6 time=60 cyc=10.00
c108ba: count=6 time=30 cyc=5.00
c108bd: count=6 time=79 cyc=13.17
c108c1: count=6 time=19 cyc=3.17
c108c2: count=6 time=61 cyc=10.17
c108c5: count=6 time=54 cyc=9.00
c108c8: count=6 time=26 cyc=4.33
c108da: count=6 time=54 cyc=9.00
c108dc: count=6 time=26 cyc=4.33
c108de: count=85 time=363 cyc=4.27
c108e1: count=85 time=772 cyc=9.08
c108e3: count=85 time=859 cyc=10.11
c108e6: count=85 time=274 cyc=3.22
c108e7: count=85 time=256 cyc=3.01
c108e8: count=85 time=722 cyc=8.49
c108ea: count=85 time=266 cyc=3.13
c108eb: count=91 time=447 cyc=4.91
c108ed: count=6 time=54 cyc=9.00
c108ef: count=6 time=36 cyc=6.00
c108f2: count=6 time=83 cyc=13.83
c108f6: count=6 time=19 cyc=3.17
c108f7: count=6 time=61 cyc=10.17
c108fa: count=6 time=49 cyc=8.17
c108fd: count=6 time=30 cyc=5.00
c10941: count=6 time=50 cyc=8.33
c10943: count=6 time=61 cyc=10.17
c10946: count=6 time=21 cyc=3.50
c10948: count=5 time=35 cyc=7.00
c1094b: count=5 time=18 cyc=3.60
c1094d: count=4 time=18 cyc=4.50
c10950: count=4 time=41 cyc=10.25
c10953: count=4 time=13 cyc=3.25
c10954: count=4 time=13 cyc=3.25
c10955: count=4 time=23 cyc=5.75
c10956: count=4 time=36 cyc=9.00
c10958: count=4 time=18 cyc=4.50
c1095a: count=2 time=11 cyc=5.50
c1095d: count=2 time=21 cyc=10.50
c10960: count=2 time=7 cyc=3.50
c10961: count=2 time=7 cyc=3.50
c10962: count=2 time=7 cyc=3.50
c10963: count=2 time=17 cyc=8.50
c10965: count=6 time=29 cyc=4.83
c10968: count=6 time=19 cyc=3.17
c10969: count=6 time=49 cyc=8.17
c1096b: count=6 time=19 cyc=3.17
c1096c: count=6 time=19 cyc=3.17
c1096d: count=6 time=19 cyc=3.17
c1096e: count=6 time=54 cyc=9.00
c10970: count=6 time=60 cyc=10.00
c10972: count=6 time=19 cyc=3.17
c10973: count=6 time=54 cyc=9.00
c10975: count=6 time=19 cyc=3.17
c10976: count=6 time=50 cyc=8.33
c10978: count=6 time=30 cyc=5.00
c1097a: count=48 time=228 cyc=4.75
c1097d: count=48 time=491 cyc=10.23
c10980: count=48 time=155 cyc=3.23
c10981: count=48 time=155 cyc=3.23
c10982: count=48 time=415 cyc=8.65
c10984: count=48 time=429 cyc=8.94
c10986: count=48 time=215 cyc=4.48
c10988: count=1052 time=13504 cyc=12.84
c1098a: count=1052 time=3237 cyc=3.08
c1098b: count=1052 time=4889 cyc=4.65
c1098e: count=1052 time=10827 cyc=10.29
c10991: count=1052 time=15088 cyc=14.34
c10993: count=1052 time=15166 cyc=14.42
c10995: count=1052 time=3238 cyc=3.08
c10996: count=1052 time=3211 cyc=3.05
c10997: count=1052 time=9176 cyc=8.72
c10999: count=1052 time=3272 cyc=3.11
c1099a: count=1052 time=9203 cyc=8.75
c1099c: count=1100 time=5002 cyc=4.55
c1099e: count=48 time=219 cyc=4.56
c109a1: count=48 time=488 cyc=10.17
c109a4: count=48 time=144 cyc=3.00
c109a5: count=48 time=145 cyc=3.02
c109a6: count=48 time=154 cyc=3.21
c109a7: count=48 time=436 cyc=9.08
c109a9: count=48 time=218 cyc=4.54
c109ac: count=48 time=155 cyc=3.23
c109ad: count=48 time=417 cyc=8.69
c109af: count=48 time=145 cyc=3.02
c109b0: count=48 time=145 cyc=3.02
c109b1: count=48 time=155 cyc=3.23
c109b2: count=48 time=429 cyc=8.94
c109b4: count=48 time=427 cyc=8.90
c109b6: count=48 time=145 cyc=3.02
c109b7: count=48 time=410 cyc=8.54
c109b9: count=48 time=155 cyc=3.23
c109ba: count=48 time=145 cyc=3.02
c109bb: count=54 time=241 cyc=4.46
c109bd: count=6 time=61 cyc=10.17
c109c0: count=6 time=20 cyc=3.33
c109c2: count=5 time=22 cyc=4.40
c109c5: count=5 time=20 cyc=4.00
c109c7: count=4 time=30 cyc=7.50
c109ca: count=4 time=41 cyc=10.25
c109cd: count=4 time=13 cyc=3.25
c109ce: count=4 time=13 cyc=3.25
c109cf: count=4 time=13 cyc=3.25
c109d0: count=4 time=18 cyc=4.50
c109d2: count=2 time=9 cyc=4.50
c109d5: count=2 time=21 cyc=10.50
c109d8: count=2 time=7 cyc=3.50
c109d9: count=2 time=7 cyc=3.50
c109da: count=2 time=7 cyc=3.50
c109db: count=6 time=53 cyc=8.83
c109dd: count=6 time=26 cyc=4.33
c109df: count=90 time=387 cyc=4.30
c109e2: count=90 time=929 cyc=10.32
c109e5: count=90 time=280 cyc=3.11
c109e6: count=90 time=301 cyc=3.34
c109e7: count=90 time=271 cyc=3.01
c109e8: count=96 time=459 cyc=4.78
c109ea: count=6 time=61 cyc=10.17
c109ed: count=6 time=21 cyc=3.50
c109ef: count=5 time=24 cyc=4.80
c109f2: count=5 time=18 cyc=3.60
c109f4: count=4 time=18 cyc=4.50
c109f7: count=4 time=41 cyc=10.25
c109fa: count=4 time=20 cyc=5.00
c109fc: count=2 time=11 cyc=5.50
c109ff: count=2 time=21 cyc=10.50
c10a02: count=6 time=49 cyc=8.17
c10a03: count=6 time=66 cyc=11.00
Total time: 114590
Region: c40085 -> c400d3
c40085: count=268 time=1271 cyc=4.74
c40087: count=268 time=1207 cyc=4.50
c4008a: count=268 time=1239 cyc=4.62
c4008d: count=268 time=1219 cyc=4.55
c4008f: count=3387 time=10423 cyc=3.08
c40090: count=3387 time=10416 cyc=3.08
c40091: count=3387 time=15727 cyc=4.64
c40094: count=3387 time=15670 cyc=4.63
c400a9: count=3655 time=37626 cyc=10.29
c400ac: count=3655 time=16489 cyc=4.51
c400ae: count=268 time=1237 cyc=4.62
c400b1: count=268 time=2790 cyc=10.41
c400b4: count=268 time=1212 cyc=4.52
c400b6: count=1954 time=6037 cyc=3.09
c400b7: count=1954 time=6025 cyc=3.08
c400b8: count=1954 time=6058 cyc=3.10
c400b9: count=2222 time=9811 cyc=4.42
c400bb: count=268 time=2722 cyc=10.16
c400be: count=268 time=2477 cyc=9.24
c400c2: count=268 time=2753 cyc=10.27
c400c5: count=268 time=2347 cyc=8.76
c400c8: count=268 time=3861 cyc=14.41
c400cb: count=268 time=822 cyc=3.07
c400cc: count=268 time=832 cyc=3.10
c400cd: count=268 time=813 cyc=3.03
c400ce: count=268 time=824 cyc=3.07
c400cf: count=268 time=814 cyc=3.04
c400d0: count=268 time=2303 cyc=8.59
c400d3: count=268 time=2789 cyc=10.41
Total time: 167814
Region: c44b3a -> c44c6b
c44b3a: count=175 time=806 cyc=4.61
c44b3c: count=175 time=1254 cyc=7.17
c44b3d: count=175 time=1275 cyc=7.29
c44b3e: count=175 time=536 cyc=3.06
c44b3f: count=175 time=818 cyc=4.67
c44b42: count=175 time=533 cyc=3.05
c44b43: count=175 time=1535 cyc=8.77
c44b44: count=176 time=1583 cyc=8.99
c44b46: count=176 time=1541 cyc=8.76
c44b48: count=176 time=1558 cyc=8.85
c44b4a: count=176 time=1503 cyc=8.54
c44b4c: count=176 time=1554 cyc=8.83
c44b4e: count=176 time=1573 cyc=8.94
c44b50: count=176 time=1598 cyc=9.08
c44b53: count=176 time=821 cyc=4.66
c44b56: count=176 time=1543 cyc=8.77
c44b58: count=176 time=1494 cyc=8.49
c44b5a: count=176 time=1543 cyc=8.77
c44b5d: count=176 time=557 cyc=3.16
c44b5e: count=176 time=528 cyc=3.00
c44b5f: count=176 time=537 cyc=3.05
c44b60: count=176 time=528 cyc=3.00
c44b61: count=176 time=538 cyc=3.06
c44b62: count=176 time=547 cyc=3.11
c44b63: count=176 time=792 cyc=4.50
c44b66: count=176 time=537 cyc=3.05
c44b67: count=176 time=1534 cyc=8.72
c44b69: count=176 time=1480 cyc=8.41
c44b6b: count=176 time=1567 cyc=8.90
c44b6d: count=176 time=1481 cyc=8.41
c44b6f: count=176 time=1551 cyc=8.81
c44b71: count=176 time=1523 cyc=8.65
c44b73: count=176 time=824 cyc=4.68
c44b75: count=19 time=88 cyc=4.63
c44b77: count=19 time=58 cyc=3.05
c44b79: count=19 time=122 cyc=6.42
c44b7b: count=19 time=86 cyc=4.53
c44b7d: count=19 time=159 cyc=8.37
c44b7f: count=19 time=58 cyc=3.05
c44b80: count=19 time=58 cyc=3.05
c44b81: count=19 time=58 cyc=3.05
c44b82: count=19 time=258 cyc=13.58
c44b86: count=176 time=1573 cyc=8.94
c44b88: count=176 time=548 cyc=3.11
c44b89: count=176 time=559 cyc=3.18
c44b8a: count=176 time=1547 cyc=8.79
c44b8c: count=176 time=791 cyc=4.49
c44b8f: count=176 time=1522 cyc=8.65
c44b91: count=176 time=772 cyc=4.39
c44b93: count=2784 time=38559 cyc=13.85
c44b95: count=2784 time=12831 cyc=4.61
c44b98: count=2784 time=19996 cyc=7.18
c44b99: count=2784 time=24423 cyc=8.77
c44b9b: count=2784 time=24287 cyc=8.72
c44b9d: count=2784 time=12850 cyc=4.62
c44b9e: count=2784 time=12875 cyc=4.62
c44ba1: count=2784 time=24291 cyc=8.73
c44ba2: count=2784 time=24404 cyc=8.77
c44ba4: count=2784 time=8607 cyc=3.09
c44ba5: count=2784 time=24235 cyc=8.71
c44ba7: count=2784 time=19985 cyc=7.18
c44ba8: count=2784 time=12902 cyc=4.63
c44baa: count=2784 time=23022 cyc=8.27
c44bad: count=2784 time=24292 cyc=8.73
c44bae: count=2784 time=21344 cyc=7.67
c44bb2: count=2784 time=24256 cyc=8.71
c44bb4: count=2784 time=22961 cyc=8.25
c44bb7: count=2784 time=12906 cyc=4.64
c44bb9: count=2784 time=39955 cyc=14.35
c44bbb: count=2784 time=8547 cyc=3.07
c44bbc: count=2784 time=8647 cyc=3.11
c44bbd: count=2784 time=24379 cyc=8.76
c44bbf: count=2784 time=24393 cyc=8.76
c44bc1: count=2784 time=8537 cyc=3.07
c44bc2: count=2784 time=24288 cyc=8.72
c44bc4: count=2960 time=25829 cyc=8.73
c44bc6: count=2960 time=13492 cyc=4.56
c44bc8: count=176 time=1532 cyc=8.70
c44bcb: count=176 time=528 cyc=3.00
c44bcc: count=176 time=1554 cyc=8.83
c44bce: count=176 time=1491 cyc=8.47
c44bd1: count=176 time=823 cyc=4.68
c44bd4: count=176 time=799 cyc=4.54
c44bd6: count=1 time=4 cyc=4.00
c44bd7: count=1 time=5 cyc=5.00
c44bda: count=1 time=10 cyc=10.00
c44bdd: count=176 time=1533 cyc=8.71
c44be0: count=176 time=527 cyc=2.99
c44be1: count=176 time=538 cyc=3.06
c44be2: count=176 time=554 cyc=3.15
c44be3: count=176 time=1499 cyc=8.52
c44be5: count=176 time=1564 cyc=8.89
c44be8: count=176 time=691 cyc=3.93
c44bea: count=69 time=317 cyc=4.59
c44bed: count=107 time=938 cyc=8.77
c44bf0: count=107 time=931 cyc=8.70
c44bf2: count=107 time=977 cyc=9.13
c44bf4: count=107 time=504 cyc=4.71
c44bf7: count=107 time=322 cyc=3.01
c44bf8: count=107 time=945 cyc=8.83
c44bfa: count=107 time=920 cyc=8.60
c44bfc: count=107 time=926 cyc=8.65
c44bfe: count=107 time=940 cyc=8.79
c44c00: count=107 time=331 cyc=3.09
c44c01: count=107 time=332 cyc=3.10
c44c02: count=107 time=330 cyc=3.08
c44c03: count=107 time=319 cyc=2.98
c44c04: count=107 time=322 cyc=3.01
c44c05: count=107 time=320 cyc=2.99
c44c06: count=107 time=509 cyc=4.76
c44c09: count=107 time=320 cyc=2.99
c44c0a: count=107 time=917 cyc=8.57
c44c0c: count=107 time=945 cyc=8.83
c44c0e: count=107 time=940 cyc=8.79
c44c10: count=107 time=947 cyc=8.85
c44c12: count=107 time=971 cyc=9.07
c44c14: count=107 time=508 cyc=4.75
c44c16: count=107 time=331 cyc=3.09
c44c18: count=107 time=707 cyc=6.61
c44c1a: count=107 time=490 cyc=4.58
c44c1c: count=107 time=921 cyc=8.61
c44c1e: count=107 time=321 cyc=3.00
c44c1f: count=107 time=321 cyc=3.00
c44c20: count=107 time=332 cyc=3.10
c44c21: count=107 time=1470 cyc=13.74
c44c25: count=107 time=935 cyc=8.74
c44c27: count=107 time=472 cyc=4.41
c44c2a: count=107 time=331 cyc=3.09
c44c2c: count=107 time=932 cyc=8.71
c44c2e: count=107 time=331 cyc=3.09
c44c2f: count=107 time=330 cyc=3.08
c44c30: count=107 time=910 cyc=8.50
c44c32: count=107 time=501 cyc=4.68
c44c35: count=107 time=947 cyc=8.85
c44c37: count=107 time=498 cyc=4.65
c44c39: count=1688 time=23288 cyc=13.80
c44c3b: count=1688 time=7865 cyc=4.66
c44c3e: count=1688 time=12155 cyc=7.20
c44c3f: count=1688 time=14625 cyc=8.66
c44c41: count=1688 time=14876 cyc=8.81
c44c43: count=1688 time=7644 cyc=4.53
c44c44: count=1688 time=7939 cyc=4.70
c44c47: count=1688 time=14632 cyc=8.67
c44c48: count=1688 time=14796 cyc=8.77
c44c4a: count=1688 time=5183 cyc=3.07
c44c4b: count=1688 time=14690 cyc=8.70
c44c4d: count=1688 time=5220 cyc=3.09
c44c4e: count=1688 time=7915 cyc=4.69
c44c50: count=1688 time=12809 cyc=7.59
c44c54: count=1688 time=14963 cyc=8.86
c44c56: count=1688 time=13864 cyc=8.21
c44c59: count=1688 time=7599 cyc=4.50
c44c5b: count=1688 time=24332 cyc=14.41
c44c5d: count=1688 time=5179 cyc=3.07
c44c5e: count=1688 time=5154 cyc=3.05
c44c5f: count=1688 time=14852 cyc=8.80
c44c61: count=1688 time=14660 cyc=8.68
c44c63: count=1688 time=5136 cyc=3.04
c44c64: count=1688 time=14880 cyc=8.82
c44c66: count=1795 time=15639 cyc=8.71
c44c68: count=1795 time=8267 cyc=4.61
c44c6a: count=176 time=1557 cyc=8.85
c44c6b: count=176 time=1944 cyc=11.05
Total time: 965068
Region: c44c8c -> c44dc9
c44c8c: count=134 time=629 cyc=4.69
c44c8e: count=134 time=968 cyc=7.22
c44c8f: count=134 time=955 cyc=7.13
c44c90: count=134 time=412 cyc=3.07
c44c91: count=134 time=611 cyc=4.56
c44c94: count=134 time=423 cyc=3.16
c44c95: count=134 time=1173 cyc=8.75
c44c96: count=134 time=1133 cyc=8.46
c44c98: count=134 time=1151 cyc=8.59
c44c9a: count=134 time=1120 cyc=8.36
c44c9d: count=134 time=633 cyc=4.72
c44ca0: count=134 time=591 cyc=4.41
c44ca5: count=134 time=1206 cyc=9.00
c44ca8: count=134 time=433 cyc=3.23
c44ca9: count=134 time=413 cyc=3.08
c44caa: count=134 time=1372 cyc=10.24
c44cad: count=134 time=612 cyc=4.57
c44cb0: count=134 time=624 cyc=4.66
c44cb5: count=134 time=620 cyc=4.63
c44cb8: count=134 time=1867 cyc=13.93
c44cbc: count=134 time=433 cyc=3.23
c44cbd: count=134 time=610 cyc=4.55
c44cc0: count=134 time=1199 cyc=8.95
c44cc2: count=134 time=1164 cyc=8.69
c44cc4: count=134 time=1220 cyc=9.10
c44cc6: count=134 time=1378 cyc=10.28
c44cc9: count=134 time=1158 cyc=8.64
c44ccb: count=134 time=1212 cyc=9.04
c44ccd: count=134 time=1389 cyc=10.37
c44cd0: count=134 time=1152 cyc=8.60
c44cd2: count=134 time=1188 cyc=8.87
c44cd4: count=134 time=1355 cyc=10.11
c44cd7: count=134 time=1137 cyc=8.49
c44cd9: count=134 time=1197 cyc=8.93
c44cdb: count=134 time=1156 cyc=8.63
c44cdd: count=134 time=1348 cyc=10.06
c44ce0: count=134 time=632 cyc=4.72
c44d15: count=134 time=600 cyc=4.48
c44d17: count=134 time=1176 cyc=8.78
c44d1a: count=134 time=592 cyc=4.42
c44d43: count=134 time=1177 cyc=8.78
c44d45: count=134 time=420 cyc=3.13
c44d46: count=134 time=966 cyc=7.21
c44d47: count=134 time=1175 cyc=8.77
c44d49: count=134 time=1341 cyc=10.01
c44d4c: count=134 time=1151 cyc=8.59
c44d4e: count=134 time=1798 cyc=13.42
c44d52: count=134 time=412 cyc=3.07
c44d53: count=134 time=413 cyc=3.08
c44d54: count=134 time=1145 cyc=8.54
c44d56: count=134 time=403 cyc=3.01
c44d57: count=134 time=1366 cyc=10.19
c44d5a: count=134 time=1164 cyc=8.69
c44d5b: count=134 time=1164 cyc=8.69
c44d5d: count=134 time=402 cyc=3.00
c44d5e: count=134 time=1178 cyc=8.79
c44d60: count=134 time=423 cyc=3.16
c44d61: count=134 time=1153 cyc=8.60
c44d63: count=134 time=1362 cyc=10.16
c44d66: count=134 time=402 cyc=3.00
c44d68: count=134 time=1815 cyc=13.54
c44d6c: count=134 time=1184 cyc=8.84
c44d6e: count=134 time=612 cyc=4.57
c44d71: count=134 time=624 cyc=4.66
c44d78: count=134 time=1184 cyc=8.84
c44d7a: count=134 time=402 cyc=3.00
c44d7b: count=134 time=410 cyc=3.06
c44d7c: count=134 time=1181 cyc=8.81
c44d7e: count=134 time=1157 cyc=8.63
c44d80: count=134 time=1397 cyc=10.43
c44d83: count=134 time=1208 cyc=9.01
c44d85: count=134 time=1157 cyc=8.63
c44d87: count=134 time=1199 cyc=8.95
c44d89: count=134 time=1377 cyc=10.28
c44d8c: count=134 time=433 cyc=3.23
c44d8d: count=134 time=1175 cyc=8.77
c44d8f: count=134 time=433 cyc=3.23
c44d90: count=134 time=403 cyc=3.01
c44d91: count=134 time=1211 cyc=9.04
c44d93: count=134 time=433 cyc=3.23
c44d94: count=134 time=1165 cyc=8.69
c44d96: count=134 time=1390 cyc=10.37
c44d99: count=134 time=413 cyc=3.08
c44d9b: count=134 time=1911 cyc=14.26
c44d9f: count=134 time=1148 cyc=8.57
c44da1: count=134 time=591 cyc=4.41
c44da4: count=134 time=633 cyc=4.72
c44dab: count=134 time=1184 cyc=8.84
c44dad: count=134 time=413 cyc=3.08
c44dae: count=134 time=403 cyc=3.01
c44daf: count=134 time=1157 cyc=8.63
c44db1: count=134 time=1156 cyc=8.63
c44db3: count=134 time=1355 cyc=10.11
c44db6: count=134 time=1927 cyc=14.38
c44db8: count=134 time=1179 cyc=8.80
c44dba: count=134 time=1165 cyc=8.69
c44dbc: count=134 time=1156 cyc=8.63
c44dbe: count=134 time=1336 cyc=9.97
c44dc1: count=134 time=1121 cyc=8.37
c44dc3: count=134 time=1164 cyc=8.69
c44dc5: count=134 time=1378 cyc=10.28
c44dc8: count=134 time=1166 cyc=8.70
c44dc9: count=134 time=1385 cyc=10.34
Total time: 102148
Region: c44e61 -> c44ff2
c44e61: count=171 time=775 cyc=4.53
c44e63: count=171 time=1222 cyc=7.15
c44e64: count=171 time=1247 cyc=7.29
c44e65: count=171 time=578 cyc=3.38
c44e66: count=171 time=803 cyc=4.70
c44e69: count=171 time=534 cyc=3.12
c44e6a: count=171 time=1541 cyc=9.01
c44e6b: count=171 time=523 cyc=3.06
c44e6c: count=171 time=1493 cyc=8.73
c44e6e: count=171 time=1450 cyc=8.48
c44e70: count=171 time=1531 cyc=8.95
c44e73: count=171 time=757 cyc=4.43
c44e76: count=171 time=790 cyc=4.62
c44e7b: count=171 time=776 cyc=4.54
c44e7e: count=171 time=513 cyc=3.00
c44e80: count=171 time=821 cyc=4.80
c44e83: count=171 time=514 cyc=3.01
c44e85: count=171 time=756 cyc=4.42
c44e88: count=171 time=797 cyc=4.66
c44e96: count=171 time=1439 cyc=8.42
c44e99: count=171 time=518 cyc=3.03
c44e9a: count=171 time=564 cyc=3.30
c44e9b: count=171 time=1704 cyc=9.96
c44e9e: count=171 time=807 cyc=4.72
c44ea1: count=171 time=2373 cyc=13.88
c44ea5: count=171 time=520 cyc=3.04
c44ea6: count=171 time=819 cyc=4.79
c44ea9: count=171 time=523 cyc=3.06
c44eaa: count=171 time=1463 cyc=8.56
c44eac: count=171 time=830 cyc=4.85
c44eaf: count=171 time=743 cyc=4.35
c44eb1: count=12 time=100 cyc=8.33
c44eb4: count=12 time=58 cyc=4.83
c44eb7: count=12 time=52 cyc=4.33
c44ebc: count=12 time=58 cyc=4.83
c44ebe: count=159 time=1390 cyc=8.74
c44ec1: count=159 time=714 cyc=4.49
c44ec4: count=159 time=754 cyc=4.74
c44ede: count=171 time=1530 cyc=8.95
c44ee0: count=171 time=821 cyc=4.80
c44ee2: count=171 time=542 cyc=3.17
c44ee3: count=171 time=777 cyc=4.54
c44ee5: count=171 time=1153 cyc=6.74
c44ee8: count=171 time=787 cyc=4.60
c44eea: count=171 time=524 cyc=3.06
c44eeb: count=171 time=533 cyc=3.12
c44eec: count=171 time=803 cyc=4.70
c44eef: count=171 time=766 cyc=4.48
c44ef2: count=171 time=1533 cyc=8.96
c44ef4: count=171 time=788 cyc=4.61
c44ef7: count=171 time=1552 cyc=9.08
c44ef9: count=171 time=776 cyc=4.54
c44efc: count=171 time=1528 cyc=8.94
c44efe: count=171 time=1467 cyc=8.58
c44f00: count=171 time=1513 cyc=8.85
c44f02: count=171 time=532 cyc=3.11
c44f03: count=171 time=1511 cyc=8.84
c44f05: count=171 time=534 cyc=3.12
c44f06: count=171 time=544 cyc=3.18
c44f07: count=171 time=563 cyc=3.29
c44f08: count=171 time=1512 cyc=8.84
c44f0a: count=171 time=534 cyc=3.12
c44f0b: count=171 time=514 cyc=3.01
c44f0c: count=171 time=757 cyc=4.43
c44f0f: count=171 time=1512 cyc=8.84
c44f11: count=171 time=1469 cyc=8.59
c44f13: count=171 time=1501 cyc=8.78
c44f15: count=171 time=1460 cyc=8.54
c44f17: count=171 time=523 cyc=3.06
c44f18: count=171 time=1480 cyc=8.65
c44f1a: count=171 time=1439 cyc=8.42
c44f1c: count=171 time=2379 cyc=13.91
c44f1e: count=171 time=521 cyc=3.05
c44f1f: count=171 time=523 cyc=3.06
c44f20: count=171 time=522 cyc=3.05
c44f21: count=171 time=522 cyc=3.05
c44f22: count=171 time=534 cyc=3.12
c44f23: count=171 time=534 cyc=3.12
c44f24: count=171 time=1508 cyc=8.82
c44f26: count=171 time=1529 cyc=8.94
c44f28: count=171 time=1464 cyc=8.56
c44f2a: count=171 time=1493 cyc=8.73
c44f2c: count=171 time=512 cyc=2.99
c44f2d: count=171 time=1436 cyc=8.40
c44f2f: count=171 time=1504 cyc=8.80
c44f31: count=171 time=766 cyc=4.48
c44f34: count=171 time=2379 cyc=13.91
c44f36: count=171 time=512 cyc=2.99
c44f37: count=171 time=2357 cyc=13.78
c44f39: count=171 time=1505 cyc=8.80
c44f3b: count=171 time=1467 cyc=8.58
c44f3d: count=171 time=1534 cyc=8.97
c44f3f: count=171 time=543 cyc=3.18
c44f40: count=171 time=553 cyc=3.23
c44f41: count=171 time=2363 cyc=13.82
c44f45: count=171 time=514 cyc=3.01
c44f46: count=171 time=1441 cyc=8.43
c44f48: count=171 time=1513 cyc=8.85
c44f4a: count=171 time=1455 cyc=8.51
c44f4c: count=171 time=1519 cyc=8.88
c44f4e: count=171 time=1457 cyc=8.52
c44f50: count=171 time=1519 cyc=8.88
c44f52: count=171 time=524 cyc=3.06
c44f53: count=171 time=514 cyc=3.01
c44f54: count=171 time=767 cyc=4.49
c44f57: count=171 time=1511 cyc=8.84
c44f59: count=171 time=1490 cyc=8.71
c44f5b: count=171 time=1574 cyc=9.20
c44f5d: count=171 time=1479 cyc=8.65
c44f5f: count=171 time=514 cyc=3.01
c44f60: count=171 time=1524 cyc=8.91
c44f62: count=171 time=1471 cyc=8.60
c44f64: count=171 time=2426 cyc=14.19
c44f66: count=171 time=1490 cyc=8.71
c44f68: count=171 time=543 cyc=3.18
c44f69: count=171 time=532 cyc=3.11
c44f6a: count=171 time=1518 cyc=8.88
c44f6c: count=171 time=1476 cyc=8.63
c44f6e: count=171 time=810 cyc=4.74
c44f71: count=171 time=2392 cyc=13.99
c44f73: count=171 time=524 cyc=3.06
c44f74: count=171 time=2458 cyc=14.37
c44f76: count=171 time=1459 cyc=8.53
c44f78: count=171 time=1496 cyc=8.75
c44f7a: count=171 time=1488 cyc=8.70
c44f7c: count=171 time=512 cyc=2.99
c44f7d: count=171 time=1493 cyc=8.73
c44f7f: count=171 time=1459 cyc=8.53
c44f81: count=171 time=2363 cyc=13.82
c44f83: count=171 time=758 cyc=4.43
c44f86: count=171 time=1496 cyc=8.75
c44f88: count=171 time=1457 cyc=8.52
c44f8b: count=171 time=799 cyc=4.67
c44f8e: count=171 time=1459 cyc=8.53
c44f90: count=171 time=1533 cyc=8.96
c44f92: count=171 time=564 cyc=3.30
c44f93: count=171 time=1484 cyc=8.68
c44f95: count=171 time=534 cyc=3.12
c44f96: count=171 time=1524 cyc=8.91
c44f98: count=171 time=763 cyc=4.46
c44f9b: count=171 time=791 cyc=4.63
c44fd6: count=171 time=1427 cyc=8.35
c44fd8: count=171 time=1514 cyc=8.85
c44fda: count=171 time=1457 cyc=8.52
c44fdc: count=171 time=1488 cyc=8.70
c44fde: count=171 time=1475 cyc=8.63
c44fe0: count=171 time=1518 cyc=8.88
c44fe2: count=171 time=1452 cyc=8.49
c44fe4: count=171 time=1505 cyc=8.80
c44fe6: count=171 time=1496 cyc=8.75
c44fe8: count=171 time=534 cyc=3.12
c44fe9: count=171 time=2436 cyc=14.25
c44fed: count=172 time=2461 cyc=14.31
c44ff1: count=172 time=1519 cyc=8.83
c44ff2: count=172 time=1837 cyc=10.68
Total time: 176094
import os
import pickle
from sortedcontainers import SortedSet
class Bunch(dict):
def __init__(self,**kw):
dict.__init__(self,kw)
self.__dict__ = self
data=None
vhf_fields=((82,85),(88,91),(94,96))
pickle_file = 'data.pcul'
try:
if os.path.exists(pickle_file):
print('Unpickling data from file...')
with open(pickle_file, 'rb') as fp:
data = pickle.load(fp)
except Exception as e:
print('Unable to unpickle:', e)
data = None
# data = None
last_frame = 0
frame_current_add = 0
if data is None:
data = []
print('Loading data from text file...')
with open(r'C:\Users\chara\Documents\prog\earthbound\eb-patches\ccexpand\test-rom\patched-trace.log') as f:
for line in f:
line = line.strip()
assert len(line) == 96, "Bad trace format"
spl = line.split(' ')
d=Bunch()
d.addr = int(spl[0],base=16)
d.inst = spl[1]
v,h,f = tuple(int(x.strip()) for x in (line[x:y] for x,y in vhf_fields))
f += frame_current_add
if f < last_frame:
frame_current_add += 60
f += 60
last_frame = f
d.time = h + v*340 + f*340*262
data.append(d)
with open(pickle_file, 'wb') as fp:
pickle.dump(data,fp)
# Enumerate regions
regions = []
end_of_region = set([
0x008147
])
used_addrs = SortedSet()
count = {}
time_taken = {}
for i,d in enumerate(data[:-1]):
if d.addr not in used_addrs:
count[d.addr] = 0
time_taken[d.addr] = 1
used_addrs.add(d.addr)
if d.inst.lower() == 'rtl' or d.inst.lower() == 'rts' or d.inst.lower() == 'rti':
end_of_region.add(d.addr)
count[d.addr] += 1
time_taken[d.addr] += data[i+1].time - d.time
region_start = None
for addr in used_addrs:
if region_start is None:
region_start = addr
if addr in end_of_region:
region_end = addr
regions.append((region_start,region_end))
region_start = None
rtt = []
with open('output.txt','w') as file:
for s,e in regions:
in_range = used_addrs[used_addrs.index(s):used_addrs.index(e)+1]
print(f'Region: {s:06x} -> {e:06x}',file=file)
region_time_taken = 0
for x in in_range:
print(f' {x:06x}: count={count[x]} time={time_taken[x]} cyc={time_taken[x]/count[x]:.2f}',file=file)
region_time_taken += time_taken[x]
print(f' Total time: {region_time_taken}', file=file)
rtt.append((s,e,region_time_taken))
print('',file=file)
print('Sorted regions:',file=file)
for s,e,t in sorted(rtt, key=lambda tupl: -tupl[2]):
print(f'Region {s:06x} to {e:06x}: {t}',file=file)
Sorted regions:
(in H-dots; for reference, 1 frame ~= 89080)
(3230340 ~= 36.3 frames, ignoring busywait)
c08756 to c0878a: 2093798 <- Busywaiting for next frame
c44b3a to c44c6b: 965068 <- VWF bit drawing routine
c08170 to c08390: 221783 <- Interrupt handler, probably DMAing the tiles
c44e61 to c44ff2: 176094 <- Caller of c44b3a, c44dca
80a0e3 to 80dbe5: 176085 <- Sprite draw callback
c40085 to c400d3: 167814 <- Something relating to VWF...
c08cd5 to c08d78: 155111 <- Something relating to OAM (OAM building in Catador's notes)
c0865f to c086dd: 116510 <- "Decompress to VRAM"
c107af to c10a03: 114590 <- Relating to tilemap and tile buffer, draws window decoration, necessary for text to show
c44c8c to c44dc9: 102148 <- Something with the cursor, necessary for text to show
c09032 to c09085: 75574 <- MULT16 / MULT_YxA
c08efc to c08f14: 75059 <- MEMSET
c445e1 to c447fa: 68395 <- Determines if text will wrap
c44dca to c44e43: 66555 <- Calls c40085
c4002f to c40084: 65577 <- Relating to setting up DMA
c08518 to c0865a: 60867
c10cb6 to c10d5f: 53975 <- Print letter, calls c44e61
c104ee to c1078c: 50082
c186b1 to c187e6: 49911
c0917c to c091e2: 43287
c08ff7 to c09031: 40444 <- MULT168 / EIGHT_BIT_MULT_YxA
809470 to 8094cf: 36959
c08b8e to c08c52: 25075
808c58 to 808ca0: 23557
c44e4d to c44e60: 19302
c09279 to c0acde: 16851
80a0ca to 80a0e2: 14662
c088b1 to c089f2: 14620
c08496 to c08500: 14362
80a023 to 80a039: 13567
c203c3 to c2077c: 13441
c089f3 to c08b18: 12557
c187e7 to c18b2b: 11590
c0915b to c0917b: 10779
c43d24 to c43d74: 10129
c08b26 to c08b8d: 10054
c08ed2 to c08eec: 9191
c10df6 to c10eb3: 8945
c43874 to c438a4: 8723
c213ac to c21627: 8620
c3e450 to c3e4c9: 8078
8094d0 to 809505: 7541
c2109f to c213ab: 6185
c127ef to c12e41: 5828
c43d75 to c43d94: 5116
c10d7c to c10df5: 4927
c0dc4e to c0dcc5: 4673
c43caa to c43cd1: 4223
c20dc5 to c20f07: 4138
c43d95 to c43dda: 3650
c1952f to c198dd: 3640
c1004e to c10077: 3587
c14509 to c14557: 3477
c10efc to c10f3f: 2842
c223d9 to c22473: 2422
c444fb to c445e0: 2361
c08501 to c08517: 2180
c12e42 to c12e62: 2155
c438a5 to c438b0: 2015
c0841b to c08455: 1953
c10a85 to c10ba0: 1574
c1790b to c179a9: 1521
c10c72 to c10c78: 1307
c43f77 to c44069: 1215
c08456 to c08495: 1091
c45e96 to c45ecd: 1045
c20d3f to c20d88: 963
c44af7 to c44b39: 959
c22474 to c224e0: 950
c2032b to c2038a: 761
c2087c to c208b7: 708 <- calls c107af
c43573 to c435e3: 707
c08f22 to c08f2e: 647
c20abc to c20b64: 597
c4599a to c45a26: 558
c10eb4 to c10ee2: 488
c2077d to c207b5: 486
008147 to 008147: 481
c1bb71 to c1ff6a: 430
c202ac to c2032a: 424
c451b1 to c451f9: 379
c10ba1 to c10bd2: 359
c08e9a to c08ed1: 342
c20f26 to c20f57: 337
c2038b to c203c2: 334
c3e4ef to c3e520: 289
c090ff to c0911d: 279
c20f08 to c20f25: 265
c09237 to c09254: 227
c13c04 to c14048: 220
c09231 to c09236: 219
c1866d to c1869c: 196
c09222 to c0922a: 192
c10301 to c10323: 187
c3e4ca to c3e4d3: 129
c14049 to c1406f: 108
c3e4d4 to c3e4df: 74
c10c86 to c10c8b: 64
c07c5b to c07c89: 62
c3e4e0 to c3e4ee: 59
c1aa50 to c1aa5c: 54
c10c80 to c10c85: 51
c1869d to c186b0: 51
c44e44 to c44e4c: 36
c11353 to c11353: 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment