Quellcode durchsuchen

HPCC-15884 Add support for function timings to roxie slave activities

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman vor 9 Jahren
Ursprung
Commit
cf3d4f4528
2 geänderte Dateien mit 19 neuen und 24 gelöschten Zeilen
  1. 16 21
      roxie/ccd/ccdcontext.cpp
  2. 3 3
      system/jlib/jstats.cpp

+ 16 - 21
roxie/ccd/ccdcontext.cpp

@@ -1975,7 +1975,21 @@ public:
     }
     virtual ISectionTimer * registerTimer(unsigned activityId, const char * name)
     {
-        return queryNullSectionTimer();
+        if (activityId && graph)
+        {
+            IRoxieServerActivity *act = graph->queryActivity(activityId);
+            if (act)
+                return act->registerTimer(activityId, name);
+        }
+        CriticalBlock b(contextCrit);
+        ISectionTimer *timer = functionTimers.getValue(name);
+        if (!timer)
+        {
+            timer = ThorSectionTimer::createTimer(globalStats, name);
+            functionTimers.setValue(name, timer);
+            timer->Release(); // Value returned is not linked
+        }
+        return timer;
     }
 
 protected:
@@ -2381,6 +2395,7 @@ public:
     {
         // NOTE: This is needed to ensure that owned activities are destroyed BEFORE I am,
         // to avoid pure virtual calls when they come to call noteProcessed()
+        logctx.mergeStats(globalStats);
         childGraphs.releaseAll();
     }
 
@@ -3550,26 +3565,6 @@ public:
         return NULL; // TBD - Richard, where do user credentials for a roxie query come from
     }
 
-    virtual ISectionTimer * registerTimer(unsigned activityId, const char * name)
-    {
-        if (activityId)
-        {
-            IRoxieServerActivity *act = graph->queryActivity(activityId);
-            if (act)
-                return act->registerTimer(activityId, name);
-        }
-
-        CriticalBlock b(contextCrit);
-        ISectionTimer *timer = functionTimers.getValue(name);
-        if (!timer)
-        {
-            timer = ThorSectionTimer::createTimer(globalStats, name);
-            functionTimers.setValue(name, timer);
-            timer->Release(); // Value returned is not linked
-        }
-        return timer;
-    }
-
     virtual bool isResult(const char * name, unsigned sequence)
     {
         CriticalBlock b(contextCrit);

+ 3 - 3
system/jlib/jstats.cpp

@@ -1696,10 +1696,10 @@ void CNestedRuntimeStatisticCollection::recordStatistics(IStatisticGatherer & ta
 
 StringBuffer & CNestedRuntimeStatisticCollection::toStr(StringBuffer &str) const
 {
-    str.append("{Scope ");
-    scope.getScopeText(str).newline();
+    str.append(' ');
+    scope.getScopeText(str).append("={");
     CRuntimeStatisticCollection::toStr(str);
-    return str.append("}").newline();
+    return str.append(" }");
 }
 
 StringBuffer & CNestedRuntimeStatisticCollection::toXML(StringBuffer &str) const