#include <camprofile.h>
Inheritance diagram for CamProfiler:
Public Member Functions | |
CamProfiler () | |
Default constructor. | |
void | Reset () |
Resets counters to current. | |
double | Read (double Results[CAMPROFILE_NONE]) |
Reads counters. | |
Private Attributes | |
UINT64 | OilTimeArray [CAMPROFILE_NONE] |
UINT64 | FirstOilTime |
To use: CamProfiler myProfile;
... do some stuff ...
double results[CAMPROFILE_NONE] myProfile->Read(results); // Read results in microseconds
All this class actually does is store the values of CamProfile::OilTimeArray array when it's created, Read() then performs a subtraction to give the elapsed time in each element.
Definition at line 224 of file camprofile.h.
|
Default constructor.
Definition at line 685 of file camprofile.cpp. 00686 { 00687 Reset(); 00688 }
|
|
Reads counters.
The results in the array should add up to the total returned, but may not if profiling has been turned off in the mean time. Definition at line 734 of file camprofile.cpp. 00735 { 00736 CamProfileMode Mode; 00737 CamProfile::UpdateOilTimes(); 00738 00739 #if WIN32 00740 // This windows code completely untested by Alex 00741 const double factor = 1.0/10000000.0; // Windows uses 100 nanosecond timeslices apparently 00742 #else 00743 const double factor = 1.0/1000000.0; // UNIX counts in microseconds 00744 #endif 00745 00746 INT64 check = 0; 00747 00748 for (Mode = (CamProfileMode)0 ; Mode < CAMPROFILE_NONE ; Mode=(CamProfileMode)((INT32)Mode+1)) 00749 { 00750 // Cast via INT64 to cope with wrap event (ha ha ha). 00751 if (Results) 00752 Results[Mode] = factor * (double)((INT64)(CamProfile::OilTimeArray[Mode] - OilTimeArray[Mode])); 00753 TRACE(_T("CAMPROFILER type %d=%lld\n"),(INT32)Mode,CamProfile::OilTimeArray[Mode] - OilTimeArray[Mode]); 00754 check+=CamProfile::OilTimeArray[Mode] - OilTimeArray[Mode]; 00755 } 00756 00757 INT64 total = (INT64)(CamProfile::LastOilTime - FirstOilTime); 00758 TRACE(_T("CAMPROFILER check=%lld, total=%lld\n"),check,total); 00759 00760 return factor * (double)(total); 00761 }
|
|
Resets counters to current.
Definition at line 706 of file camprofile.cpp. 00707 { 00708 CamProfile::UpdateOilTimes(); 00709 memcpy(OilTimeArray, CamProfile::OilTimeArray, sizeof(OilTimeArray)); 00710 FirstOilTime = CamProfile::LastOilTime; 00711 }
|
|
Definition at line 236 of file camprofile.h. |
|
Definition at line 235 of file camprofile.h. |