|
@@ -22,10 +22,10 @@
|
|
|
|
|
|
|
|
|
//Cycles are accumulated locally, time is updated once it is serialized or persisted
|
|
|
-const StatisticsMapping nestedSectionStatistics(StCycleLocalExecuteCycles, StTimeLocalExecute, StNumExecutions, StKindNone);
|
|
|
+const StatisticsMapping nestedSectionStatistics(StCycleLocalExecuteCycles, StTimeLocalExecute, StNumStarted, StNumStopped, StKindNone);
|
|
|
|
|
|
-ThorSectionTimer::ThorSectionTimer(const char * _name, CRuntimeStatistic & _occurences, CRuntimeStatistic & _elapsed)
|
|
|
-: occurences(_occurences), elapsed(_elapsed), name(_name)
|
|
|
+ThorSectionTimer::ThorSectionTimer(const char * _name, CRuntimeStatistic & _starts, CRuntimeStatistic & _stops, CRuntimeStatistic & _elapsed)
|
|
|
+: starts(_starts), stops(_stops), elapsed(_elapsed), name(_name)
|
|
|
{
|
|
|
}
|
|
|
|
|
@@ -33,13 +33,15 @@ ThorSectionTimer * ThorSectionTimer::createTimer(CRuntimeStatisticCollection & s
|
|
|
{
|
|
|
StatsScopeId scope(SSTfunction, name);
|
|
|
CRuntimeStatisticCollection & nested = stats.registerNested(scope, nestedSectionStatistics);
|
|
|
- CRuntimeStatistic & occurences = nested.queryStatistic(StNumExecutions);
|
|
|
+ CRuntimeStatistic & starts = nested.queryStatistic(StNumStarted);
|
|
|
+ CRuntimeStatistic & stops = nested.queryStatistic(StNumStopped);
|
|
|
CRuntimeStatistic & elapsed = nested.queryStatistic(StCycleLocalExecuteCycles);
|
|
|
- return new ThorSectionTimer(name, occurences, elapsed);
|
|
|
+ return new ThorSectionTimer(name, starts, stops, elapsed);
|
|
|
}
|
|
|
|
|
|
unsigned __int64 ThorSectionTimer::getStartCycles()
|
|
|
{
|
|
|
+ starts.addAtomic(1);
|
|
|
return get_cycles_now();
|
|
|
}
|
|
|
|
|
@@ -47,5 +49,5 @@ void ThorSectionTimer::noteSectionTime(unsigned __int64 startCycles)
|
|
|
{
|
|
|
cycle_t delay = get_cycles_now() - startCycles;
|
|
|
elapsed.addAtomic(delay);
|
|
|
- occurences.addAtomic(1);
|
|
|
+ stops.addAtomic(1);
|
|
|
}
|