载入中...
搜索中...
未找到
eve::prof::Profiler类 参考

Global zone collector + per-frame aggregator. 更多...

#include <Profile.h>

类

struct  Frame
 
struct  ThreadBuffer
 

静态 Public 成员函数

static void setEnabled (bool on)
 Turns collection on/off globally (off = single-branch no-op).
 
static bool enabled ()
 True when collection is active.
 
static void zoneBegin (const char *name, const char *module=nullptr)
 Opens a scoped zone on the current thread.
 
static void zoneEnd ()
 Closes the innermost open zone on the current thread.
 
static double frameMark ()
 Finalizes the current frame: snapshots all thread buffers and aggregates them into lastFrame().
 
static bool hasFrame ()
 True once at least one frame has been aggregated.
 
static const std::vector< ZoneSample > & lastFrame ()
 Per-module/per-zone samples of the last frame, sorted by self time.
 
static std::vector< ZoneSample > hotspots (std::size_t limit, double minSelfMs)
 Copy the hottest zones from the last completed frame.
 
static std::string textReport ()
 Human-readable report of the last frame.
 
static void reset ()
 Clears all collected state.
 
static uint32_t moduleId (const char *module)
 Interns a module name and returns its stable id.
 

详细描述

Global zone collector + per-frame aggregator.

All methods are cheap when disabled. Most methods are called from the main thread; the collector also snapshots off-main-thread buffers at frameMark().

在文件 Profile.h 第 66 行定义.

成员函数说明

◆ enabled()

bool eve::prof::Profiler::enabled ( )
static

True when collection is active.

在文件 Profile.cpp 第 95 行定义.

被这些函数引用 eve::profiler::Profiler::enabled().

◆ frameMark()

double eve::prof::Profiler::frameMark ( )
static

Finalizes the current frame: snapshots all thread buffers and aggregates them into lastFrame().

返回
Wall time spent aggregating (not the frame duration).

在文件 Profile.cpp 第 133 行定义.

引用了 a, eve::prof::Profiler::Frame::beginNs, eve::prof::ZoneSample::count, count, f, eve::prof::ZoneSample::minDepth, n, name, eve::prof::ZoneSample::name, p, r, s, eve::prof::ZoneSample::selfMs, t, tb, eve::prof::ZoneSample::thread, eve::prof::ZoneSample::totalMs, x , 以及 y.

被这些函数引用 eve::profiler::Profiler::endFrame().

◆ hasFrame()

bool eve::prof::Profiler::hasFrame ( )
static

True once at least one frame has been aggregated.

在文件 Profile.cpp 第 227 行定义.

被这些函数引用 eve::profiler::Profiler::hasFrame().

◆ hotspots()

std::vector< ZoneSample > eve::prof::Profiler::hotspots ( std::size_t  limit,
double  minSelfMs 
)
static

Copy the hottest zones from the last completed frame.

参数
limitMaximum rows to return; 0 returns an empty vector.
minSelfMsDrop zones whose selfMs is strictly below this threshold.
返回
Owning samples still sorted by selfMs descending; empty when no frame. @cost Linear in last-frame zone count plus up to limit copies; call after frame aggregation for diagnosis, never per entity.

在文件 Profile.cpp 第 231 行定义.

引用了 limit, out , 以及 eve::prof::Profiler::Frame::samples.

被这些函数引用 eve::profiler::Profiler::hotspots().

◆ lastFrame()

const std::vector< ZoneSample > & eve::prof::Profiler::lastFrame ( )
static

Per-module/per-zone samples of the last frame, sorted by self time.

在文件 Profile.cpp 第 229 行定义.

引用了 eve::prof::Profiler::Frame::samples.

被这些函数引用 eve::profiler::Profiler::capture() , 以及 eve::profiler::Profiler::captureFrame().

◆ moduleId()

uint32_t eve::prof::Profiler::moduleId ( const char *  module)
static

Interns a module name and returns its stable id.

在文件 Profile.cpp 第 77 行定义.

引用了 id.

被这些函数引用 zoneBegin().

◆ reset()

void eve::prof::Profiler::reset ( )
static

Clears all collected state.

在文件 Profile.cpp 第 123 行定义.

引用了 tb.

被这些函数引用 eve::profiler::Profiler::reset().

◆ setEnabled()

void eve::prof::Profiler::setEnabled ( bool  on)
static

Turns collection on/off globally (off = single-branch no-op).

在文件 Profile.cpp 第 90 行定义.

被这些函数引用 eve::profiler::Profiler::setEnabled().

◆ textReport()

std::string eve::prof::Profiler::textReport ( )
static

Human-readable report of the last frame.

在文件 Profile.cpp 第 244 行定义.

引用了 eve::prof::Profiler::Frame::beginNs, eve::prof::Profiler::Frame::endNs, s , 以及 eve::prof::Profiler::Frame::samples.

被这些函数引用 eve::profiler::Profiler::textReport().

◆ zoneBegin()

void eve::prof::Profiler::zoneBegin ( const char *  name,
const char *  module = nullptr 
)
static

Opens a scoped zone on the current thread.

参数
nameZone name, which must stay readable until frameMark().
moduleModule label, same lifetime requirement.
注解
Ownership/lifetime: only the pointers are stored (ZoneRecord::name), and frameMark() reads them a whole frame later, so both must be static storage (string literals). Passing a pointer into a scope-local buffer is a dangling read that no sanitizer in this build reports.

在文件 Profile.cpp 第 97 行定义.

引用了 idx, moduleId(), name, eve::prof::ZoneRecord::name, r , 以及 tb.

被这些函数引用 eve::profiler::Profiler::begin() , 以及 eve::profiler::Profiler::passBegin().

◆ zoneEnd()

void eve::prof::Profiler::zoneEnd ( )
static

Closes the innermost open zone on the current thread.

在文件 Profile.cpp 第 114 行定义.

引用了 idx , 以及 tb.

被这些函数引用 eve::profiler::Profiler::end() , 以及 eve::profiler::Profiler::passEnd().


该类的文档由以下文件生成: