struct
#include <src/vt/trace/trace_lite.h>
TraceLite
Derived classes
- struct Trace
- A optional VT component that traces execution on multiple node for performance analysis.
Public types
- using LogType = Log
- using TraceConstantsType = eTraceConstants
- using TimeIntegerType = int64_t
- using EventHoldStackType = std::vector<std::size_t>
- using TraceContainerType = std::queue<LogType>
- using TraceStackType = std::vector<LogType>
Public static functions
- static auto getCurrentTime() -> TimeType
- Get the current time.
- static auto timeToMicros(TimeType const time) -> TimeIntegerType
- Convert time in seconds to integer in microseconds.
Constructors, destructors, conversion operators
- TraceLite(std::string const& in_prog_name)
- System call to construct the trace component.
- ~TraceLite() virtual
Public functions
- void setFlushType(int flush_type)
- Set zlib incremental flush mode for trace file.
- auto getTraceName() const -> std::string
- Get the trace file name for this node.
- auto getSTSName() const -> std::string
- Get the sts file name that holds meta-data.
- auto getDirectory() const -> std::string
- Get the trace directory for output.
- auto registerUserEventColl(std::string const& name) -> UserEventIDType
- Collectively register a user event.
- void setupNames(std::string const& in_prog_name)
- Setup the file names for output.
- void enableTracing()
- Enable logging of events at runtime.
- void disableTracing()
- Disable logging of events.
- void addUserEventBracketedBeginTime(UserEventIDType event, TimeType begin)
- Log the start of the bracketed user event.
- void addUserEventBracketedEndTime(UserEventIDType event, TimeType end)
- Log the end of the bracketed user event.
- void addUserNoteBracketedBeginTime(TraceEventIDType const event, std::string const& note)
- Log the start of the bracketed user event with a note.
- void addUserNoteBracketedEndTime(TraceEventIDType const event)
- Log the end of the bracketed user event with a note.
- void addUserNoteBracketedEndTime(TraceEventIDType const event, std::string const& new_note)
- Log the end of the bracketed user event with a note.
- void beginIdle(TimeType const time = getCurrentTime())
- Scheduler trigger for
sched::SchedulerEvent::BeginIdle
. - void endIdle(TimeType const time = getCurrentTime())
- Scheduler trigger for
sched::SchedulerEvent::EndIdle
. - auto checkDynamicRuntimeEnabled(bool is_end_event = false) -> bool
- Check if tracing is enabled.
- void flushTracesFile(bool useGlobalSync = false)
- Flush traces to file.
- void cleanupTracesFile()
- Cleanup traces data, write to disk and close.
- auto inIdleEvent() const -> bool
- Check if trace is in a idle event.
- auto getNumTraceEvents() const -> std::size_t
- Get the number of recorded trace events.
- auto getLastTraceEvent() -> LogType* noexcept
- Get the last recorded trace event.
Protected static functions
-
static void outputTraces(vt_
gzFile* file, TraceContainerType& traces, TimeType start_time, int flush) - Writes traces to file, optionally flushing. The traces collection is modified.
-
static void outputHeader(vt_
gzFile* file, NodeType const node, TimeType const start) - Output the tracing header.
-
static void outputFooter(vt_
gzFile* file, NodeType const node, TimeType const start) - Output the tracing footer.
- static auto traceWritingEnabled(NodeType node) -> bool
- Check if tracing is enabled on a certain node.
- static auto isStsOutputNode(NodeType node) -> bool
- Check if a node will output the sts file.
Protected functions
- void emitTraceForTopProcessingEvent(TimeType const time, TraceConstantsType const type)
- Emit a 'stop' trace for previous open event or a '[re]start' trace for a reactivated open event. This assists with output flattening.
- void writeTracesFile(int flush, bool is_incremental_flush)
- Write traces to file.
- void outputControlFile(std::ofstream& file)
- Output the sts (control) file.
- auto logEvent(LogType&& log) -> TraceEventIDType
- Log an event, returning a trace event ID if accepted or
no_trace_event
if not accepted (eg. no tracing on node). The log object is invalidated after the call. - auto getTracesSize() const -> std::size_t noexcept
- Get the current traces size.
Protected variables
- int incremental_flush_mode_
- UserEventRegistry user_event_
- EventHoldStackType event_holds_
- TraceStackType open_events_
- TraceContainerType traces_
- TraceEventIDType cur_event_
- UserEventIDType flush_event_
- bool enabled_
- TimeType start_time_
- std::string prog_name_
- std::string trace_name_
- std::string full_trace_name_
- std::string full_sts_name_
- std::string full_dir_name_
- bool wrote_sts_file_
- size_t trace_write_count_
- bool standalone_initalized_
- bool trace_enabled_cur_phase_
- bool idle_begun_
-
std::unique_ptr<vt_
gzFile> log_file_ - std::unordered_map<TraceEventIDType, std::stack<Log*>> incomplete_notes_
Function documentation
static TimeType vt:: trace:: TraceLite:: getCurrentTime()
Get the current time.
Returns | query the current clock time |
---|
static TimeIntegerType vt:: trace:: TraceLite:: timeToMicros(TimeType const time)
Convert time in seconds to integer in microseconds.
Parameters | |
---|---|
time in | the time in seconds as TimeType |
Returns | time in microsecond as integer |
vt:: trace:: TraceLite:: TraceLite(std::string const& in_prog_name)
System call to construct the trace component.
Parameters | |
---|---|
in_prog_name in | the program name |
void vt:: trace:: TraceLite:: setFlushType(int flush_type)
Set zlib incremental flush mode for trace file.
Parameters | |
---|---|
flush_type in | the zlib flush mode |
Available options:
- Z_NO_FLUSH = 0
- Z_PARTIAL_FLUSH = 1
- Z_SYNC_FLUSH = 2
- Z_FULL_FLUSH = 3
- Z_FINISH = 4
- Z_BLOCK = 5
- Z_TREES = 6
std::string vt:: trace:: TraceLite:: getTraceName() const
Get the trace file name for this node.
Returns | the file name |
---|
std::string vt:: trace:: TraceLite:: getSTSName() const
Get the sts file name that holds meta-data.
Returns | the sts file name |
---|
std::string vt:: trace:: TraceLite:: getDirectory() const
Get the trace directory for output.
Returns | the directory path |
---|
UserEventIDType vt:: trace:: TraceLite:: registerUserEventColl(std::string const& name)
Collectively register a user event.
Parameters | |
---|---|
name in | name for the user event |
Returns | the user event ID |
void vt:: trace:: TraceLite:: setupNames(std::string const& in_prog_name)
Setup the file names for output.
Parameters | |
---|---|
in_prog_name in | the program name |
void vt:: trace:: TraceLite:: disableTracing()
Disable logging of events.
void vt:: trace:: TraceLite:: addUserEventBracketedBeginTime(UserEventIDType event,
TimeType begin)
Log the start of the bracketed user event.
Parameters | |
---|---|
event in | the ID for the sts file |
begin in | the begin time |
void vt:: trace:: TraceLite:: addUserEventBracketedEndTime(UserEventIDType event,
TimeType end)
Log the end of the bracketed user event.
Parameters | |
---|---|
event in | the ID for the sts file |
end in | the end time |
void vt:: trace:: TraceLite:: addUserNoteBracketedBeginTime(TraceEventIDType const event,
std::string const& note)
Log the start of the bracketed user event with a note.
Parameters | |
---|---|
event in | the event ID |
note in | the note to log |
void vt:: trace:: TraceLite:: addUserNoteBracketedEndTime(TraceEventIDType const event)
Log the end of the bracketed user event with a note.
Parameters | |
---|---|
event in | the event ID |
void vt:: trace:: TraceLite:: addUserNoteBracketedEndTime(TraceEventIDType const event,
std::string const& new_note)
Log the end of the bracketed user event with a note.
Parameters | |
---|---|
event in | the event ID |
new_note in | the new note which overrides the old one |
void vt:: trace:: TraceLite:: beginIdle(TimeType const time = getCurrentTime())
Scheduler trigger for sched::SchedulerEvent::BeginIdle
.
Parameters | |
---|---|
time in | time it begins idle |
void vt:: trace:: TraceLite:: endIdle(TimeType const time = getCurrentTime())
Scheduler trigger for sched::SchedulerEvent::EndIdle
.
Parameters | |
---|---|
time in | time it ends idle |
bool vt:: trace:: TraceLite:: checkDynamicRuntimeEnabled(bool is_end_event = false)
Check if tracing is enabled.
Parameters | |
---|---|
is_end_event in | whether the event that is being considering to write out in the calling context is actually an end event that needs to be closed |
Returns | whether tracing is enabled |
void vt:: trace:: TraceLite:: flushTracesFile(bool useGlobalSync = false)
Flush traces to file.
Parameters | |
---|---|
useGlobalSync in | whether a global sync should be invoked before flushing output |
bool vt:: trace:: TraceLite:: inIdleEvent() const
Check if trace is in a idle event.
Returns | whether in an idle event |
---|
std::size_t vt:: trace:: TraceLite:: getNumTraceEvents() const
Get the number of recorded trace events.
Returns | the number of trace events |
---|
LogType* vt:: trace:: TraceLite:: getLastTraceEvent() noexcept
Get the last recorded trace event.
Returns | the last recorded trace event |
---|
static void vt:: trace:: TraceLite:: outputTraces(vt_ gzFile* file,
TraceContainerType& traces,
TimeType start_time,
int flush) protected
Writes traces to file, optionally flushing. The traces collection is modified.
Parameters | |
---|---|
file in | the gzip file to write to |
traces in | the container of collected traces |
start_time in | the start time |
flush in | the flush mode |
static void vt:: trace:: TraceLite:: outputHeader(vt_ gzFile* file,
NodeType const node,
TimeType const start) protected
Output the tracing header.
Parameters | |
---|---|
file in | the gzip file |
node in | the node outputting on |
start in | the start time |
static void vt:: trace:: TraceLite:: outputFooter(vt_ gzFile* file,
NodeType const node,
TimeType const start) protected
Output the tracing footer.
Parameters | |
---|---|
file in | the gzip file |
node in | the node outputting on |
start in | the start time |
static bool vt:: trace:: TraceLite:: traceWritingEnabled(NodeType node) protected
Check if tracing is enabled on a certain node.
Parameters | |
---|---|
node in | the node |
Returns | whether it is enabled |
static bool vt:: trace:: TraceLite:: isStsOutputNode(NodeType node) protected
Check if a node will output the sts file.
Parameters | |
---|---|
node in | the node |
Returns | whether it will output |
void vt:: trace:: TraceLite:: emitTraceForTopProcessingEvent(TimeType const time,
TraceConstantsType const type) protected
Emit a 'stop' trace for previous open event or a '[re]start' trace for a reactivated open event. This assists with output flattening.
Parameters | |
---|---|
time in | the time |
type in | type of event to emit |
void vt:: trace:: TraceLite:: writeTracesFile(int flush,
bool is_incremental_flush) protected
Write traces to file.
Parameters | |
---|---|
flush in | the flush mode |
is_incremental_flush in | whether this is an incremental flush |
void vt:: trace:: TraceLite:: outputControlFile(std::ofstream& file) protected
Output the sts (control) file.
Parameters | |
---|---|
file in | the file |
TraceEventIDType vt:: trace:: TraceLite:: logEvent(LogType&& log) protected
Log an event, returning a trace event ID if accepted or no_trace_event
if not accepted (eg. no tracing on node). The log object is invalidated after the call.
Parameters | |
---|---|
log in | the entity to log |
Returns | the trace event ID for that new log |
std::size_t vt:: trace:: TraceLite:: getTracesSize() const protected noexcept
Get the current traces size.
Returns | computed bytes used for tracing (lower bound) |
---|