HyperPlatform Programmer's Reference
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PerfCollector Class Reference

Responsible for collecting and saving data supplied by PerfCounter. More...

#include <perf_counter.h>

Collaboration diagram for PerfCollector:
Collaboration graph
[legend]

Classes

struct  PerfDataEntry
 Represents performance data for each location. More...
 
class  ScopedLock
 Scoped lock. More...
 

Public Types

using InitialOutputRoutine = void(_In_opt_ void *output_context)
 A function type for printing out a header line of results. More...
 
using FinalOutputRoutine = void(_In_opt_ void *output_context)
 A function type for printing out a footer line of results. More...
 
using OutputRoutine = void(_In_ const char *location_name, _In_ ULONG64 total_execution_count, _In_ ULONG64 total_elapsed_time, _In_opt_ void *output_context)
 A function type for printing out results. More...
 
using LockRoutine = void(_In_opt_ void *lock_context)
 A function type for acquiring and releasing a lock. More...
 

Public Member Functions

void Initialize (_In_ OutputRoutine *output_routine, _In_opt_ InitialOutputRoutine *initial_output_routine=NoOutputRoutine, _In_opt_ FinalOutputRoutine *final_output_routine=NoOutputRoutine, _In_opt_ LockRoutine *lock_enter_routine=NoLockRoutine, _In_opt_ LockRoutine *lock_leave_routine=NoLockRoutine, _In_opt_ void *lock_context=nullptr, _In_opt_ void *output_context=nullptr)
 Constructor; call this only once before any other code in this module runs. More...
 
void Terminate ()
 Destructor; prints out accumulated performance results. More...
 
bool AddData (_In_ const char *location_name, _In_ ULONG64 elapsed_time)
 Saves performance data taken by PerfCounter. More...
 

Private Member Functions

ULONG GetPerfDataIndex (_In_ const char *key)
 Returns an index of data corresponds to the location_name. More...
 

Static Private Member Functions

static void NoOutputRoutine (_In_opt_ void *output_context)
 Default empty output routine. More...
 
static void NoLockRoutine (_In_opt_ void *lock_context)
 Default empty lock and release routine. More...
 

Private Attributes

InitialOutputRoutineinitial_output_routine_
 
FinalOutputRoutinefinal_output_routine_
 
OutputRoutineoutput_routine_
 
LockRoutinelock_enter_routine_
 
LockRoutinelock_leave_routine_
 
void * lock_context_
 
void * output_context_
 
PerfDataEntry data_ [kMaxNumberOfDataEntries]
 

Static Private Attributes

static const ULONG kInvalidDataIndex = MAXULONG
 
static const ULONG kMaxNumberOfDataEntries = 200
 

Detailed Description

Responsible for collecting and saving data supplied by PerfCounter.

Definition at line 113 of file perf_counter.h.

Member Typedef Documentation

◆ FinalOutputRoutine

using PerfCollector::FinalOutputRoutine = void(_In_opt_ void* output_context)

A function type for printing out a footer line of results.

Definition at line 119 of file perf_counter.h.

◆ InitialOutputRoutine

using PerfCollector::InitialOutputRoutine = void(_In_opt_ void* output_context)

A function type for printing out a header line of results.

Definition at line 116 of file perf_counter.h.

◆ LockRoutine

using PerfCollector::LockRoutine = void(_In_opt_ void* lock_context)

A function type for acquiring and releasing a lock.

Definition at line 128 of file perf_counter.h.

◆ OutputRoutine

using PerfCollector::OutputRoutine = void(_In_ const char* location_name, _In_ ULONG64 total_execution_count, _In_ ULONG64 total_elapsed_time, _In_opt_ void* output_context)

A function type for printing out results.

Definition at line 125 of file perf_counter.h.

Member Function Documentation

◆ AddData()

bool PerfCollector::AddData ( _In_ const char *  location_name,
_In_ ULONG64  elapsed_time 
)
inline

