diff --git a/common/workunit/workunit.cpp b/common/workunit/workunit.cpp index 6546f100e83..83739f34f10 100644 --- a/common/workunit/workunit.cpp +++ b/common/workunit/workunit.cpp @@ -3381,7 +3381,7 @@ void WuScopeFilter::finishedFilter() { sourceFlags &= ~(SSFsearchWorkflow); } - else if (matchOnly(SSTcompilestage)) + else if (matchOnly(SSTstage)) { //compile stages are not stored in the graph sourceFlags &= ~(SSFsearchGraphStats|SSFsearchGraph|SSFsearchWorkflow); @@ -12262,7 +12262,7 @@ extern WORKUNIT_API void submitWorkUnit(const char *wuid, const char *username, { Owned wu = &cw->lock(); - addTimeStamp(wu, SSTcompilestage, "compile", StWhenQueued, 0); + addTimeStamp(wu, SSTstage, "compile", StWhenQueued, 0); } cw.clear(); diff --git a/ecl/eclcc/eclcc.cpp b/ecl/eclcc/eclcc.cpp index 7dfa9fe88d1..413eb086e96 100644 --- a/ecl/eclcc/eclcc.cpp +++ b/ecl/eclcc/eclcc.cpp @@ -1281,7 +1281,7 @@ void EclCC::processSingleQuery(const EclRepositoryManager & localRepositoryManag systemIoStartInfo.setown(new OsDiskStats(true)); if (optCompileBatchOut.isEmpty()) - addTimeStamp(instance.wu, SSTcompilestage, "compile", StWhenStarted); + addTimeStamp(instance.wu, SSTstage, "compile", StWhenStarted); const char * sourcePathname = queryContents ? str(queryContents->querySourcePath()) : NULL; const char * defaultErrorPathname = sourcePathname ? sourcePathname : queryAttributePath; @@ -1410,7 +1410,7 @@ void EclCC::processSingleQuery(const EclRepositoryManager & localRepositoryManag if (exportDependencies || optMetaLocation) parseCtx.nestedDependTree.setown(createPTree("Dependencies", ipt_fast)); - addTimeStamp(instance.wu, SSTcompilestage, "compile:parse", StWhenStarted); + addTimeStamp(instance.wu, SSTstage, "compile:>parse", StWhenStarted); try { HqlLookupContext ctx(parseCtx, &errorProcessor, instance.dataServer); @@ -1463,11 +1463,14 @@ void EclCC::processSingleQuery(const EclRepositoryManager & localRepositoryManag unsigned __int64 parseTimeNs = cycle_to_nanosec(get_cycles_now() - startCycles); instance.stats.parseTime = (unsigned)nanoToMilli(parseTimeNs); - updateWorkunitStat(instance.wu, SSTcompilestage, "compile:parse", StTimeElapsed, NULL, parseTimeNs); + updateWorkunitStat(instance.wu, SSTstage, "compile:>parse", StTimeElapsed, NULL, parseTimeNs); + stat_type sourceDownloadTime = localRepositoryManager.getStatistic(StTimeElapsed); + if (sourceDownloadTime) + updateWorkunitStat(instance.wu, SSTstage, "compile:>parse:>download", StTimeElapsed, NULL, sourceDownloadTime); if (optExtraStats) { - updateWorkunitStat(instance.wu, SSTcompilestage, "compile:cache", StNumAttribsProcessed, NULL, parseCtx.numAttribsProcessed); + updateWorkunitStat(instance.wu, SSTstage, "compile:cache", StNumAttribsProcessed, NULL, parseCtx.numAttribsProcessed); } if (exportDependencies) @@ -1574,33 +1577,33 @@ void EclCC::processSingleQuery(const EclRepositoryManager & localRepositoryManag instance.stats.generateTime = (unsigned)nanoToMilli(totalTimeNs) - instance.stats.parseTime; const char *scopeName = optCompileBatchOut.isEmpty() ? "compile" : "compile:generate"; if (optCompileBatchOut.isEmpty()) - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StTimeElapsed, NULL, totalTimeNs); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StTimeElapsed, NULL, totalTimeNs); const cost_type cost = money2cost_type(calcCost(getMachineCostRate(), nanoToMilli(totalTimeNs))); if (cost) - instance.wu->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, scopeName, StCostCompile, NULL, cost, 1, 0, StatsMergeReplace); + instance.wu->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, scopeName, StCostCompile, NULL, cost, 1, 0, StatsMergeReplace); if (systemFinishTime.getTotal()) { SystemProcessInfo systemElapsed = systemFinishTime - systemStartTime; SystemProcessInfo processElapsed = processFinishTime - processStartTime; - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StNumSysContextSwitches, NULL, systemElapsed.getNumContextSwitches()); - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StTimeOsUser, NULL, systemElapsed.getUserNs()); - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StTimeOsSystem, NULL, systemElapsed.getSystemNs()); - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StTimeOsTotal, NULL, systemElapsed.getTotalNs()); - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StTimeUser, NULL, processElapsed.getUserNs()); - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StTimeSystem, NULL, processElapsed.getSystemNs()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StNumSysContextSwitches, NULL, systemElapsed.getNumContextSwitches()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StTimeOsUser, NULL, systemElapsed.getUserNs()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StTimeOsSystem, NULL, systemElapsed.getSystemNs()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StTimeOsTotal, NULL, systemElapsed.getTotalNs()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StTimeUser, NULL, processElapsed.getUserNs()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StTimeSystem, NULL, processElapsed.getSystemNs()); if (processFinishTime.getPeakResidentMemory()) - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StSizePeakMemory, NULL, processFinishTime.getPeakResidentMemory()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StSizePeakMemory, NULL, processFinishTime.getPeakResidentMemory()); } if (optGatherDiskStats) { const BlockIoStats summaryIo = systemIoFinishInfo->querySummaryStats() - systemIoStartInfo->querySummaryStats(); if (summaryIo.rd_sectors) - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StSizeOsDiskRead, NULL, summaryIo.rd_sectors * summaryIo.getSectorSize()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StSizeOsDiskRead, NULL, summaryIo.rd_sectors * summaryIo.getSectorSize()); if (summaryIo.wr_sectors) - updateWorkunitStat(instance.wu, SSTcompilestage, scopeName, StSizeOsDiskWrite, NULL, summaryIo.wr_sectors * summaryIo.getSectorSize()); + updateWorkunitStat(instance.wu, SSTstage, scopeName, StSizeOsDiskWrite, NULL, summaryIo.wr_sectors * summaryIo.getSectorSize()); } } diff --git a/ecl/eclccserver/eclccserver.cpp b/ecl/eclccserver/eclccserver.cpp index a5a308ceeb1..8f1d0c58d1f 100644 --- a/ecl/eclccserver/eclccserver.cpp +++ b/ecl/eclccserver/eclccserver.cpp @@ -408,7 +408,7 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter, filename.set("link"); scope.append("compile:compile c++:").append(filename); - workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, scope, StTimeElapsed, NULL, compileTimer.elapsedNs(), 1, 0, StatsMergeReplace); + workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, scope, StTimeElapsed, NULL, compileTimer.elapsedNs(), 1, 0, StatsMergeReplace); } return ret; @@ -682,7 +682,7 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter, bool compileCppSeparately = config->getPropBool("@compileCppSeparately", true); if (compileCppSeparately) { - workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, "compile", StWhenStarted, NULL, getTimeStampNowValue(), 1, 0, StatsMergeAppend); + workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, "compile", StWhenStarted, NULL, getTimeStampNowValue(), 1, 0, StatsMergeAppend); eclccCmd.appendf(" -Sx %s.cc", wuid); } if (workunit->getResultLimit()) @@ -716,15 +716,15 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter, if (retcode == 0 && compileCppSeparately) { cycle_t startCompileCpp = get_cycles_now(); - workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, "compile:compile c++", StWhenStarted, NULL, getTimeStampNowValue(), 1, 0, StatsMergeAppend); + workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, "compile:compile c++", StWhenStarted, NULL, getTimeStampNowValue(), 1, 0, StatsMergeAppend); retcode = doCompileCpp(abortWaiter, wuid, workunit->getDebugValueInt("maxCompileThreads", defaultMaxCompileThreads)); unsigned __int64 elapsed_compilecpp = cycle_to_nanosec(get_cycles_now() - startCompileCpp); - workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, "compile:compile c++", StTimeElapsed, NULL, elapsed_compilecpp, 1, 0, StatsMergeReplace); + workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, "compile:compile c++", StTimeElapsed, NULL, elapsed_compilecpp, 1, 0, StatsMergeReplace); } if (compileCppSeparately) { unsigned __int64 elapsed_compile = cycle_to_nanosec(get_cycles_now() - startCompile); - workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, "compile", StTimeElapsed, NULL, elapsed_compile, 1, 0, StatsMergeReplace); + workunit->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, "compile", StTimeElapsed, NULL, elapsed_compile, 1, 0, StatsMergeReplace); } bool processKilled = (retcode >= 128); //If the process is killed it is probably because it ran out of memory - so try to compile as a K8s job @@ -851,8 +851,8 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter, Owned factory = getWorkUnitFactory(); Owned wu = factory->updateWorkUnit(wuid.get()); if (noteDequeued) - addTimeStamp(wu, SSTcompilestage, "compile", StWhenDequeued, 0); - addTimeStamp(wu, SSTcompilestage, "compile", StWhenK8sLaunched, 0); + addTimeStamp(wu, SSTstage, "compile", StWhenDequeued, 0); + addTimeStamp(wu, SSTstage, "compile", StWhenK8sLaunched, 0); } runK8sJob("compile", wuid, wuid); } @@ -917,12 +917,12 @@ class EclccCompileThread : implements IPooledThread, implements IErrorReporter, if (isContainerized()) { if (config->getPropBool("@k8sJob")) - addTimeStamp(workunit, SSTcompilestage, "compile", StWhenK8sStarted, 0); + addTimeStamp(workunit, SSTstage, "compile", StWhenK8sStarted, 0); else - addTimeStamp(workunit, SSTcompilestage, "compile", StWhenDequeued, 0); + addTimeStamp(workunit, SSTstage, "compile", StWhenDequeued, 0); } else - addTimeStamp(workunit, SSTcompilestage, "compile", StWhenDequeued, 0); + addTimeStamp(workunit, SSTstage, "compile", StWhenDequeued, 0); CSDSServerStatus serverstatus("ECLCCserverThread"); serverstatus.queryProperties()->setProp("@cluster", config->queryProp("@name")); diff --git a/ecl/hql/hqlexpr.cpp b/ecl/hql/hqlexpr.cpp index 57529bce0ae..7d736176355 100644 --- a/ecl/hql/hqlexpr.cpp +++ b/ecl/hql/hqlexpr.cpp @@ -1464,9 +1464,9 @@ void HqlLookupContext::reportTiming(const char * name) __uint64 localTime = cycle_to_nanosec(elapsedCycles - childCycles); StringBuffer scope; - scope.append("compiler::parse::").append(name); - parseCtx.statsTarget.addStatistic(SSTcompilestage, scope, StTimeTotalExecute, nullptr, totalTime, 1, 0, StatsMergeSum); - parseCtx.statsTarget.addStatistic(SSTcompilestage, scope, StTimeLocalExecute, nullptr, localTime, 1, 0, StatsMergeSum); + scope.append("compile:>parse:>").append(name); + parseCtx.statsTarget.addStatistic(SSTstage, scope, StTimeTotalExecute, nullptr, totalTime, 1, 0, StatsMergeSum); + parseCtx.statsTarget.addStatistic(SSTstage, scope, StTimeLocalExecute, nullptr, localTime, 1, 0, StatsMergeSum); childCycles = 0; } diff --git a/ecl/hql/hqlrepository.cpp b/ecl/hql/hqlrepository.cpp index 664c550bc96..5a118205ede 100644 --- a/ecl/hql/hqlrepository.cpp +++ b/ecl/hql/hqlrepository.cpp @@ -639,6 +639,16 @@ void EclRepositoryManager::gatherPackagesUsed(StringArray & used) const } } +unsigned __int64 EclRepositoryManager::getStatistic(StatisticKind kind) const +{ + switch (kind) + { + case StTimeElapsed: + return cycle_to_nanosec(gitDownloadCycles); + } + return 0; +} + void EclRepositoryManager::processArchive(IPropertyTree * archiveTree) { IArrayOf savedSources; // also includes -D options @@ -793,6 +803,7 @@ IEclSourceCollection * EclRepositoryManager::resolveGitCollection(const char * r } bool ok = false; + CCycleTimer gitDownloadTimer; if (alreadyExists) { if (options.updateRepos) @@ -819,6 +830,7 @@ IEclSourceCollection * EclRepositoryManager::resolveGitCollection(const char * r ok = true; } } + gitDownloadCycles += gitDownloadTimer.elapsedCycles(); if (!ok) throw makeStringExceptionV(99, "Cannot locate the source code for dependency '%s'. --fetchrepos not enabled", defaultUrl); diff --git a/ecl/hql/hqlrepository.hpp b/ecl/hql/hqlrepository.hpp index bca8a4daa2c..89c849332d0 100644 --- a/ecl/hql/hqlrepository.hpp +++ b/ecl/hql/hqlrepository.hpp @@ -53,6 +53,7 @@ class HQL_API EclRepositoryManager void gatherPackagesUsed(StringArray & used) const; void inherit(const EclRepositoryManager & other); void kill(); + unsigned __int64 getStatistic(StatisticKind kind) const; void processArchive(IPropertyTree * archiveTree); IEclPackage * queryDependentRepository(IIdAtom * name, const char * defaultUrl, IEclSourceCollection * overrideSources); @@ -86,6 +87,7 @@ class HQL_API EclRepositoryManager std::vector dependencies; IArrayOf sharedSources; // plugins, std library, bundles IArrayOf allSources; // also includes -D options + cycle_t gitDownloadCycles = 0; //Include all options in a nested struct to make it easy to ensure they are cloned struct { diff --git a/ecl/hql/hqltrans.cpp b/ecl/hql/hqltrans.cpp index 622b6f668c8..eb3b48b2eca 100644 --- a/ecl/hql/hqltrans.cpp +++ b/ecl/hql/hqltrans.cpp @@ -166,18 +166,18 @@ void HqlTransformStats::add(const HqlTransformStats & other) void HqlTransformStats::gatherTransformStats(IStatisticTarget & target, const char * scope) const { #ifdef TRANSFORM_STATS_TIME - target.addStatistic(SSTcompilestage, scope, StTimeTotalExecute, nullptr, cycle_to_nanosec(totalTime), 1, 0, StatsMergeSum); - target.addStatistic(SSTcompilestage, scope, StTimeLocalExecute, nullptr, cycle_to_nanosec(totalTime-(childTime-recursiveTime)), 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StTimeTotalExecute, nullptr, cycle_to_nanosec(totalTime), 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StTimeLocalExecute, nullptr, cycle_to_nanosec(totalTime-(childTime-recursiveTime)), 1, 0, StatsMergeSum); #endif #ifdef TRANSFORM_STATS_DETAILS if (numAnalyseCalls) - target.addStatistic(SSTcompilestage, scope, StNumAnalyseExprs, nullptr, numAnalyseCalls, 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StNumAnalyseExprs, nullptr, numAnalyseCalls, 1, 0, StatsMergeSum); if (numAnalyse) - target.addStatistic(SSTcompilestage, scope, StNumUniqueAnalyseExprs, nullptr, numAnalyse, 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StNumUniqueAnalyseExprs, nullptr, numAnalyse, 1, 0, StatsMergeSum); if (numTransformCalls) - target.addStatistic(SSTcompilestage, scope, StNumTransformExprs, nullptr, numTransformCalls, 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StNumTransformExprs, nullptr, numTransformCalls, 1, 0, StatsMergeSum); if (numTransforms) - target.addStatistic(SSTcompilestage, scope, StNumUniqueTransformExprs, nullptr, numTransforms, 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StNumUniqueTransformExprs, nullptr, numTransforms, 1, 0, StatsMergeSum); #endif } @@ -248,7 +248,7 @@ void HqlTransformerInfo::gatherTransformStats(IStatisticTarget & target) const { StringBuffer scope; scope.append("compile:transform:").append(name); - target.addStatistic(SSTcompilestage, scope, StNumStarts, nullptr, numInstances, 1, 0, StatsMergeSum); + target.addStatistic(SSTstage, scope, StNumStarts, nullptr, numInstances, 1, 0, StatsMergeSum); stats.gatherTransformStats(target, scope); } #endif diff --git a/ecl/hqlcpp/hqlecl.cpp b/ecl/hqlcpp/hqlecl.cpp index 2cd7471b0de..7cfad5ebe30 100644 --- a/ecl/hqlcpp/hqlecl.cpp +++ b/ecl/hqlcpp/hqlecl.cpp @@ -512,7 +512,7 @@ bool HqlDllGenerator::generateCode(HqlQueryContext & query) noOutput = true; { // ensure warnings/errors are available before we do the processing... - addTimeStamp(wu, SSTcompilestage, "compile:generate", StWhenStarted); + addTimeStamp(wu, SSTstage, "compile:generate", StWhenStarted); wu->commit(); cycle_t startCycles = get_cycles_now(); @@ -583,13 +583,13 @@ bool HqlDllGenerator::generateCode(HqlQueryContext & query) doExpand(translator); unsigned __int64 elapsed = cycle_to_nanosec(get_cycles_now() - startCycles); - updateWorkunitStat(wu, SSTcompilestage, "compile:generate", StTimeElapsed, NULL, elapsed); + updateWorkunitStat(wu, SSTstage, "compile:generate", StTimeElapsed, NULL, elapsed); if (wu->getDebugValueBool("addMemoryToWorkunit", true)) { ProcessInfo info(ReadMemoryInfo); if (info.getPeakResidentMemory()) - wu->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTcompilestage, "compile", StSizePeakMemory, NULL, info.getPeakResidentMemory(), 1, 0, StatsMergeReplace); + wu->setStatistic(queryStatisticsComponentType(), queryStatisticsComponentName(), SSTstage, "compile", StSizePeakMemory, NULL, info.getPeakResidentMemory(), 1, 0, StatsMergeReplace); } @@ -633,7 +633,7 @@ void HqlDllGenerator::insertStandAloneCode() void HqlDllGenerator::doExpand(HqlCppTranslator & translator) { CCycleTimer elapsedTimer; - addTimeStamp(wu, SSTcompilestage, "compile:generate:write c++", StWhenStarted); + addTimeStamp(wu, SSTstage, "compile:generate:write c++", StWhenStarted); bool isMultiFile = translator.spanMultipleCppFiles(); CompilerType targetCompiler = translator.queryOptions().targetCompiler; @@ -655,7 +655,7 @@ void HqlDllGenerator::doExpand(HqlCppTranslator & translator) } } - updateWorkunitStat(wu, SSTcompilestage, "compile:generate:write c++", StTimeElapsed, NULL, elapsedTimer.elapsedNs()); + updateWorkunitStat(wu, SSTstage, "compile:generate:write c++", StTimeElapsed, NULL, elapsedTimer.elapsedNs()); } bool HqlDllGenerator::abortRequested() @@ -666,7 +666,7 @@ bool HqlDllGenerator::abortRequested() bool HqlDllGenerator::doCompile(ICppCompiler * compiler) { cycle_t startCycles = get_cycles_now(); - addTimeStamp(wu, SSTcompilestage, "compile:compile c++", StWhenStarted); + addTimeStamp(wu, SSTstage, "compile:compile c++", StWhenStarted); ForEachItemIn(i, sourceFiles) compiler->addSourceFile(sourceFiles.item(i), sourceFlags.item(i)); @@ -735,7 +735,7 @@ bool HqlDllGenerator::doCompile(ICppCompiler * compiler) } unsigned __int64 elapsed = cycle_to_nanosec(get_cycles_now() - startCycles); - updateWorkunitStat(wu, SSTcompilestage, "compile:compile c++", StTimeElapsed, NULL, elapsed); + updateWorkunitStat(wu, SSTstage, "compile:compile c++", StTimeElapsed, NULL, elapsed); } //Keep the files if there was a compile error. if (ok && deleteGenerated) diff --git a/ecl/hqlcpp/hqlhtcpp.cpp b/ecl/hqlcpp/hqlhtcpp.cpp index a2ecb79eda0..ec36c7f4d97 100644 --- a/ecl/hqlcpp/hqlhtcpp.cpp +++ b/ecl/hqlcpp/hqlhtcpp.cpp @@ -6237,7 +6237,7 @@ bool HqlCppTranslator::buildCpp(IHqlCppInstance & _code, HqlQueryContext & query void HqlCppTranslator::ensureWorkUnitUpdated() { if (timeReporter) - updateWorkunitTimings(wu(), SSTcompilestage, StTimeTotalExecute, timeReporter); + updateWorkunitTimings(wu(), SSTstage, StTimeTotalExecute, timeReporter); } double HqlCppTranslator::getComplexity(IHqlExpression * expr, ClusterType cluster) diff --git a/ecllibrary/std/system/Debug.ecl b/ecllibrary/std/system/Debug.ecl index 663cbe5954c..a7f8adbea51 100644 --- a/ecllibrary/std/system/Debug.ecl +++ b/ecllibrary/std/system/Debug.ecl @@ -6,7 +6,7 @@ rtl := SERVICE unsigned4 msTick() : eclrtl,library='eclrtl',entrypoint='rtlTick'; - unsigned4 sleep(unsigned4 _delay) : eclrtl,action,library='eclrtl',entrypoint='rtlSleep'; + unsigned4 sleep(unsigned4 _delay) : eclrtl,action,library='eclrtl',entrypoint='rtlSleep',time; printStackReport(integer startIP) : cpp,action,library='jlib'; END; diff --git a/esp/src/src-react/util/metricGraph.ts b/esp/src/src-react/util/metricGraph.ts index fb6bbae9cc6..ee40db3c5ee 100644 --- a/esp/src/src-react/util/metricGraph.ts +++ b/esp/src/src-react/util/metricGraph.ts @@ -203,7 +203,10 @@ export class MetricGraph extends Graph2 { } vertexLabel(v: IScope, options: MetricsOptions): string { - return v.type === "activity" ? format(options.activityTpl, v) : v.Label || v.id; + return v.type === "activity" ? format(options.activityTpl, v) : + v.type === "function" ? v.id + "()" : + v.type === "stage" && v.id.charAt(0) === '>' ? v.id.substring(1) : + v.Label || v.id; } vertexStatus(v: IScope): ScopeStatus { diff --git a/system/jlib/jstatcodes.h b/system/jlib/jstatcodes.h index 3894ebe214a..dfa1392065c 100644 --- a/system/jlib/jstatcodes.h +++ b/system/jlib/jstatcodes.h @@ -28,6 +28,8 @@ #define ChildGraphScopePrefix "c" #define FileScopePrefix "p" #define ChannelScopePrefix "x" +#define SectionScopePrefix "n" +#define StageScopePrefix ">" #define MATCHES_CONST_PREFIX(search, prefix) (strncmp(search, prefix, strlen(prefix)) == 0) @@ -65,7 +67,7 @@ enum StatisticScopeType SSTactivity, SSTallocator, // identifies an allocator SSTsection, // A section within the query - not a great differentiator - SSTcompilestage, // a stage within the compilation process + SSTstage, // a stage within the compilation process SSTdfuworkunit, // a reference to an executing dfu workunit SSTedge, SSTfunction, // a function call diff --git a/system/jlib/jstats.cpp b/system/jlib/jstats.cpp index 486c3cf8dea..5df1396a3b1 100644 --- a/system/jlib/jstats.cpp +++ b/system/jlib/jstats.cpp @@ -72,7 +72,7 @@ void setStatisticsComponentName(StatisticCreatorType processType, const char * p // Textual forms of the different enumerations, first items are for none and all. static constexpr const char * const measureNames[] = { "", "all", "ns", "ts", "cnt", "sz", "cpu", "skw", "node", "ppm", "ip", "cy", "en", "txt", "bool", "id", "fname", "cost", NULL }; static constexpr const char * const creatorTypeNames[]= { "", "all", "unknown", "hthor", "roxie", "roxie:s", "thor", "thor:m", "thor:s", "eclcc", "esp", "summary", NULL }; -static constexpr const char * const scopeTypeNames[] = { "", "all", "global", "graph", "subgraph", "activity", "allocator", "section", "compile", "dfu", "edge", "function", "workflow", "child", "file", "channel", "unknown", nullptr }; +static constexpr const char * const scopeTypeNames[] = { "", "all", "global", "graph", "subgraph", "activity", "allocator", "section", "stage", "dfu", "edge", "function", "workflow", "child", "file", "channel", "unknown", nullptr }; static unsigned matchString(const char * const * names, const char * search, unsigned dft) { @@ -106,7 +106,7 @@ static const StatisticScopeType scoreOrder[] = { SSTsubgraph, SSTallocator, SSTsection, - SSTcompilestage, + SSTstage, SSTdfuworkunit, SSTfunction, SSTworkflow, @@ -554,7 +554,7 @@ StatisticScopeType getScopeType(const char * scope) if (nullptr == scope) id.setId(SSTglobal, 0); else if (startsWith(scope, "compile")) - id.setId(SSTcompilestage, 0); + id.setId(SSTstage, 0); else { const char * colon = strchr(scope, ':'); @@ -1419,6 +1419,10 @@ StringBuffer & StatsScopeId::getScopeText(StringBuffer & out) const return out.append(FileScopePrefix).append(name); case SSTchannel: return out.append(ChannelScopePrefix).append(id); + case SSTsection: + return out.append(SectionScopePrefix).append(name); + case SSTstage: + return out.append(StageScopePrefix).append(name); case SSTunknown: return out.append(name); default: @@ -1655,6 +1659,11 @@ bool StatsScopeId::setScopeText(const char * text, const char * * _next) setChildGraphId(strtoul(text+ strlen(ChildGraphScopePrefix), next, 10)); return true; } + if (MATCHES_CONST_PREFIX(text, "compile")) + { + setStageId("compile"); + return true; + } break; case ChannelScopePrefix[0]: if (MATCHES_CONST_PREFIX(text, ChannelScopePrefix) && isdigit(text[strlen(ChannelScopePrefix)])) @@ -1663,6 +1672,24 @@ bool StatsScopeId::setScopeText(const char * text, const char * * _next) return true; } break; + case SectionScopePrefix[0]: + if (MATCHES_CONST_PREFIX(text, SectionScopePrefix)) + { + setSectionId(text+strlen(SectionScopePrefix)); + if (_next) + *_next = text + strlen(text); + return true; + } + break; + case StageScopePrefix[0]: + if (MATCHES_CONST_PREFIX(text, StageScopePrefix)) + { + setStageId(text+strlen(StageScopePrefix)); + if (_next) + *_next = text + strlen(text); + return true; + } + break; case '\0': setId(SSTglobal, 0); return true; @@ -1728,6 +1755,16 @@ void StatsScopeId::setChildGraphId(unsigned _id) { setId(SSTchildgraph, _id); } +void StatsScopeId::setSectionId(const char * _name) +{ + scopeType = SSTsection; + name.set(_name); +} +void StatsScopeId::setStageId(const char * _name) +{ + scopeType = SSTstage; + name.set(_name); +} //-------------------------------------------------------------------------------------------------------------------- diff --git a/system/jlib/jstats.h b/system/jlib/jstats.h index 3c28aff2936..2b4d5cba491 100644 --- a/system/jlib/jstats.h +++ b/system/jlib/jstats.h @@ -87,6 +87,8 @@ class jlib_decl StatsScopeId void setSubgraphId(unsigned _id); void setWorkflowId(unsigned _id); void setChildGraphId(unsigned _id); + void setSectionId(const char * _name); + void setStageId(const char * _name); int compare(const StatsScopeId & other) const;