Path: blob/master/libmupen64plus/mupen64plus-core/tools/profiling.txt
2 views
How to profile R4300 instructions with mupen64plus:12Pre-requisites:3- either 32-bit (x86) or 64-bit (amd64) Linux system4- Lots of memory. It doesn't cause swapping in a machine with 2GB of ram, but it probably would with 1GB5- OProfile (http://oprofile.sourceforge.net/)6- Mupen64plus source code78Procedure:91. Install OProfile linux tool10112. Build r4300 profile tool with "gcc -o r4300prof r4300prof.c"12133. Build mupen64plus with "make DBGSYM=1 DBG_PROFILE=1"14154. Delete any pre-existing profiling files: "rm instructionaddrs.dat"16175. Clear any residual profiling data in oprofile: "sudo opcontrol --reset"18196. Make profiling run by typing in console:20sudo opcontrol --start ; ./mupen64plus --nogui --emumode 2 --audio ./plugins/dummyaudio.so <path-to-n64-rom> ; sudo opcontrol --stop21227. Exit emulator with Escape key after running for desired time23247. Move data file into tools folder: "mv instructionaddrs.dat tools/"25268. Dump instruction-level profiling data for mupen64plus with oprofile:27opreport -d -l ./mupen64plus > ./tools/prof-mupen64-detail.txt28299. Run tool to generate r4300 instruction profile report:30cd tools ; ./r4300prof instructionaddrs.dat prof-mupen64-detail.txt313233Example profile output:3435Loading instructionaddrs.dat...36283844 r4300 instruction locations read.37247911 non-empty MIPS instructions.38Loading prof-mupen64-detail.txt...39118181 lines in sample data file.40Found 117905 profile hits.4142Instruction time (samples):43reserved: 00007515 NI: 00000000 J: 00000043 JAL: 00003345 BEQ: 0000449844BNE: 00003424 BLEZ: 00000222 BGTZ: 00000029 ADDI: 00000585 ADDIU: 0001743945SLTI: 00000765 SLTIU: 00000089 ANDI: 00003847 ORI: 00000381 XORI: 0000003546LUI: 00010389 BEQL: 00001873 BNEL: 00002617 BLEZL: 00000013 BGTZL: 0000001047DADDI: 00000000 DADDIU: 00000000 LDL: 00000000 LDR: 00000000 LB: 0000260048LH: 00006653 LW: 00024840 LWL: 00000001 LBU: 00003525 LHU: 0000495449LWU: 00000000 LWR: 00000003 SB: 00003007 SH: 00004133 SW: 0002322150SWL: 00000000 SWR: 00000000 SDL: 00000000 SDR: 00000000 LWC1: 0001240551LDC1: 00001855 LD: 00000815 LL: 00000000 SWC1: 00007671 SDC1: 0000132652SD: 00001233 SC: 00000000 BLTZ: 00000383 BGEZ: 00000331 BLTZL: 0000016153BGEZL: 00000168 BLTZAL: 00000000 BGEZAL: 00000115 BLTZALL: 00000000 BGEZALL: 0000000054SLL: 00003376 SRL: 00000604 SRA: 00000686 SLLV: 00000015 SRLV: 0000003955SRAV: 00000000 JR: 00001358 JALR: 00000004 SYSCALL: 00000000 MFHI: 0000005856MTHI: 00000002 MFLO: 00000277 MTLO: 00000004 DSLLV: 00000000 DSRLV: 0000000057DSRAV: 00000000 MULT: 00000000 MULTU: 00000583 DIV: 00000941 DIVU: 0000000058DMULT: 00000000 DMULTU: 00000000 DDIV: 00000000 DDIVU: 00000000 ADD: 0000017059ADDU: 00001706 SUB: 00000037 SUBU: 00000833 AND: 00000909 OR: 0000636060XOR: 00000079 NOR: 00000004 SLT: 00000925 SLTU: 00001401 DADD: 0000000061DADDU: 00000000 DSUB: 00000000 DSUBU: 00000000 DSLL: 00000000 DSRL: 0000000062DSRA: 00000000 TEQ: 00000000 DSLL32: 00000000 DSRL32: 00000000 DSRA32: 0000000063BC1F: 00000286 BC1T: 00000032 BC1FL: 00000775 BC1TL: 00000077 TLBWI: 0000000064TLBP: 00000000 TLBR: 00000000 TLBWR: 00000000 ERET: 00000036 MFC0: 0000039665MTC0: 00000034 MFC1: 00000929 DMFC1: 00000000 CFC1: 00000141 MTC1: 0000308166DMTC1: 00000000 CTC1: 00000163 f.CVT: 00001113 f.CMP: 00002149 f.ADD: 0000138767f.SUB: 00000947 f.MUL: 00002696 f.DIV: 00000315 f.SQRT: 00000025 f.ABS: 0000000068f.MOV: 00000631 f.NEG: 00000323 f.ROUND: 00000000 f.TRUNC: 00000867 f.CEIL: 0000000069f.FLOOR: 000000007071Special code samples:72Regcache flushing: 1237173Jump wrappers: 1552074NOTCOMPILED: 3375block postfix & link samples: 6197677Unaccounted samples: 1992978Total accounted instruction samples: 22183679Load: 35.2% (68040)80Store: 21.0% (40591)81Data move/convert: 03.5% (6829)8232-bit math: 16.0% (30861)8364-bit math: 05.7% (10948)84Float Math: 04.5% (8709)85Jump: 02.5% (4750)86Branch: 07.8% (15014)87Exceptions: 00.0% (36)88Reserved: 03.9% (7515)89Other: 00.0% (0)90919293