MDAT
1.0
|
trace manager More...
Public Member Functions | |
void | init (char *fileName, bool _useConsole) |
Initializes the trace manager. More... | |
void | finish () |
Stops the trace. More... | |
void | printHeader (string header) |
Prints the header. More... | |
void | printThreadId (int id) |
Prints the thread ID. More... | |
void | printSection (string section) |
Prints the section. More... | |
void | printMessage (string message) |
Prints the message. More... | |
void | printTables () |
Prints thread, lock, and semaphore tables. More... | |
void | internalError (string errorMsg) |
Report an internal error of MDAT and abort the program. More... | |
void | externalError (string errorMsg) |
Report an external error of MDAT and abort the program. More... | |
The trace manager is responsible for displaying state about the threads, locks, and semaphores to the trace file and/or screen.
The trace format is as follows:
More information regarding each of the the lines in the trace format:
Note that the trace manager is only responsible for printing. The data used by the trace manager is supplied by the appropriate managers, typically by data that is passed into the function.
The trace manager will check to make sure that the lines are printed in the proper order. This is done by an internal traceState variable which can have one of the following states:
If lines are attempted to be printed out of order, the trace manager will abort the program with an error message.
All errors are handled by the trace manager so that the error message can appear in the trace file. Error messages are also printed to the console even if console output has been turned off.
void TraceManager::init | ( | char * | fileName, |
bool | _useConsole | ||
) |
Initializes the trace manager. The traceState is set to HEADER.
[in] | fileName | name of trace file or NULL for no trace file |
[in] | _useConsole | if true, write state to console |
void TraceManager::finish | ( | ) |
Stops the trace, writes the final trailing line(s) and closes the trace file.
void TraceManager::printHeader | ( | string | header) |
Prints the header line. The traceState must be HEADER when the function is called. Switches the traceState to THREAD.
[in] | header | header string |
void TraceManager::printThreadId | ( | int | id) |
Prints the thread id. The traceState must be THREAD when the function is called. Switches the traceState to MESSAGE.
[in] | id | thread id |
void TraceManager::printSection | ( | string | section) |
Prints the section. The traceState must be MESSAGE when the function is called. The traceState remains at MESSAGE.
[in] | section | name of section entered |
void TraceManager::printMessage | ( | string | message) |
Prints the message. The traceState must be MESSAGE when the function is called. Switches the traceState to TABLE.
[in] | message | message to add to trace |
void TraceManager::printTables | ( | ) |
Prints the thread, lock, and semaphore tables. The traceState must be TABLE when the function is called. Switches the traceState to THREAD.
void TraceManager::internalError | ( | string | errorMsg) |
Report an internal error of MDAT and abort the program. This function is used to report failed assertions or sanity checks within MDAT. If MDAT is implemented correctly, this function should never be called.
[in] | errorMsg | error message |
void TraceManager::externalError | ( | string | errorMsg) |
Report an external error of MDAT and abort the program. This function is used to report errors detected by MDAT. This could be due to errors detected by the checker, deadlock, or due to incorrect use of the MDAT functions.
[in] | errorMsg | error message |