Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

$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'

Posted (edited)

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
Posted

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
Posted

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

Posted

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

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
×
×
  • Create New...