mickisup Posted April 22, 2009 Share Posted April 22, 2009 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 More sharing options...
WideBoyDixon Posted April 22, 2009 Share Posted April 22, 2009 Write out the results to a CSV file which you can then analyse in a spreadsheet? [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
mickisup Posted April 22, 2009 Author Share Posted April 22, 2009 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 More sharing options...
weaponx Posted April 22, 2009 Share Posted April 22, 2009 $timer = TimerInit() $result = TimerDiff($timer);ms FileWriteLine("results.log", $result) Link to comment Share on other sites More sharing options...
mickisup Posted April 23, 2009 Author Share Posted April 23, 2009 $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 More sharing options...
weaponx Posted April 23, 2009 Share Posted April 23, 2009 (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 April 23, 2009 by weaponx Link to comment Share on other sites More sharing options...
mickisup Posted April 23, 2009 Author Share Posted April 23, 2009 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 More sharing options...
weaponx Posted April 23, 2009 Share Posted April 23, 2009 Copy it again, there was a parentheses missing from the end of FileWriteLine. Link to comment Share on other sites More sharing options...
mickisup Posted April 23, 2009 Author Share Posted April 23, 2009 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 More sharing options...
weaponx Posted April 23, 2009 Share Posted April 23, 2009 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 More sharing options...
mickisup Posted April 23, 2009 Author Share Posted April 23, 2009 Cheers weaponx, that works perfectly now.Extremely grateful, does exactly what I need. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now