#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <atomic>
#include <signal.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include <inttypes.h>
#include "minitrace.h"
Go to the source code of this file.
Classes | |
struct | raw_event |
Macros | |
#define | __STDC_FORMAT_MACROS |
#define | ARRAY_SIZE(x) sizeof(x)/sizeof(x[0]) |
#define | ATTR_NORETURN |
#define | FALSE 0 |
#define | STRING_POOL_SIZE 100 |
#define | TRUE 1 |
Typedefs | |
typedef struct raw_event | raw_event_t |
Functions | |
static int | get_cur_process_id () |
static int | get_cur_thread_id () |
void | internal_mtr_raw_event (const char *category, const char *name, char ph, void *id) |
void | internal_mtr_raw_event_arg (const char *category, const char *name, char ph, void *id, mtr_arg_type arg_type, const char *arg_name, void *arg_value) |
void | mtr_flush () |
void | mtr_flush_with_state (int) |
void | mtr_init (const char *json_file) |
void | mtr_init_from_stream (void *stream) |
const char * | mtr_pool_string (const char *str) |
void | mtr_register_sigint_handler () |
void | mtr_shutdown () |
void | mtr_start () |
void | mtr_stop () |
double | mtr_time_s () |
static void | termination_handler (int signum) ATTR_NORETURN |
Variables | |
static int | cur_process_id |
static __thread int | cur_thread_id |
static raw_event_t * | event_buffer |
static std::atomic_int | event_count |
static pthread_mutex_t | event_mutex |
static int | events_in_progress = 0 |
static FILE * | f |
static int | first_line = 1 |
static raw_event_t * | flush_buffer |
static int | is_flushing = FALSE |
static int | is_tracing = FALSE |
static pthread_mutex_t | mutex |
static char * | str_pool [100] |
static int64_t | time_offset |
#define __STDC_FORMAT_MACROS |
Definition at line 32 of file minitrace.cpp.
#define ARRAY_SIZE | ( | x | ) | sizeof(x)/sizeof(x[0]) |
Definition at line 43 of file minitrace.cpp.
#define ATTR_NORETURN |
Definition at line 40 of file minitrace.cpp.
#define FALSE 0 |
Definition at line 45 of file minitrace.cpp.
#define STRING_POOL_SIZE 100 |
Definition at line 80 of file minitrace.cpp.
#define TRUE 1 |
Definition at line 44 of file minitrace.cpp.
typedef struct raw_event raw_event_t |
|
inlinestatic |
Definition at line 132 of file minitrace.cpp.
|
inlinestatic |
Definition at line 129 of file minitrace.cpp.
void internal_mtr_raw_event | ( | const char * | category, |
const char * | name, | ||
char | ph, | ||
void * | id | ||
) |
Definition at line 377 of file minitrace.cpp.
void internal_mtr_raw_event_arg | ( | const char * | category, |
const char * | name, | ||
char | ph, | ||
void * | id, | ||
mtr_arg_type | arg_type, | ||
const char * | arg_name, | ||
void * | arg_value | ||
) |
Definition at line 434 of file minitrace.cpp.
void mtr_flush | ( | ) |
Definition at line 373 of file minitrace.cpp.
void mtr_flush_with_state | ( | int | is_last | ) |
Definition at line 265 of file minitrace.cpp.
void mtr_init | ( | const char * | json_file | ) |
Definition at line 195 of file minitrace.cpp.
void mtr_init_from_stream | ( | void * | stream | ) |
Definition at line 178 of file minitrace.cpp.
const char* mtr_pool_string | ( | const char * | str | ) |
Definition at line 227 of file minitrace.cpp.
void mtr_register_sigint_handler | ( | ) |
Definition at line 167 of file minitrace.cpp.
void mtr_shutdown | ( | ) |
Definition at line 202 of file minitrace.cpp.
void mtr_start | ( | ) |
Definition at line 242 of file minitrace.cpp.
void mtr_stop | ( | ) |
Definition at line 251 of file minitrace.cpp.
double mtr_time_s | ( | ) |
Definition at line 143 of file minitrace.cpp.
|
static |
Definition at line 156 of file minitrace.cpp.
|
static |
Definition at line 76 of file minitrace.cpp.
|
static |
Definition at line 75 of file minitrace.cpp.
|
static |
Definition at line 66 of file minitrace.cpp.
|
static |
Definition at line 68 of file minitrace.cpp.
|
static |
Definition at line 78 of file minitrace.cpp.
|
static |
Definition at line 71 of file minitrace.cpp.
|
static |
Definition at line 74 of file minitrace.cpp.
|
static |
Definition at line 73 of file minitrace.cpp.
|
static |
Definition at line 67 of file minitrace.cpp.
|
static |
Definition at line 70 of file minitrace.cpp.
|
static |
Definition at line 69 of file minitrace.cpp.
|
static |
Definition at line 77 of file minitrace.cpp.
|
static |
Definition at line 81 of file minitrace.cpp.
|
static |
Definition at line 72 of file minitrace.cpp.