Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
sim_profiler.h File Reference

Lightweight performance profiler for libsimcore runtime execution. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "field.h"
Include dependency graph for sim_profiler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimProfilerSnapshot
 Snapshot of accumulated frame statistics. More...
 
struct  SimProfilerCounter
 Per-operator statistics tracked during profiling. More...
 
struct  SimProfiler
 Profiler state used by the runtime scheduler. More...
 

Typedefs

typedef struct SimProfilerSnapshot SimProfilerSnapshot
 Snapshot of accumulated frame statistics.
 
typedef struct SimProfilerCounter SimProfilerCounter
 Per-operator statistics tracked during profiling.
 
typedef struct SimProfiler SimProfiler
 Profiler state used by the runtime scheduler.
 

Functions

SimResult sim_profiler_init (SimProfiler *profiler, size_t operators)
 Initialize the profiler for operators tracked counters.
 
void sim_profiler_destroy (SimProfiler *profiler)
 Release resources held by the profiler.
 
void sim_profiler_begin_frame (SimProfiler *profiler)
 Begin a new profiling frame.
 
void sim_profiler_end_frame (SimProfiler *profiler)
 Complete the active profiling frame.
 
void sim_profiler_record_operator (SimProfiler *profiler, size_t operator_index, uint64_t duration_ns)
 Record the execution time for an operator.
 
void sim_profiler_record_operator_delta (SimProfiler *profiler, size_t operator_index, double delta_rms, uint64_t sample_count)
 Record a delta RMS contribution for an operator.
 
SimResult sim_profiler_snapshot (const SimProfiler *profiler, SimProfilerSnapshot *out_snapshot)
 Populate a snapshot of the most recent frame statistics.
 

Detailed Description

Lightweight performance profiler for libsimcore runtime execution.

Function Documentation

◆ sim_profiler_begin_frame()

void sim_profiler_begin_frame ( SimProfiler profiler)

Begin a new profiling frame.

Parameters
profilerProfiler instance.

◆ sim_profiler_destroy()

void sim_profiler_destroy ( SimProfiler profiler)

Release resources held by the profiler.

Parameters
profilerProfiler instance; may be NULL.

◆ sim_profiler_end_frame()

void sim_profiler_end_frame ( SimProfiler profiler)

Complete the active profiling frame.

Parameters
profilerProfiler instance.

◆ sim_profiler_init()

SimResult sim_profiler_init ( SimProfiler profiler,
size_t  operators 
)

Initialize the profiler for operators tracked counters.

Parameters
[out]profilerProfiler instance to initialize.
operatorsNumber of operators to track.
Returns
SIM_RESULT_OK on success or an error code otherwise.

◆ sim_profiler_record_operator()

void sim_profiler_record_operator ( SimProfiler profiler,
size_t  operator_index,
uint64_t  duration_ns 
)

Record the execution time for an operator.

Parameters
profilerProfiler instance.
operator_indexIndex of the operator within the execution plan.
duration_nsExecution duration in nanoseconds.

◆ sim_profiler_record_operator_delta()

void sim_profiler_record_operator_delta ( SimProfiler profiler,
size_t  operator_index,
double  delta_rms,
uint64_t  sample_count 
)

Record a delta RMS contribution for an operator.

Parameters
profilerProfiler instance.
operator_indexIndex of the operator within the plan.
delta_rmsRoot-mean-square of the operator's field change (single sample or aggregated).
sample_countNumber of samples used to estimate delta_rms.

◆ sim_profiler_snapshot()

SimResult sim_profiler_snapshot ( const SimProfiler profiler,
SimProfilerSnapshot out_snapshot 
)

Populate a snapshot of the most recent frame statistics.

Parameters
profilerProfiler instance.
[out]out_snapshotDestination snapshot structure.
Returns
SIM_RESULT_OK when data is available, otherwise SIM_RESULT_INVALID_ARGUMENT.