From: Frank Kotler on
Frank Kotler wrote:

....
>> fld8 100.0e-9
>> fmul
>
> This looks suspicious to me. Wouldn't you want 0.01e-9? (a.k.a.
> 1.0e-11)? Or 100.0e9 and fdiv?

My mistake. e9 != e6 ...

Best,
Frank

From: Mint on
On Jun 6, 12:09 pm, Frank Kotler <fbkot...(a)myfairpoint.net> wrote:
> Frank Kotler wrote:
>
> ...
>
> >>     fld8 100.0e-9
> >>     fmul
>
> > This looks suspicious to me. Wouldn't you want 0.01e-9? (a.k.a.
> > 1.0e-11)? Or 100.0e9 and fdiv?
>
> My mistake. e9 != e6 ...
>
> Best,
> Frank

This is what I ended up with.
Using a batch file with this, you can log any program's use.

Andy

; qtime by QWord
include \masm32\include\masm32rt.inc

..code
main proc
LOCAL sui:STARTUPINFO
LOCAL pi:PROCESS_INFORMATION
LOCAL creationTime:QWORD
LOCAL exitTime:QWORD
LOCAL sysTime:QWORD
LOCAL runTime:REAL8
LOCAL ppwszCommand:PVOID
LOCAL pwszName:PWCHAR
LOCAL nArgs:SDWORD
LOCAL time[5]:DWORD

mov ppwszCommand,rv(CommandLineToArgvW,ASM(mov
edx,rv(GetCommandLineW)),ADDR nArgs)
.if nArgs != 2
print "missing argumnet",13,10
ret
.endif
m2m pwszName,[eax+4]

invoke memfill,ADDR sui,SIZEOF sui,0 ; fill STARTUPINFO
mov sui.cb,SIZEOF sui ;
.if rv(CreateProcessW,0,pwszName,0,0,1,0,0,0,ADDR sui,ADDR pi)
.if rv(WaitForSingleObject,pi.hProcess,INFINITE) != WAIT_FAILED
.if rv(GetProcessTimes, pi.hProcess, ADDR creationTime, ADDR
exitTime,ADDR sysTime, ADDR sysTime)

mov eax,DWORD ptr exitTime[0] ; calc time difference
mov edx,DWORD ptr exitTime[4] ; = run time
sub eax,DWORD ptr creationTime[0] ;
sbb edx,DWORD ptr creationTime[4] ;

mov ecx,10000 ; div by 10*1000
div ecx ; eax = ms

mov ecx,1000 ;
xor edx,edx ;
div ecx ; eax = s , edx = ms
mov time[0*4],edx ;

mov ecx,60 ;
xor edx,edx ;
div ecx ; eax = m , edx = s
mov time[1*4],edx ;

mov ecx,60 ;
xor edx,edx ;
div ecx ; eax = h , edx = m
mov time[2*4],edx ;

mov ecx,24 ;
xor edx,edx ;
div ecx ; eax = d , edx = h
mov time[3*4],edx ;
mov time[4*4],eax ;

print " dd:hh:mm:ss:_ms",13,10
fn crt_printf,"run time: %02d:%02d:%02d:%02d:
%03d",time[3*4],time[3*4],time[2*4],time[1*4],time[0*4]
print chr$(13,10)
.else
print "GetProcessTimes fails",13,10
.endif
.else
print "WaitForSingelObject fails",13,10
.endif
invoke CloseHandle,pi.hProcess
.else
print "executable not found",13,10
.endif

ret
main endp
end main