home *** CD-ROM | disk | FTP | other *** search
- ;
- ; *** Listing 2 ***
- ;
- ; Program to measure performance of code that takes less than
- ; 54 ms to execute.
- ;
- ; Link with Listing 1.
- ;
- COM = 1
- EXE = 0
-
- if EXE
- stack segment para stack 'STACK'
- db 512 dup(?)
- stack ends
- endif
-
- CODE segment para public 'CODE'
- assume cs:CODE, ds:CODE
- extrn _TimerOn:near, _TimerOff:near, _TimerReport:near
-
- if COM
- org 100H ;Let's make this a .COM file, eh? v1.1
- endif
-
- Start proc near
- ; Start the timer.
- call _TimerOn
-
- IFDEF REALLY_DUMB_CODE
- ; ***** Code to be measured starts here *****
- rept 1000
- shr dx,1
- shr dx,1
- shr dx,1
- add ax,dx
- endm
- ; ***** Code to be measured ends here *****
- ELSE
- mov cx,1000
- testlup:
- xor dx,dx ;clear
- mul ax ;this takes time .. and not code!
- loop testlup
- ENDIF
- ;
- ; Stop the timer.
- call _TimerOff
- ; Display the results.
- call _TimerReport
- ; Terminate the program.
- mov ah,4ch
- int 21h
- Start endp
-
- CODE ends
- end Start