From f6c5723ee80322b8087500fcdff10e1dc278b9c3 Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Tue, 19 Sep 2023 12:20:03 +0100 Subject: [PATCH] HPCC-30308 Remove unnecessary atomics cacheAdds and cacheHits Signed-off-by: Gavin Halliday --- roxie/ccd/ccdsnmp.cpp | 2 -- system/jhtree/jhtree.cpp | 7 ------- thorlcr/graph/thgraphslave.cpp | 4 +++- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/roxie/ccd/ccdsnmp.cpp b/roxie/ccd/ccdsnmp.cpp index 9b670be5afa..ba6fc6c9dd3 100644 --- a/roxie/ccd/ccdsnmp.cpp +++ b/roxie/ccd/ccdsnmp.cpp @@ -296,8 +296,6 @@ CRoxieMetricsManager::CRoxieMetricsManager() addMetric(restarts, 0); addMetric(nodesLoaded, 1000); - addMetric(cacheHits, 1000); - addMetric(cacheAdds, 1000); addMetric(blobCacheHits, 1000); addMetric(blobCacheAdds, 1000); diff --git a/system/jhtree/jhtree.cpp b/system/jhtree/jhtree.cpp index 22daf58860a..71f162d5635 100644 --- a/system/jhtree/jhtree.cpp +++ b/system/jhtree/jhtree.cpp @@ -2632,7 +2632,6 @@ const CJHTreeNode *CNodeCache::getNode(const INodeLoader *keyIndex, unsigned iD, block.leave(); //Update any stats outside of the critical section. - cacheHits++; (*hitMetric[cacheType])++; if (ctx) ctx->noteStatistic(hitStatId[cacheType], 1); return fastPathMatch; @@ -2658,13 +2657,11 @@ const CJHTreeNode *CNodeCache::getNode(const INodeLoader *keyIndex, unsigned iD, //Move the atomic increments out of the critical section - they can be relatively expensive if (likely(alreadyExists)) { - cacheHits++; if (ctx) ctx->noteStatistic(hitStatId[cacheType], 1); (*hitMetric[cacheType])++; } else { - cacheAdds++; if (ctx) ctx->noteStatistic(addStatId[cacheType], 1); (*addMetric[cacheType])++; } @@ -2756,8 +2753,6 @@ const CJHTreeNode *CNodeCache::getNode(const INodeLoader *keyIndex, unsigned iD, } } -RelaxedAtomic cacheAdds; -RelaxedAtomic cacheHits; RelaxedAtomic nodesLoaded; RelaxedAtomic blobCacheHits; RelaxedAtomic blobCacheAdds; @@ -2771,8 +2766,6 @@ RelaxedAtomic nodeCacheDups; void clearNodeStats() { - cacheAdds.store(0); - cacheHits.store(0); nodesLoaded.store(0); blobCacheHits.store(0); blobCacheAdds.store(0); diff --git a/thorlcr/graph/thgraphslave.cpp b/thorlcr/graph/thgraphslave.cpp index 5f29b2c5c3b..fcba18cf0c6 100644 --- a/thorlcr/graph/thgraphslave.cpp +++ b/thorlcr/graph/thgraphslave.cpp @@ -1806,7 +1806,9 @@ void CJobSlave::endJob() void CJobSlave::reportGraphEnd(graph_id gid) { if (nodesLoaded) // wouldn't mean much if parallel jobs running - PROGLOG("Graph[%" GIDPF "u] - JHTree node stats:\ncacheAdds=%d\ncacheHits=%d\nnodesLoaded=%d\nblobCacheHits=%d\nblobCacheAdds=%d\nleafCacheHits=%d\nleafCacheAdds=%d\nnodeCacheHits=%d\nnodeCacheAdds=%d\n", gid, cacheAdds.load(), cacheHits.load(), nodesLoaded.load(), blobCacheHits.load(), blobCacheAdds.load(), leafCacheHits.load(), leafCacheAdds.load(), nodeCacheHits.load(), nodeCacheAdds.load()); + PROGLOG("Graph[%" GIDPF "u] - JHTree node stats:\ncacheAdds=%d\ncacheHits=%d\nnodesLoaded=%d\nblobCacheHits=%d\nblobCacheAdds=%d\nleafCacheHits=%d\nleafCacheAdds=%d\nnodeCacheHits=%d\nnodeCacheAdds=%d\n", + gid, blobCacheAdds + leafCacheAdds + nodeCacheAdds, blobCacheHits + leafCacheHits + nodeCacheHits, + nodesLoaded.load(), blobCacheHits.load(), blobCacheAdds.load(), leafCacheHits.load(), leafCacheAdds.load(), nodeCacheHits.load(), nodeCacheAdds.load()); if (!REJECTLOG(MCthorDetailedDebugInfo)) { JSocketStatistics stats;