Преглед изворни кода

HPCC-16238 Add an indication that jobs are blocked calling an external function

Track starts and stops separately for timed functions - UI can then use this
information to indicate active functions.

Note that this will not actualy solve the issue until thor implements the TIME
attribute.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman пре 8 година
родитељ
комит
ee7a7bb25f
2 измењених фајлова са 11 додато и 8 уклоњено
  1. 8 6
      common/thorhelper/thorstats.cpp
  2. 3 2
      common/thorhelper/thorstats.hpp

+ 8 - 6
common/thorhelper/thorstats.cpp

@@ -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);
 }

+ 3 - 2
common/thorhelper/thorstats.hpp

@@ -38,10 +38,11 @@ public:
     virtual void noteSectionTime(unsigned __int64 startCycles);
 
 protected:
-    ThorSectionTimer(const char * _name, CRuntimeStatistic & _occurences, CRuntimeStatistic & _elapsed);
+    ThorSectionTimer(const char * _name, CRuntimeStatistic & _starts, CRuntimeStatistic & _stops, CRuntimeStatistic & _elapsed);
 
 private:
-    CRuntimeStatistic & occurences;
+    CRuntimeStatistic & starts;
+    CRuntimeStatistic & stops;
     CRuntimeStatistic & elapsed;
     StringAttr name;
 };