|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectParkNPark.common.Logger
public class Logger
Logger class that, as quickly as possible, logs information into a pre-allocated buffer and has facilities for manual and automatic flushing.
| Field Summary | |
|---|---|
protected int |
allocationSize
The number of array elements to allocate when creating new Lists |
protected List<LogEntry> |
log
Our currently-active log |
protected Object |
logMutex
Consistent mutex for the currently-active log (because log can get replaced by a new instance) |
protected BufferedWriter |
probeIn
Sink for the times that method calls begin in |
protected BufferedWriter |
probeMethod
Method name sink |
protected BufferedWriter |
probeOut
Sink for the times that method calls complete in |
protected BufferedWriter |
probeSource
Client name sink |
| Constructor Summary | |
|---|---|
Logger(int numClients,
int requestsPerClient,
int interRequestTime,
int replySize,
String tier,
String hostname,
boolean logSource)
Creates a new Logger instance that can be used to log activities and, in the background, flush existing log entries to disk |
|
| Method Summary | |
|---|---|
LogEntry |
beginLogEntry(String methodName)
Creates a new LogEntry object instance, adds it to the log, and, just before returning it, sets its probeIn property to the current time in microseconds. |
LogEntry |
beginLogEntry(String methodName,
String clientName)
Creates a new LogEntry object instance, adds it to the log, and, just before returning it, sets its probeIn property to the current time in microseconds |
void |
close()
Closes the log files. |
void |
endLogEntry(LogEntry logEntry)
Ends a LogEntry after setting the probeOut property to the current time in microseconds |
void |
flush()
Flush out all the log entries into the output files. |
protected String |
generateLogFileName(int numClients,
int interRequestTime,
int replySize,
String probeType,
String machine,
String hostname)
Generate the name of the log file name according to the given parameters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected List<LogEntry> log
protected Object logMutex
protected int allocationSize
protected BufferedWriter probeIn
protected BufferedWriter probeOut
protected BufferedWriter probeMethod
protected BufferedWriter probeSource
| Constructor Detail |
|---|
public Logger(int numClients,
int requestsPerClient,
int interRequestTime,
int replySize,
String tier,
String hostname,
boolean logSource)
numClients - The number of clients in the current testrequestsPerClient - The number of requests expected from each clientinterRequestTime - The delay between each invocation, which is used when
constructing the log file namesreplySize - The size of the server's replies, which is used when
constructing the log file namestier - The tier being logged: srv or clihostname - The host name of the machine being logged| Method Detail |
|---|
public LogEntry beginLogEntry(String methodName)
methodName - The name of the method that was called
public LogEntry beginLogEntry(String methodName,
String clientName)
methodName - The name of the method that was calledclientName - The hostname of the client that called the method
public void endLogEntry(LogEntry logEntry)
logEntry - The LogEntry instance to finish
public void flush()
throws IOException
logMutex locked or else a deadlock might occur!
IOException - Thrown if an IOException occurs during the flushing,
such as out-of-disk-space exceptions
public void close()
throws IOException
IOException
protected String generateLogFileName(int numClients,
int interRequestTime,
int replySize,
String probeType,
String machine,
String hostname)
numClients - The number of clients in the current testinterRequestTime - The delay between each invocationreplySize - The size of the server's repliesprobeType - The type of probe: in, out,
msg, or sourcemachine - The machine being logged: srv or clihostname - The host name of the machine being logged
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||