Blender V5.0
BLI_timeit.hh File Reference
#include <chrono>
#include <optional>
#include <string>
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

class  blender::timeit::ScopedTimer
class  blender::timeit::ScopedTimerAveraged

Namespaces

namespace  blender
namespace  blender::timeit

Macros

#define SCOPED_TIMER(name)
#define SCOPED_TIMER_AVERAGED(name)
#define SCOPED_TIMER_ROLLING_AVERAGED(name, window_size)

Typedefs

using blender::timeit::Clock = std::chrono::steady_clock
using blender::timeit::TimePoint = Clock::time_point
using blender::timeit::Nanoseconds = std::chrono::nanoseconds

Functions

void blender::timeit::print_duration (Nanoseconds duration)

Macro Definition Documentation

◆ SCOPED_TIMER

◆ SCOPED_TIMER_AVERAGED

#define SCOPED_TIMER_AVERAGED ( name)
Value:
static int64_t total_count_; \
static blender::timeit::Nanoseconds total_time_; \
static blender::timeit::Nanoseconds min_time_ = blender::timeit::Nanoseconds::max(); \
name, total_count_, total_time_, min_time_, std::nullopt)
long long int int64_t
std::chrono::nanoseconds Nanoseconds
Definition BLI_timeit.hh:21

Print the average and minimum runtime of the timer's scope.

Warning
This uses static variables, so it is not thread-safe.

Definition at line 76 of file BLI_timeit.hh.

Referenced by blender::bke::pbvh::build_mesh_leaf_nodes(), blender::ed::sculpt_paint::undo::PositionUndoStorage::compress_fn(), blender::bke::pbvh::Tree::from_grids(), blender::bke::pbvh::Tree::from_mesh(), and blender::ed::sculpt_paint::undo::restore_position_mesh().

◆ SCOPED_TIMER_ROLLING_AVERAGED

#define SCOPED_TIMER_ROLLING_AVERAGED ( name,
window_size )
Value:
static int64_t total_count_; \
static blender::timeit::Nanoseconds total_time_; \
static blender::timeit::Nanoseconds min_time_ = blender::timeit::Nanoseconds::max(); \
name, total_count_, total_time_, min_time_, window_size)

Print the rolling average and minimum runtime of the timer's scope.

Warning
This uses static variables, so it is not thread-safe.

Definition at line 87 of file BLI_timeit.hh.