Call Tree¶
Namespace: dftracer::utils::call_tree
-
class CallTree¶
Simple, clean API for working with call trees from DFTracer traces.
Usage:
CallTree tree; tree.load_from_directory("/path/to/traces"); tree.generate(); tree.print_depth_first(); auto nodes = tree.get_nodes_depth_first(); auto stats = tree.get_statistics(); tree.save_to_file("output.calltree");
Public Functions
-
CallTree()¶
Constructor
-
~CallTree()¶
Destructor
-
bool load_from_directory(const std::string &trace_dir, const std::string &pattern = "*.pfw.gz")¶
Specify trace directory path Automatically finds all .gz compressed trace files in the directory
- Parameters:
trace_dir – Path to directory containing trace files
pattern – Optional file pattern (default: “*.pfw.gz”)
- Returns:
true if directory exists and files found, false otherwise
-
bool generate()¶
Generate call tree from loaded traces Reads all trace files and builds the in-memory call tree structure
- Returns:
true if successful, false otherwise
-
void print_depth_first(int max_depth = 0) const¶
Print depth-first tree to stdout. max_depth=0 means unlimited.
-
std::vector<CallTreeNodeInfo> get_nodes_depth_first() const¶
-
CallTreeStats get_statistics() const¶
Get aggregate statistics about the call tree
- Returns:
Statistics structure with aggregate information
-
void print_statistics() const¶
Print aggregate statistics to stdout
-
bool is_generated() const¶
Check if call tree has been generated
- Returns:
true if generate() completed successfully
-
size_t get_num_trace_files() const¶
Get number of trace files loaded
- Returns:
Number of trace files
-
void clear()¶
Clear all data and reset to initial state
-
std::vector<std::uint32_t> get_process_ids() const¶
Get all unique process IDs in the call tree
- Returns:
Vector of process IDs
-
std::vector<std::uint32_t> get_thread_ids(std::uint32_t pid) const¶
Get all thread IDs for a specific process
- Parameters:
pid – Process ID
- Returns:
Vector of thread IDs
-
std::vector<CallTreeNodeInfo> get_root_nodes(std::uint32_t pid, std::uint32_t tid) const¶
Get root nodes for a specific process/thread combination
- Parameters:
pid – Process ID
tid – Thread ID
- Returns:
Vector of root node information
-
std::vector<CallTreeNodeInfo> get_all_nodes() const¶
Get all nodes in the tree
- Returns:
Vector of all node information
-
CallTreeNodeInfo get_node_by_id(std::uint64_t id) const¶
Get a specific node by ID
- Parameters:
id – Node ID
- Returns:
Node information (empty if not found)
-
internal::CallTree &internal_tree()¶
Direct access to the underlying internal::CallTree. Use with the save_binary / save_arrow coroutines in mpi/serializable.h. Returns a reference; callers must keep the CallTree alive while it’s in use.
-
const internal::CallTree &internal_tree() const¶
-
CallTree()¶
-
struct CallTreeNodeInfo¶
Simple node information structure for public API Contains basic information about a node without complex internals
Public Functions
-
inline CallTreeNodeInfo()¶
-
inline CallTreeNodeInfo()¶
-
struct CallTreeStats¶
Aggregate statistics about the call tree
Public Functions
-
inline CallTreeStats()¶
-
inline CallTreeStats()¶
-
class MPICallTreeBuilder¶
Public Functions
-
explicit MPICallTreeBuilder(const MPICallTreeConfig &config)¶
-
~MPICallTreeBuilder()¶
-
MPICallTreeBuilder(const MPICallTreeBuilder&) = delete¶
-
MPICallTreeBuilder &operator=(const MPICallTreeBuilder&) = delete¶
-
MPICallTreeBuilder(MPICallTreeBuilder&&) noexcept¶
-
MPICallTreeBuilder &operator=(MPICallTreeBuilder&&) noexcept¶
-
void add_trace_files(const std::vector<std::string> &files)¶
-
void add_trace_directory(const std::string &directory, const std::string &pattern = "*.pfw.gz")¶
-
coro::CoroTask<bool> write(CoroScope *scope, std::string output_path, std::string staging_dir, bool gzip)¶
-
coro::CoroTask<bool> merge(std::string output_path, std::string staging_dir, bool gzip, bool keep_staging)¶
-
inline int rank() const¶
-
inline int world_size() const¶
-
inline const std::vector<std::string> &trace_files() const¶
-
inline const std::set<std::uint32_t> &all_pids() const¶
-
inline const std::set<std::uint32_t> &assigned_pids() const¶
-
inline internal::CallTree &local_tree()¶
-
inline const internal::CallTree &local_tree() const¶
-
explicit MPICallTreeBuilder(const MPICallTreeConfig &config)¶
-
struct MPICallTreeConfig¶
Configuration for MPI call tree generation
-
struct MPICallTreeResult¶
Result from MPI call tree generation