Tracing module. To add a new tracing type, create a constant for the type in trace_types.h. Then register it in the switch() statement below. You may also want to add a macro for that tracing type in trace.h.
More...
#include "util/trace.h"
#include <cstdio>
#include "kits_thread.h"
|
| static void | trace_print_pthread (FILE *out_stream, pthread_t thread) |
| | Print the specified pthread_t to the specified stream. This function is reentrant. It does not flush the specified stream when complete. More...
|
| |
| static void | trace_stream (FILE *out_stream, const char *filename, int line_num, const char *function_name, char const *format, va_list ap) |
| | Prints the entire trace message to the specified stream. More...
|
| |
| void | trace_set (unsigned int trace_type_mask) |
| | Specify the set of trace types that are currently enabled. More...
|
| |
| unsigned int | trace_get () |
| | Get the set of trace types that are currently enabled. More...
|
| |
|
| static unsigned int | trace_current_setting = ~0u |
| | Bit vector representing the current set of messages to be printed. Should be set at runtime to turn different message types on and off. We initialize it here to enable all messages. That way, any messages we print during client startup will be printed. More...
|
| |
| static const int | FORCE_BUFFER_SIZE = 256 |
| |
| static pthread_mutex_t | stream_mutex = thread_mutex_create() |
| |
Tracing module. To add a new tracing type, create a constant for the type in trace_types.h. Then register it in the switch() statement below. You may also want to add a macro for that tracing type in trace.h.
- Author
- Naju Mancheril (ngm)
§ trace_get()
| unsigned int trace_get |
( |
| ) |
|
Get the set of trace types that are currently enabled.
§ trace_print_pthread()
| static void trace_print_pthread |
( |
FILE * |
out_stream, |
|
|
pthread_t |
thread |
|
) |
| |
|
static |
Print the specified pthread_t to the specified stream. This function is reentrant. It does not flush the specified stream when complete.
- Parameters
-
| out_stream | The stream to print the pthread_t to. |
| thread | The pthread_t to print. |
- Returns
- void
§ trace_set()
| void trace_set |
( |
unsigned int |
trace_type_mask | ) |
|
Specify the set of trace types that are currently enabled.
- Parameters
-
| trace_type_mask | Bitmask used to specify the current set of trace types. |
§ trace_stream()
| static void trace_stream |
( |
FILE * |
out_stream, |
|
|
const char * |
filename, |
|
|
int |
line_num, |
|
|
const char * |
function_name, |
|
|
char const * |
format, |
|
|
va_list |
ap |
|
) |
| |
|
static |
Prints the entire trace message to the specified stream.
- Parameters
-
| out_stream | The stream to print to. We flush after the print. We also make one call to fprintf(), so the message should be printed atomically. |
| filename | The filename that the message is coming from. Used in message prefix. |
| line_num | The line number that the message is coming from. Used in message prefix. |
| function_name | The name of the function where the message is coming from. Used in message prefix. |
| format | The format of the output message (not counting the prefix). |
| ap | The parameters for format. |
- Returns
- void
§ FORCE_BUFFER_SIZE
| const int FORCE_BUFFER_SIZE = 256 |
|
static |
§ stream_mutex
§ trace_current_setting
| unsigned int trace_current_setting = ~0u |
|
static |
Bit vector representing the current set of messages to be printed. Should be set at runtime to turn different message types on and off. We initialize it here to enable all messages. That way, any messages we print during client startup will be printed.