holoscan::DataFlowTracker
holoscan::DataFlowTracker
The DataFlowTracker class is used to track the data flow metrics for different paths between the root operators and leaf operators.
This class is used by the developers to get the metrics data for flow during the execution of the application and at the end of it.
This class uses mutex locks on metric properties so that multiple threads on multiple operators can update the metrics without conflicts.
Constructors
DataFlowTracker
Destructor
~DataFlowTracker
Methods
set_skip_starting_messages
Set the number of messages to skip at the beginning of the execution.
This does not affect the log file or the number of source messages metric.
Parameters
The number of messages to skip.
set_skip_latencies
Set the threshold latency for which the end-to-end latency calculations will be done.
Any latency strictly less than the threshold latency will be ignored.
This does not affect the log file or the number of source messages metric.
Parameters
The threshold latency in milliseconds.
set_discard_last_messages
Set the number of messages to discard at the end of the execution.
This does not affect the log file or the number of source messages metric.
Parameters
The number of messages to discard.
set_limited_tracking
Set the limited tracking option which enables tracking only at root and leaf operators.
This also means that distinction between paths are ignored if multiple paths have the same root and leaf operators.
Parameters
The boolean value to set the limited tracking option. True enables tracking only at root and leaf operators.
limited_tracking
Get whether the limited tracking option is enabled or not.
Returns: false if limited tracking is not enabled.
enable_logging
Enable message logging at the end of the every execution of a leaf Operator.
A path consisting of an array of tuples in the form of (an Operator name, message receive timestamp, message publish timestamp) is logged in a file. The logging does not take into account the number of message to skip or discard or the threshold latency.
This function buffers a number of lines set by the num_buffered_messages parameter before flushing the buffer to the log file.
Parameters
The name of the log file.
The number of messages to be buffered before flushing the buffer to the log file.
Print the result of the data flow tracking in pretty-printed format to the standard output.
get_num_paths
Return the number of tracked paths.
Returns: The number of tracked paths.
get_path_strings
Return an array of strings which are path names.
Each path name is a comma-separated list of Operator names in a path. The paths are agnostic to the edges between two Operators.
Returns: An array of the path names.
get_metric
Return the value of a metric m for a given path
Return the value of a metric
Return the value of a metric m for a given path.
If m is DataFlowMetric::kNumSrcMessages, then the function returns -1.
Returns: The value of the metric m for the given path.
Parameters
The path name string for which the metric is being queried.
The metric to be queried.
end_logging
Write out the remaining messages from the log buffer and close the ofstream.
generate_frame_number
Generate a new frame number for a root operator.
Returns: The new frame number for the operator
Parameters
The name of the root operator
reset_frame_numbers
Reset frame numbers for all operators.
set_port_frame_number
Set frame number for a specific operator port (for NVTX display).
Parameters
The name of the root operator
The name of the output port
The frame number to set
get_port_frame_numbers
Get port-specific frame numbers for an operator (for NVTX display).
Returns: Map of operator-port keys to their frame numbers (e.g., “tx-out1” -> 1)
Parameters
The name of the operator
add_probe_operator
Add a probe operator by name.
If the operator name is already registered as a probe operator, a warning message will be logged.
Parameters
The name of the operator to register as a probe operator.
update_latency
Update the tracker with the current latency for a given path.
The function internally takes care of skipping beginning messages or discarding last messages.
This function is not intended to be called by the developers. However, they may choose to update the latencies manually to account for some external overheads.
Parameters
The path name string for which the latency is being updated.
The current latency value.
update_source_messages_number
Update the tracker with the number of published messages for a given source Operator.
This function is not intended to be called by the developers. However, they may choose to update the number of messages externally.
Parameters
The name of the source in the form of [OperatorName->OutputName].
The new number of published messages.
write_to_logfile
Writes to a log file only if file logging is enabled.
Otherwise, the function does nothing. It also takes care of buffering the messages and flushing them to the log file periodically.
Parameters
The new text to be written to the log file.
add_root_op
The following are internal functions to be used by the GXFExecutor to add root/leaf/probe operators to the tracker after the operators are initialized by GXF.
add_leaf_op
add_probe_op
finalize_probe
is_root_codelet
is_leaf_codelet
is_probe_codelet
check_probe_op_name
Checks if the operator name is added by calling add_probe_operator(std::string).
Returns: true if the operator name was added by calling add_probe_operator(std::string), false otherwise.
Parameters
The name of the operator to check.