Blender V4.5
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)   blender::timeit::ScopedTimer 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)
StringRefNull name
std::chrono::nanoseconds Nanoseconds
Definition BLI_timeit.hh:21
__int64 int64_t
Definition stdint.h:89

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::bke::pbvh::Tree::from_grids(), and blender::bke::pbvh::Tree::from_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.