22 |
|
|
23 |
#ifndef __LS_GIG_PROFILER_H__ |
#ifndef __LS_GIG_PROFILER_H__ |
24 |
#define __LS_GIG_PROFILER_H__ |
#define __LS_GIG_PROFILER_H__ |
25 |
|
|
26 |
#include <stdio.h> |
#include <stdio.h> |
27 |
|
|
28 |
|
#include "../../common/global.h" |
29 |
|
#include "../../common/RTMath.h" |
30 |
|
|
31 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
32 |
|
|
33 |
class Profiler { |
class Profiler { |
40 |
|
|
41 |
static unsigned int GetBogoVoices( unsigned int SamplingFreq ); |
static unsigned int GetBogoVoices( unsigned int SamplingFreq ); |
42 |
|
|
43 |
static unsigned long long Stamp( void ) |
static RTMath::time_stamp_t Stamp( void ) |
44 |
{ |
{ |
45 |
unsigned long long temp; |
return RTMath::CreateTimeStamp(); |
|
__asm__ __volatile__ ("rdtsc" : "=A" (temp)); |
|
|
return temp; |
|
46 |
} |
} |
47 |
|
|
48 |
static void Record( unsigned long long start, |
static void Record( RTMath::time_stamp_t start, |
49 |
unsigned int samples, unsigned int skip ) |
unsigned int samples, unsigned int skip ) |
50 |
{ |
{ |
51 |
unsigned long long stop = Stamp(); |
RTMath::time_stamp_t stop = Stamp(); |
52 |
profilingTime += (stop - start); |
profilingTime += (stop - start); |
53 |
profilingSamples += (samples - skip); |
profilingSamples += (samples - skip); |
54 |
} |
} |
58 |
private: |
private: |
59 |
static unsigned long long profilingSamples; |
static unsigned long long profilingSamples; |
60 |
static unsigned long long profilingTime; |
static unsigned long long profilingTime; |
61 |
static unsigned long long ticksPerSecond; |
static double tsPerSecond; |
62 |
}; |
}; |
63 |
|
|
64 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |