Jump to content

Recording timings in XLS or database


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...