foobar2000 SDK  2015-01-14
Public Member Functions | Private Attributes
pfc::profiler_static

#include <timers.h>

Public Member Functions

 profiler_static (const char *p_name)
 
 ~profiler_static ()
 
void add_time (t_int64 delta)
 

Private Attributes

const char * name
 
t_uint64 num_called
 
t_uint64 total_time
 

Detailed Description

Definition at line 8 of file timers.h.

Constructor & Destructor Documentation

pfc::profiler_static::profiler_static ( const char *  p_name)

Definition at line 7 of file timers.cpp.

8 {
9  name = p_name;
10  total_time = 0;
11  num_called = 0;
12 }
const char * name
Definition: timers.h:14
t_uint64 total_time
Definition: timers.h:15
t_uint64 num_called
Definition: timers.h:15
pfc::profiler_static::~profiler_static ( )

Definition at line 14 of file timers.cpp.

15 {
16  try {
18  message << "profiler: " << pfc::format_pad_left<pfc::string_fixed_t<127> >(48,' ',name) << " - " <<
20 
21  if (num_called > 0) {
22  message << " (executed " << num_called << " times, " << (total_time / num_called) << " average)";
23  }
24  message << "\n";
25  OutputDebugStringA(message);
26  } catch(...) {
27  //should never happen
28  OutputDebugString(_T("unexpected profiler failure\n"));
29  }
30 }
const char * name
Definition: timers.h:14
t_uint64 total_time
Definition: timers.h:15
t_uint64 num_called
Definition: timers.h:15

Member Function Documentation

void pfc::profiler_static::add_time ( t_int64  delta)
inline

Definition at line 12 of file timers.h.

12 {total_time+=delta;num_called++;}
t_uint64 total_time
Definition: timers.h:15
t_uint64 num_called
Definition: timers.h:15

Field Documentation

const char* pfc::profiler_static::name
private

Definition at line 14 of file timers.h.

t_uint64 pfc::profiler_static::num_called
private

Definition at line 15 of file timers.h.

t_uint64 pfc::profiler_static::total_time
private

Definition at line 15 of file timers.h.


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