Unravel Engine C++ Reference
Loading...
Searching...
No Matches
profiler.h File Reference
#include <engine/engine_export.h>
#include <chrono>
#include <cstdint>
#include <map>
#include <array>
#include <type_traits>
#include <concepts>
#include <hpp/string_view.hpp>

Go to the source code of this file.

Classes

class  unravel::performance_profiler
 
struct  unravel::performance_profiler::per_frame_data
 
class  unravel::scope_perf_timer
 

Namespaces

namespace  unravel
 

Concepts

concept  unravel::string_literal
 Concept to ensure only string literals are accepted.
 

Macros

#define APP_SCOPE_PERF_CONCATENATE_DETAIL(x, y)
 
#define APP_SCOPE_PERF_CONCATENATE(x, y)
 
#define APP_SCOPE_PERF_UNIQUE_VAR(prefix)
 
#define APP_SCOPE_PERF(name)
 Create a scoped performance timer that only accepts string literals.
 

Functions

auto unravel::get_app_profiler () -> performance_profiler *
 

Macro Definition Documentation

◆ APP_SCOPE_PERF

#define APP_SCOPE_PERF ( name)
Value:
const scope_perf_timer APP_SCOPE_PERF_UNIQUE_VAR(timer)(name, get_app_profiler())
std::string name
Definition hub.cpp:27
#define APP_SCOPE_PERF_UNIQUE_VAR(prefix)
Definition profiler.h:142

Create a scoped performance timer that only accepts string literals.

This macro creates a performance timer that automatically measures the scope duration. Only string literals are accepted to ensure memory safety since names are stored as non-owning pointers.

Parameters
nameString literal name for the performance measurement

Example usage:

void my_function() {
APP_SCOPE_PERF("my_function_performance"); // [OK] Valid - string literal
// ... function code ...
}
// This would cause a compile error with clear message:
// const char* name = "dynamic_name";
// APP_SCOPE_PERF(name); // [ERROR] Clear static_assert message about string literals
#define APP_SCOPE_PERF(name)
Create a scoped performance timer that only accepts string literals.
Definition profiler.h:160

Definition at line 160 of file profiler.h.

◆ APP_SCOPE_PERF_CONCATENATE

#define APP_SCOPE_PERF_CONCATENATE ( x,
y )
Value:
#define APP_SCOPE_PERF_CONCATENATE_DETAIL(x, y)
Definition profiler.h:138
float y
float x

Definition at line 139 of file profiler.h.

◆ APP_SCOPE_PERF_CONCATENATE_DETAIL

#define APP_SCOPE_PERF_CONCATENATE_DETAIL ( x,
y )
Value:
x##y

Definition at line 138 of file profiler.h.

◆ APP_SCOPE_PERF_UNIQUE_VAR

#define APP_SCOPE_PERF_UNIQUE_VAR ( prefix)
Value:
APP_SCOPE_PERF_CONCATENATE(prefix, __LINE__)
#define APP_SCOPE_PERF_CONCATENATE(x, y)
Definition profiler.h:139

Definition at line 142 of file profiler.h.