Przeglądaj źródła

Merge pull request #14100 from wangkx/h24573

HPCC-24573 Modify getTotalThorTime for WUs

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 4 lat temu
rodzic
commit
e579ce37f4

+ 7 - 1
common/workunit/workunit.cpp

@@ -6992,7 +6992,13 @@ unsigned CLocalWorkUnit::getDebugAgentListenerPort() const
 unsigned CLocalWorkUnit::getTotalThorTime() const
 {
     CriticalBlock block(crit);
-    return (unsigned)nanoToMilli(extractTimeCollatable(p->queryProp("@totalThorTime"), false));
+    if (p->hasProp("@totalThorTime"))
+        return (unsigned)nanoToMilli(extractTimeCollatable(p->queryProp("@totalThorTime"), false));
+
+    const WuScopeFilter filter("stype[graph],nested[0],stat[TimeElapsed]");
+    StatsAggregation summary;
+    aggregateStatistic(summary, (IConstWorkUnit *)this, filter, StTimeElapsed);
+    return (unsigned)nanoToMilli(summary.getSum());
 }
 
 void CLocalWorkUnit::setDebugAgentListenerPort(unsigned port)

+ 1 - 9
esp/services/ws_workunits/ws_workunitsHelpers.cpp

@@ -955,14 +955,6 @@ void WsWuInfo::getEventScheduleFlag(IEspECLWorkunit &info)
     }
 }
 
-unsigned WsWuInfo::getTotalThorTime()
-{
-    const WuScopeFilter filter("stype[graph],nested[0],stat[TimeElapsed]");
-    StatsAggregation summary;
-    aggregateStatistic(summary, cw, filter, StTimeElapsed);
-    return nanoToMilli(summary.getSum());
-}
-
 void WsWuInfo::getCommon(IEspECLWorkunit &info, unsigned long flags)
 {
     info.setWuid(cw->queryWuid());
@@ -994,7 +986,7 @@ void WsWuInfo::getCommon(IEspECLWorkunit &info, unsigned long flags)
     //After version 1.73, it should be returned only if IncludeTotalClusterTime is true.
     if ((version > 1.27) && ((version < 1.73) || (flags & WUINFO_IncludeTotalClusterTime)))
     {
-        unsigned totalThorTimeMS = getTotalThorTime();
+        unsigned totalThorTimeMS = cw->getTotalThorTime();
         if (totalThorTimeMS)
         {
             StringBuffer totalThorTimeStr;

+ 0 - 1
esp/services/ws_workunits/ws_workunitsHelpers.hpp

@@ -231,7 +231,6 @@ public:
 
     void addTimerToList(SCMStringBuffer& name, const char * scope, IConstWUStatistic & stat, IArrayOf<IEspECLTimer>& timers);
 protected:
-    unsigned getTotalThorTime();
     bool hasSubGraphTimings();
 
 public: