9#ifndef LLDB_UTILITY_TIMER_H
10#define LLDB_UTILITY_TIMER_H
13#include "llvm/Support/Chrono.h"
14#include "llvm/Support/FormatVariadic.h"
28 explicit Category(
const char *category_name);
47 __attribute__((format(printf, 3, 4)))
51 Timer(
Category &category,
const llvm::formatv_object_base &obj);
67 using TimePoint = std::chrono::steady_clock::time_point;
70 void Start(llvm::function_ref<std::string()> start_message_func);
88#define LLDB_SCOPED_TIMER() \
89 static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \
90 ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION)
91#define LLDB_SCOPED_TIMERF(...) \
92 static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \
93 ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)
94#define LLDB_SCOPED_TIMERV(...) \
95 static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION); \
96 ::lldb_private::Timer _scoped_timer(_cat, llvm::formatv(__VA_ARGS__))
A stream class that can stream formatted output to a file.
Category(const Category &)=delete
std::atomic< Category * > m_next
std::atomic< uint64_t > m_nanos
std::atomic< uint64_t > m_nanos_total
Category(const char *category_name)
const Category & operator=(const Category &)=delete
llvm::StringRef GetName()
std::atomic< uint64_t > m_count
static void ResetCategoryTimes()
const Timer & operator=(const Timer &)=delete
Timer(const Timer &)=delete
static std::atomic< bool > g_quiet
TimePoint::duration m_child_duration
static std::atomic< unsigned > g_display_depth
void Start(llvm::function_ref< std::string()> start_message_func)
static void SetQuiet(bool value)
static void SetDisplayDepth(uint32_t depth)
std::chrono::steady_clock::time_point TimePoint
void ChildDuration(TimePoint::duration dur)
Timer(Category &category, const char *format,...) __attribute__((format(printf
Default constructor.
static void DumpCategoryTimes(Stream &s)
A class that represents a running process on the host machine.