Timer#
-
class TimerSession#
RAII timer session for automatic cleanup.
Automatically stops timing when session goes out of scope.
Public Functions
-
inline TimerSession(std::function<void()> onEnd) noexcept#
Construct active session with callback.
- Parameters:
onEnd – Callback to execute on destruction
-
inline TimerSession(std::nullptr_t) noexcept#
Construct inactive session.
-
inline ~TimerSession() noexcept#
Destructor - executes callback if active.
-
TimerSession(TimerSession const&) = delete#
Deleted copy constructor.
-
TimerSession &operator=(TimerSession const&) = delete#
Deleted copy assignment.
-
inline TimerSession(TimerSession &&other) noexcept#
Move constructor.
-
inline TimerSession &operator=(TimerSession &&other) noexcept#
Move assignment operator.
-
inline TimerSession(std::function<void()> onEnd) noexcept#
-
class Timer#
Preallocated event pool. Longer-lived profiling can grow without waiting for earlier stages.
Public Functions
-
void reserve(size_t maxSamples, size_t maxSequences = 1)#
-
inline size_t capacity() const noexcept#
Number of timing slots whose CUDA events have been created.
-
inline void setGpuTimingEnabled(bool enabled) noexcept#
When disabled, profiling keeps host-side acceptance records but creates no CUDA events or stage samples.
- void recordAcceptance(
- int32_t sequenceIndex,
- int32_t proposed,
- int32_t accepted,
- int32_t output,
- int32_t bonus,
- int32_t baseLength,
- bool provenanceExact = false,
- bool proposedExact = false
- inline std::vector<AcceptanceSample> const &getAcceptanceSamples(
-
void reset() noexcept#
-
void beginRequest()#
-
void setRound(int32_t round) noexcept#
-
void setPastLengths(std::vector<int32_t> const &lengths)#
Host-known past lengths for the next forward; empty means unavailable without device readback.
- TimerSession startStage(
- std::string const &stageId,
- cudaStream_t stream
- TimerSession startForward(
- std::string const &modelRole,
- int64_t batch,
- int64_t tokens,
- int64_t selected,
- cudaStream_t stream
- std::optional<StageTimingData> getTimingData(
- std::string const &stageId
- std::unordered_map<std::string, StageTimingData> const &getAllTimingData(
-
std::vector<TimingSample> const &getSamples() const#
-
void reserve(size_t maxSamples, size_t maxSequences = 1)#
-
class TimerProxy#
Keeps legacy profiling call sites attached to the current runtime’s event storage.
Public Functions
-
inline void reserve(size_t size, size_t maxSequences = 1)#
-
inline size_t capacity() const noexcept#
- inline void recordAcceptance(
- int32_t sequenceIndex,
- int32_t proposed,
- int32_t accepted,
- int32_t output,
- int32_t bonus,
- int32_t baseLength,
- bool provenanceExact = false,
- bool proposedExact = false
- inline std::vector<AcceptanceSample> const &getAcceptanceSamples(
-
inline void reset() noexcept#
-
inline void beginRequest()#
-
inline void setRound(int32_t round) noexcept#
-
inline void setPastLengths(std::vector<int32_t> const &lengths)#
- inline TimerSession startStage(
- std::string const &stage,
- cudaStream_t stream
- inline TimerSession startForward(
- std::string const &modelRole,
- int64_t batch,
- int64_t tokens,
- int64_t selected,
- cudaStream_t stream
- inline std::optional<StageTimingData> getTimingData(
- std::string const &stage
- inline std::unordered_map<std::string, StageTimingData> const &getAllTimingData(
-
inline std::vector<TimingSample> const &getSamples() const#
-
inline void reserve(size_t size, size_t maxSequences = 1)#
-
struct TimerPair#
CUDA event pair for timing.
Lazy-initialized timer pair using CUDA events.
-
struct StageTimingData#
Stage timing data.
Stores raw timing measurements and calculates derived values on-demand.
Public Functions
-
inline void addTiming(float timeMs)#
Add timing measurement.
- Parameters:
timeMs – Time in milliseconds
-
inline void reset() noexcept#
Reset all timing data.
-
inline float getTotalGpuTimeMs() const noexcept#
Calculate total GPU time.
- Returns:
Total time in milliseconds
-
inline float getAverageTimeMs() const noexcept#
Calculate average time per run.
- Returns:
Average time in milliseconds
-
inline int64_t getTotalRuns() const noexcept#
Get total number of runs.
- Returns:
Run count
Public Members
-
std::vector<float> gpuTimesMs#
GPU time measurements in milliseconds.
-
inline void addTiming(float timeMs)#
-
struct TimingSample#
One completed invocation; model forwards are children of their semantic stage.
Public Members
-
std::string stageId#
-
std::string parentStage#
-
uint64_t requestId = {0}#
-
int32_t round = {-1}#
-
int64_t batchSize = {0}#
-
int64_t queryTokens = {0}#
-
int64_t selectedTokens = {0}#
-
std::vector<int32_t> pastLengths#
-
bool forward = {false}#
-
int32_t forwardIndex = {-1}#
Forward ordinal within this request and round; -1 for stages.
-
float gpuTimeMs = {0}#
-
std::string stageId#
-
struct AcceptanceSample#
Host-visible acceptance facts collected at the production token readback boundary.
Public Members
-
uint64_t requestId#
-
int32_t round#
-
int32_t sequenceIndex#
-
int32_t proposedDrafts#
-
int32_t acceptedDrafts#
-
int32_t outputTokens#
-
int32_t bonusTokens#
-
int32_t baseMaterializedLength#
-
bool provenanceExact#
-
bool proposedExact#
False when proposedDrafts is a verify-tree capacity, not valid proposal nodes.
-
uint64_t requestId#
-
bool trt_edgellm::getProfilingEnabled() noexcept#
Thread-local profiling control flag Controls aggregate counters and GPU stage timing; per-request collection is opt-in. This is useful to exclude warmup runs from benchmark statistics
-
void trt_edgellm::setProfilingEnabled(bool enabled) noexcept#