19using Clock = std::chrono::steady_clock;
33 start_ = Clock::now();
48 std::optional<int64_t> window_size_;
55 const std::optional<int64_t> window_size)
56 : name_(std::move(
name)),
57 total_count_(total_count),
60 window_size_(window_size)
62 start_ = Clock::now();
70#define SCOPED_TIMER(name) blender::timeit::ScopedTimer scoped_timer(name)
76#define SCOPED_TIMER_AVERAGED(name) \
77 static int64_t total_count_; \
78 static blender::timeit::Nanoseconds total_time_; \
79 static blender::timeit::Nanoseconds min_time_ = blender::timeit::Nanoseconds::max(); \
80 blender::timeit::ScopedTimerAveraged scoped_timer( \
81 name, total_count_, total_time_, min_time_, std::nullopt)
87#define SCOPED_TIMER_ROLLING_AVERAGED(name, window_size) \
88 static int64_t total_count_; \
89 static blender::timeit::Nanoseconds total_time_; \
90 static blender::timeit::Nanoseconds min_time_ = blender::timeit::Nanoseconds::max(); \
91 blender::timeit::ScopedTimerAveraged scoped_timer( \
92 name, total_count_, total_time_, min_time_, window_size)
ScopedTimerAveraged(std::string name, int64_t &total_count, Nanoseconds &total_time, Nanoseconds &min_time, const std::optional< int64_t > window_size)
ScopedTimer(std::string name)
std::chrono::nanoseconds Nanoseconds
Clock::time_point TimePoint
std::chrono::steady_clock Clock
void print_duration(Nanoseconds duration)