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

Go to the source code of this file.

Classes

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

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::timeit

Macros

#define SCOPED_TIMER(name)
#define SCOPED_TIMER_AVERAGED(name)
#define SCOPED_TIMER_AVERAGED_NTH_SAMPLES(name, nth_samples)
#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 timeit::Nanoseconds total_time_; \
static timeit::Nanoseconds min_time_ = timeit::Nanoseconds::max(); \
timeit::ScopedTimerAveraged scoped_timer( \
name, total_count_, total_time_, min_time_, std::nullopt, std::nullopt)
long long int int64_t

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 70 of file BLI_timeit.hh.

Referenced by blender::ed::sculpt_paint::undo::PositionUndoStorage::compress_fn().

◆ SCOPED_TIMER_AVERAGED_NTH_SAMPLES

#define SCOPED_TIMER_AVERAGED_NTH_SAMPLES ( name,
nth_samples )
Value:
static int64_t total_count_; \
static timeit::Nanoseconds total_time_; \
static timeit::Nanoseconds min_time_ = timeit::Nanoseconds::max(); \
timeit::ScopedTimerAveraged scoped_timer( \
name, total_count_, total_time_, min_time_, std::nullopt, nth_samples)

Print the average and minimum runtime of the timer's scope, every nth samples.

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

Definition at line 81 of file BLI_timeit.hh.

◆ SCOPED_TIMER_ROLLING_AVERAGED

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

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 92 of file BLI_timeit.hh.