LLDB  mainline
Public Member Functions | Private Attributes | List of all members
lldb_private::trace_intel_pt::ScopedTaskTimer Class Reference

Class used to track the duration of long running tasks related to a single scope for reporting. More...

#include <TaskTimer.h>

Collaboration diagram for lldb_private::trace_intel_pt::ScopedTaskTimer:
Collaboration graph
[legend]

Public Member Functions

template<typename C >
auto TimeTask (llvm::StringRef name, C task)
 Execute the given task and record its duration. More...
 
void ForEachTimedTask (std::function< void(const std::string &name, std::chrono::milliseconds duration)> callback)
 Executive the given callback on each recorded task. More...
 

Private Attributes

std::unordered_map< std::string, std::chrono::milliseconds > m_timed_tasks
 

Detailed Description

Class used to track the duration of long running tasks related to a single scope for reporting.

Definition at line 24 of file TaskTimer.h.

Member Function Documentation

◆ ForEachTimedTask()

void ScopedTaskTimer::ForEachTimedTask ( std::function< void(const std::string &name, std::chrono::milliseconds duration)>  callback)

Executive the given callback on each recorded task.

Parameters
[in]callbackThe first parameter of the callback is the name of the recorded task, and the second parameter is the duration of that task.

Definition at line 16 of file TaskTimer.cpp.

Referenced by lldb_private::trace_intel_pt::TraceIntelPT::DumpTraceInfo(), and lldb_private::trace_intel_pt::TraceIntelPT::DumpTraceInfoAsJson().

◆ TimeTask()

template<typename C >
auto lldb_private::trace_intel_pt::ScopedTaskTimer::TimeTask ( llvm::StringRef  name,
task 
)
inline

Execute the given task and record its duration.

Parameters
[in]nameThe name used to identify this task for reporting.
[in]taskThe task function.
Returns
The return value of the task.

Definition at line 36 of file TaskTimer.h.

References m_timed_tasks.

Member Data Documentation

◆ m_timed_tasks

std::unordered_map<std::string, std::chrono::milliseconds> lldb_private::trace_intel_pt::ScopedTaskTimer::m_timed_tasks
private

Definition at line 56 of file TaskTimer.h.

Referenced by TimeTask().


The documentation for this class was generated from the following files: