Procházet zdrojové kódy

Merge pull request #8374 from ghalliday/issue15123_562

HPCC-15123 Reimplement WorkunitServices.WorkunitTimeStamps

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman před 9 roky
rodič
revize
85ecd7002f

+ 32 - 0
plugins/workunitservices/workunitservices.cpp

@@ -639,6 +639,38 @@ WORKUNITSERVICES_API void wsWorkunitTimeStamps( ICodeContext *ctx, size32_t & __
             }
         }
     }
+    Owned<IConstWorkUnit> wu = getWorkunit(ctx, wuid);
+    if (wu)
+    {
+        Owned<StatisticsFilter> filter = new StatisticsFilter(SCTall, SSTall, SMeasureTimestampUs, StKindAll);
+        filter->setScopeDepth(1, 2);
+        Owned<IConstWUStatisticIterator> stats = &wu->getStatistics(filter);
+        ForEach(*stats)
+        {
+            IConstWUStatistic & cur = stats->query();
+
+            SCMStringBuffer scope;
+            cur.getScope(scope);
+
+            StatisticKind kind = cur.getKind();
+            const char * kindName = queryStatisticName(kind);
+            assertex(kindName && memicmp(kindName, "when", 4) == 0);
+            kindName += 4;
+
+            StringBuffer formattedTime;
+            convertTimestampToStr(cur.getValue(), formattedTime, true);
+
+            SCMStringBuffer creator;
+            cur.getCreator(creator);
+            const char * at = strchr(creator.str(), '@');
+            const char * instance = at ? at + 1 : creator.str();
+
+            fixedAppend(mb, 32, scope.str());
+            fixedAppend(mb, 16, kindName); // id
+            fixedAppend(mb, 20, formattedTime);            // time
+            fixedAppend(mb, 16, instance);
+        }
+    }
     __lenResult = mb.length();
     __result = mb.detach();
 }

+ 1 - 1
thorlcr/master/thmastermain.cpp

@@ -468,7 +468,7 @@ int main( int argc, char *argv[]  )
         Owned<IFile> iFile = createIFile("thor.xml");
         globals = iFile->exists() ? createPTree(*iFile, ipt_caseInsensitive) : createPTree("Thor", ipt_caseInsensitive);
     }
-    setStatisticsComponentName(SCTthor, globals->queryProp("@name"), false);
+    setStatisticsComponentName(SCTthor, globals->queryProp("@name"), true);
 
     globals->setProp("@masterBuildTag", BUILD_TAG);
     char **pp = argv+1;