Saves performance data taken by PerfCounter.

Definition at line 180 of file perf_counter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPerfDataIndex()

ULONG PerfCollector::GetPerfDataIndex ( _In_ const char *  key)
inlineprivate

Returns an index of data corresponds to the location_name.

Parameters
keyA location to get an index of corresponding data entry
Returns
An index of data or kInvalidDataIndex

It adds a new entry when the key is not found in existing entries. Returns kInvalidDataIndex if a corresponding entry is not found and there is no room to add a new entry.

Definition at line 248 of file perf_counter.h.

Here is the caller graph for this function:

◆ Initialize()

void PerfCollector::Initialize ( _In_ OutputRoutine output_routine,
_In_opt_ InitialOutputRoutine initial_output_routine = NoOutputRoutine,
_In_opt_ FinalOutputRoutine final_output_routine = NoOutputRoutine,
_In_opt_ LockRoutine lock_enter_routine = NoLockRoutine,
_In_opt_ LockRoutine lock_leave_routine = NoLockRoutine,
_In_opt_ void *  lock_context = nullptr,
_In_opt_ void *  output_context = nullptr 
)
inline

Constructor; call this only once before any other code in this module runs.

Parameters
output_routineA function pointer for printing out results
initial_output_routineA function pointer for printing a header line of results
final_output_routineA function pointer for printing a footer line of results
lock_enter_routineA function pointer for acquiring a lock
lock_leave_routineA function pointer for releasing a lock
lock_contextAn arbitrary parameter for lock_enter_routine and lock_leave_routine
output_contextAn arbitrary parameter for output_routine, initial_output_routine and final_output_routine.

Definition at line 142 of file perf_counter.h.

Here is the caller graph for this function:

◆ NoLockRoutine()

static void PerfCollector::NoLockRoutine ( _In_opt_ void *  lock_context)
inlinestaticprivate

Default empty lock and release routine.

Parameters
lock_contextIgnored

Definition at line 237 of file perf_counter.h.

◆ NoOutputRoutine()

static void PerfCollector::NoOutputRoutine ( _In_opt_ void *  output_context)
inlinestaticprivate

Default empty output routine.

Parameters
output_contextIgnored

Definition at line 231 of file perf_counter.h.

◆ Terminate()

void PerfCollector::Terminate ( )
inline

Destructor; prints out accumulated performance results.

Definition at line 161 of file perf_counter.h.

Here is the caller graph for this function:

Member Data Documentation

◆ data_

PerfDataEntry PerfCollector::data_[kMaxNumberOfDataEntries]
private

Definition at line 273 of file perf_counter.h.

◆ final_output_routine_

FinalOutputRoutine* PerfCollector::final_output_routine_
private

Definition at line 267 of file perf_counter.h.

◆ initial_output_routine_

InitialOutputRoutine* PerfCollector::initial_output_routine_
private

Definition at line 266 of file perf_counter.h.

◆ kInvalidDataIndex

const ULONG PerfCollector::kInvalidDataIndex = MAXULONG
staticprivate

Definition at line 194 of file perf_counter.h.

◆ kMaxNumberOfDataEntries

const ULONG PerfCollector::kMaxNumberOfDataEntries = 200
staticprivate

Definition at line 195 of file perf_counter.h.

◆ lock_context_

void* PerfCollector::lock_context_
private

Definition at line 271 of file perf_counter.h.

◆ lock_enter_routine_

LockRoutine* PerfCollector::lock_enter_routine_
private

Definition at line 269 of file perf_counter.h.

◆ lock_leave_routine_

LockRoutine* PerfCollector::lock_leave_routine_
private

Definition at line 270 of file perf_counter.h.

◆ output_context_

void* PerfCollector::output_context_
private

Definition at line 272 of file perf_counter.h.

◆ output_routine_

OutputRoutine* PerfCollector::output_routine_
private

Definition at line 268 of file perf_counter.h.


The documentation for this class was generated from the following file: