Monday, October 25, 2010

GetTickCount

Tonight I was trying to debug some slow SCL code, and wanted to pinpoint exactly which routines were taking the longest to execute. QUEST has a systime() routine that returns the number of seconds since midnight. However, I wanted more accuracy, so I needed to use the GetTickCount routine provided by the Windows API.

I can call this routine using C_EXEC in SCL, and the final routine comes out like this:

routine get_tick_count() : Integer
Const
THE_DLL 'kernel32.dll'
THE_CMD 'GetTickCount'
Var
func_return : Integer
Begin
func_return = c_exec( THE_DLL + ":" + THE_CMD )
return func_return
End

Now, I can get a bit more visibility into what's taking my logics so long to run (though be sure to disable any calls to this routine once you're ready to just run the model)

0 comments: