Jump to content
Sign in to follow this  
mickisup

Recording timings in XLS or database

Recommended Posts

mickisup

Using the $startticks and $endticks function I am able to capture the time a particular task takes and then display a message tell me how long in ms.

However I want to run many tests to with a specific schedule and record these for later analysis.

Is there a Blog or Article that can explain the best way to do this, or could someone suggest some options.

Thanks

Share this post


Link to post
Share on other sites
WideBoyDixon

Write out the results to a CSV file which you can then analyse in a spreadsheet?

Share this post


Link to post
Share on other sites
mickisup

Write out the results to a CSV file which you can then analyse in a spreadsheet?

What would the order of functions to create and then insert values in over time?

Does anyone have an example of how this might look?

Thanks

Share this post


Link to post
Share on other sites
weaponx

$timer = TimerInit()
$result = TimerDiff($timer);ms

FileWriteLine("results.log", $result)

Share this post


Link to post
Share on other sites
mickisup

$timer = TimerInit()
$result = TimerDiff($timer);ms

FileWriteLine("results.log", $result)
Many thanks that is getting the data into the log file and by saving as CSV I can do what I need in Excel.

However is there an easy way to add exta field to the output file, specifically a datetime stamp and perhaps a way to uniquely identify each measure taken in a third field?

A final CSV file might look like:

1;34455.44:23/04/2009 12:07:00.000'

Share this post


Link to post
Share on other sites
weaponx

You are better off opening a handle to the file and working with that.

$sPath = "results.log"
  Global $hFile = FileOpen($sPath,1);Open file in append mode
  
  Global $iCount = 1
  
  $timer = TimerInit()
  $result = TimerDiff($timer);ms
  Log($result)
  
  
  Func Log($sText)
  Local $Now = StringFormat("%s-%s-%s %s:%s:%s",@YEAR,@MON,@MDAY,@HOUR,@MIN,@SEC)
  FileWriteLine($hFile,StringFormat("%s;%s;%s",$iCount,$Now,$sText))
  $ICount += 1
  EndFunc
Edited by weaponx

Share this post


Link to post
Share on other sites
mickisup

Thanks again, however getting a badly formatted function statement when using this? Anything obvious wrong?

Func Log($sText)
 Local $Now = StringFormat("%s-%s-%s %s:%s:%s",@YEAR,@MON,@MDAY,@HOUR,@MIN,@SEC)
 FileWriteLine($hFile,StringFormat("%s;%s;%s",$iCount,$Now,$sText)
 $ICount += 1
 EndFunc

Share this post


Link to post
Share on other sites
weaponx

Copy it again, there was a parentheses missing from the end of FileWriteLine.

Share this post


Link to post
Share on other sites
mickisup

Copy it again, there was a parentheses missing from the end of FileWriteLine.

Feel very guilty to keep asking!

However even with the missing parentheses I get a Func Log ($sText) badly formatted error on the line where Func Log starts.

Do I have my declare wrong?

;declare search term
$sText = "test"

Func Log($sText)
  Local $Now = StringFormat("%s-%s-%s %s:%s:%s",@YEAR,@MON,@MDAY,@HOUR,@MIN,@SEC)
  FileWriteLine($hFile,StringFormat("%s;%s;%s",$iCount,$Now,$sText))
  $ICount += 1
  EndFunc

Thanks

Share this post


Link to post
Share on other sites
weaponx

I forgot Log is a reserved function name:

$sPath = "results.log"
Global $hFile = FileOpen($sPath,1);Open file in append mode

Global $iCount = 1

$timer = TimerInit()
$result = TimerDiff($timer);ms
_Log($result)
  
Func _Log($sText)
    Local $Now = StringFormat("%s-%s-%s %s:%s:%s",@YEAR,@MON,@MDAY,@HOUR,@MIN,@SEC)
    FileWriteLine($hFile,StringFormat("%s;%s;%s",$iCount,$Now,$sText))
    $ICount += 1
EndFunc

Share this post


Link to post
Share on other sites
mickisup

Cheers weaponx, that works perfectly now.

Extremely grateful, does exactly what I need.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×