Can be used to generate timings of multiple processes simultaneously and output logs.
This static class records timings of multiple processes simultaneously and allows for these timings to be written out in json format, one file for each process. Multiple overlapping sections can be timed independently on the same process. It also allows for the timings to be written out to json logfiles in a specified interval, for example every half hour.
Note that this class logs timings in milliseconds.
Definition at line 28 of file ProcessTimer.h.
Static Public Member Functions | |
static void | add_metadata (json data) |
static void | end_timer (std::string section_name) |
static std::list< std::chrono::time_point< std::chrono::steady_clock > > | get_durations (std::string section_name) |
static pid_t | get_process () |
static void | print_durations (std::string to_print="all") |
static void | print_timestamps () |
static void | set_process (pid_t proc) |
static void | set_write_interval (int write_interval) |
static void | setup (pid_t proc, bool set_begin=true) |
static void | start_timer (std::string section_name) |
static void | write_file () |
Private Types | |
using | duration_map_t = std::map< std::string, std::list< std::chrono::time_point< std::chrono::steady_clock > > > |
Static Private Attributes | |
static std::chrono::time_point< std::chrono::steady_clock > | begin = chrono::steady_clock::now() |
static duration_map_t | durations |
static json | metadata |
static std::chrono::time_point< std::chrono::steady_clock > | previous_write = chrono::steady_clock::now() |
static pid_t | process = 0 |
static int | times_written = 0 |
static int | write_interval = 0 |
|
private |
Definition at line 58 of file ProcessTimer.h.
|
static |
Definition at line 162 of file ProcessTimer.cxx.
|
static |
Definition at line 69 of file ProcessTimer.cxx.
|
static |
Definition at line 37 of file ProcessTimer.cxx.
|
inlinestatic |
Definition at line 39 of file ProcessTimer.h.
|
static |
Definition at line 93 of file ProcessTimer.cxx.
|
static |
Definition at line 116 of file ProcessTimer.cxx.
|
inlinestatic |
Definition at line 40 of file ProcessTimer.h.
|
static |
Definition at line 175 of file ProcessTimer.cxx.
|
inlinestatic |
Definition at line 31 of file ProcessTimer.h.
|
static |
Definition at line 53 of file ProcessTimer.cxx.
|
static |
Definition at line 139 of file ProcessTimer.cxx.
|
staticprivate |
Definition at line 61 of file ProcessTimer.h.
|
staticprivate |
Definition at line 60 of file ProcessTimer.h.
|
staticprivate |
Definition at line 64 of file ProcessTimer.h.
|
staticprivate |
Definition at line 62 of file ProcessTimer.h.
|
staticprivate |
Definition at line 63 of file ProcessTimer.h.
|
staticprivate |
Definition at line 66 of file ProcessTimer.h.
|
staticprivate |
Definition at line 65 of file ProcessTimer.h.