We've discussed how to read journals, and how to use them to track down problems. Journals can also be used to recreate and create. Complex journal files built over a full working session perhaps don't work so well, but journal files created for specific purpose can be useful. For instance, Ken Stowe from Autodesk has in the past created journal files that can be used to sequence a Revit model using multiple phases to generate still frames of a Revit model being assembled. Journal files can be used to repeat tasks. Code can also be inserted into journal files to make changes or make things happen.
One useful thing you can do is insert code to create timers. Creating timers in a journal file allows us to test how long Revit takes to perform certain operations. So, we can create a journal file with specific tasks and operations that we plan to time. When creating a journal file to use for whatever purposes you need to be very specific about the tasks you do. In order to make it easier to read/edit the journal, excessive view manipulation, and "errors" should be avoided. Rather the specific tasks should carried out with the least possible mouse movement (shortcuts help). Once you've written your journal file, it is much easier to edit it if it has been cleaned (see the end of this post). When "writing" a journal file it is important that you always have the original file available that you start with, otherwise the journal will not run correctly. Another note, it is possible to save when creating a journal file, however when running the journal it must be able to exactly replicate the saving conditions. Writing journals with Workshared files also creates some difficulties, your best bet is to work with a detached copy, and not save.
With the clean journal file to create timers some basic code needs to be inserted at the beginning, after the line that contains "username":
Set fso = CreateObject("Scripting.FileSystemObject") 'create external file object
Set outf = fso.OpenTextFile("c:\My Temp\Journal Results\TimeResults.txt", 2, True) 'insert path for results file
Dim sTime,eTime,comment 'initialize variables
The first line starts the process, the second line "Set out f..." establishes where the results from the timers will be saved, and the last line "Dim..." sets the variables for the timers. After that, it is only a matter of actually creating the timers themselves.
Each timer is broke into a start and end. The end code looks like this (remember any line that starts with ( ' ) is a comment):
'stop timer code eTime = DateDiff("s", sTime, Time) 'put this at end of sequence to be timed. outf.WriteLine eTime & " Seconds of Elapsed Time for:" & comment 'end of code
I usually start with the end code, as you may recall it is easier to find "transaction complete" then the start. Once I have my end code in, I look for the start of the operation I want to time, and then I add the start code that looks like this:
'start timer code sTime = Time 'put this at start of sequence to be timed. comment = "Test Sequence Blah Blah" 'comment to specify what we are timing. 'stuff to time here
With the start code, its important to note that you need to add a comment to describe or name the timer where it says: comment = "Test Sequence Blah Blah"
A finished journal timer should look something like the image to the right.
Once you're code is inserted, you should be all set to run the journal. To run the journal, you will want to drag and drop the Journal file onto the Revit.exe icon located under ..\Program Files\Revit flavor\Program
At Burt Hill we've developed a utility that takes care of running journal files automatically, and repeatedly, so that we can gather multiple instances of results from the same machine running the same test. This allows for a better statistical comparison of machine performance from machine to machine, and makes it easier to run the same journal. We've also modified the code a little bit so that multiple results are appended to a single results file. With the code above, the results file is overwritten everytime the journal is run.
If you're interested, pop over to this AUGI thread. You'll find our benchmarker utility, and a couple of journal and revit files available for testing your machine(s). We've also tested using project files, however simply due to size, I can't release those. You'll also find a utility for cleaning the journal files, to make them easier to read.
Subscribe to:
Post Comments (Atom)
1 comment:
this is useful :)
Post a Comment