|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--autohit.vm.VM | +--autohit.utils.Log
A logging mechanism. It will add timing information and is syncronized so more than one thread can post. The data is put in a temp file, so memory usage should not get out of hand ( as does a StringBuffer).
All entries will automatically have a LF appended to the end. Timing information shows up to 7 digits--[0000000]. Granularity is passed to the constructor; note that the timing will automatically be scaled by the VM class. DO NOT USE the default constructor.
Note that while the log timing does support pause() and resume(), it does not account for the timing of client threads, so timing information for items posted by threads may or may not be completely accurate. (For instance, pausing all the running VMs AND the Log will not happen instantaniously, so there may be some variances in timing when they are all resumed.)
To ensure that the temp file is removed, call the close() method when done.
Any exceptions that are caught during a put() or putSub() are caught and ignored. I really don't expect any to come out of those methods, and if they do, then other REAL bad stuff is probibly already underway...
This class actually extends the VM base class, as it provides the timing functionality that we want.
NOTE! The timing is started on construction. If you want to wait, immeadiatly call the pause() method.
VM
Field Summary | |
int |
gran
Granulatiry for each tick of the VM's clock. |
Fields inherited from class autohit.vm.VM |
ip,
scDirty,
scope,
state,
STATE_DONE,
STATE_NEW,
STATE_NO_VM,
STATE_PAUSED,
STATE_RUNNING,
TIME_GRAN,
vars |
Constructor Summary | |
Log(int granularity)
Constructor. |
Method Summary | |
void |
close()
Close the log and free/close any resources. |
java.io.InputStream |
done()
Done with the log. |
java.io.File |
done(java.lang.String pathName)
Done with the log. |
void |
execute()
Doesn't do a thing. |
void |
put(java.lang.String text)
Put an entry in the log. |
void |
putSub(java.lang.String text)
Put a sub-entry in the log. |
Methods inherited from class autohit.vm.VM |
discardScopeFrame,
getIntegerVar,
getState,
getVar,
pause,
popScope,
prepare,
pushScope,
removeVar,
resume,
setVar,
start,
subVar,
ticks |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public int gran
Constructor Detail |
public Log(int granularity) throws java.lang.Exception
granulariy
- granularity for timing information. This
should be a Positive number. If it is
0, the constructor will throw an Exception
(since it would cause divide by 0 exceptions
in other methods of this class).VM
Method Detail |
public void put(java.lang.String text)
text
- the text to log.public void putSub(java.lang.String text)
text
- the text to log.public java.io.InputStream done()
public java.io.File done(java.lang.String pathName)
pathName
- pathname to the file where the log should be written.public void close()
public void execute()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |