test.mod
来自「代码优化,有效使用内存,透视优化技术,对比优化方法,如果你在追求代码效率的最大化」· MOD 代码 · 共 35 行
MOD
35 行
; // TEST PROGRAM FOR MEASURING EXECUTION TIME
; // OF INDIVIDUAL MACHINE COMMANDS (OR GROUPS OF COMMANDS)
; // place here machine code for which execution time
; // will be measured using the RDTSC instruction
; // all serialization is already accomplished in DoCPU.asm,
; // therefore you do not need to worry about it here
MOV ECX,1000 ; _ecx = 1000;
; // loop counter
@rool: ; do {
; MUL EAX ; // multiplication command
; // uncomment the previous line
; // if you need to find out how many CPU clocks
; // are required for its execution
REPT 4 ; // macro for cyclic repetition
; // shows how many times to spawn
INC EAX ; // the INC EAX command
ENDM ; // you can experiment with this
; // coefficient
; REPT 4
; FDIV ; // floating-point division
; ENDM
DEC ECX ; _ecx--;
JNZ @rool ; } while(_ecx>0);
; //
; // Q: HOW TO CALCULATE THE EXECUTION TIME OF AN INDIVIDUAL MACHINE COMMAND?
; // A: Divide averaged execution time of this loop by the number of
; // loop iterations and number of commands
; //
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?