HyperPlatform Programmer's Reference
Classes | Macros
perf_counter.h File Reference

Declares interfaces to performance measurement primitives. More...

#include <fltKernel.h>
Include dependency graph for perf_counter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PerfCollector
 Responsible for collecting and saving data supplied by PerfCounter. More...
 
struct  PerfCollector::PerfDataEntry
 Represents performance data for each location. More...
 
class  PerfCollector::ScopedLock
 Scoped lock. More...
 
class  PerfCounter
 Measure elapsed time of the scope. More...
 

Macros

#define HYPERPLATFORM_PERFCOUNTER_P_JOIN2(x, y)   x##y
 
#define HYPERPLATFORM_PERFCOUNTER_P_JOIN1(x, y)   HYPERPLATFORM_PERFCOUNTER_P_JOIN2(x, y)
 
#define HYPERPLATFORM_PERFCOUNTER_P_JOIN(x, y)   HYPERPLATFORM_PERFCOUNTER_P_JOIN1(x, y)
 Concatinates two tokens. More...
 
#define HYPERPLATFORM_PERFCOUNTER_P_TO_STRING1(n)   #n
 
#define HYPERPLATFORM_PERFCOUNTER_P_TO_STRING(n)   HYPERPLATFORM_PERFCOUNTER_P_TO_STRING1(n)
 Converts a token to a string literal. More...
 
#define HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME(collector, query_time_routine)
 Creates an instance of PerfCounter to measure an elapsed time of this scope. More...
 

Detailed Description

Declares interfaces to performance measurement primitives.

Warning
All exposed interfaces but HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME are meant to be for internal use only. Also, the macro is only used by a wrapper code.
See also
performance.h

Definition in file perf_counter.h.

Macro Definition Documentation

◆ HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME

#define HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME (   collector,
  query_time_routine 
)
Value:
const PerfCounter HYPERPLATFORM_PERFCOUNTER_P_JOIN(perf_obj_, __COUNTER__)( \
(collector), (query_time_routine), \
__FUNCTION__ "(" HYPERPLATFORM_PERFCOUNTER_P_TO_STRING(__LINE__) ")")
#define HYPERPLATFORM_PERFCOUNTER_P_JOIN(x, y)
Concatinates two tokens.
Definition: perf_counter.h:31
Measure elapsed time of the scope.
Definition: perf_counter.h:277
#define HYPERPLATFORM_PERFCOUNTER_P_TO_STRING(n)
Converts a token to a string literal.
Definition: perf_counter.h:38

Creates an instance of PerfCounter to measure an elapsed time of this scope.

Parameters
collectorA pointer to a PerfCollector instance
query_time_routineA function pointer to get an elapsed time
See also
HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME

This macro should not be used directly. Instead use HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME.

This macro creates an instance of PerfCounter named perf_obj_N where N is a sequential number starting at 0. A current function name and a source line number are converted into a string literal and passed to the instance to uniquely identify a location of measurement. The instance gets "counters" in elapsed time and passes it to collector as well as the created string literal. In pseudo code, for example:

Hello.cpp:233 | {
Hello.cpp:234 | HYPERPLATFORM_PERFCOUNTER_MEASURE_TIME(collector, fn);
Hello.cpp:235 | // do stuff
Hello.cpp:236 | }

This works as if below:

{
begin_time = fn(); //perf_obj_0.ctor();
// do stuff
elapsed_time = fn(); //perf_obj_0.dtor();
collector->AddTime(elapsed_time, "Hello.cpp(234)");
}
Warning
Do not use this macro in where going to be unavailable at the time of a call of PerfCollector::Terminate(). This causes access violation because this macro builds a string literal in a used section, and the string is referenced in the PerfCollector::Terminate(), while it is no longer accessible if the section is already destroyed. In other words, do not use it in any functions in the INIT section.

Definition at line 82 of file perf_counter.h.

◆ HYPERPLATFORM_PERFCOUNTER_P_JOIN

#define HYPERPLATFORM_PERFCOUNTER_P_JOIN (   x,
 
)    HYPERPLATFORM_PERFCOUNTER_P_JOIN1(x, y)

Concatinates two tokens.

Parameters
x1st token
y2nd token

Definition at line 31 of file perf_counter.h.

◆ HYPERPLATFORM_PERFCOUNTER_P_JOIN1

#define HYPERPLATFORM_PERFCOUNTER_P_JOIN1 (   x,
 
)    HYPERPLATFORM_PERFCOUNTER_P_JOIN2(x, y)

Definition at line 25 of file perf_counter.h.

◆ HYPERPLATFORM_PERFCOUNTER_P_JOIN2

#define HYPERPLATFORM_PERFCOUNTER_P_JOIN2 (   x,
 
)    x##y

Definition at line 24 of file perf_counter.h.

◆ HYPERPLATFORM_PERFCOUNTER_P_TO_STRING

#define HYPERPLATFORM_PERFCOUNTER_P_TO_STRING (   n)    HYPERPLATFORM_PERFCOUNTER_P_TO_STRING1(n)

Converts a token to a string literal.

Parameters
nA token to convert to a string literal

Definition at line 38 of file perf_counter.h.

◆ HYPERPLATFORM_PERFCOUNTER_P_TO_STRING1

#define HYPERPLATFORM_PERFCOUNTER_P_TO_STRING1 (   n)    #n

Definition at line 34 of file perf_counter.h.