Skip to content

Commit

Permalink
HPCC-30308 Remove unnecessary atomics cacheAdds and cacheHits
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Sep 19, 2023
1 parent dff3ece commit f6c5723
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 0 additions & 2 deletions roxie/ccd/ccdsnmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ CRoxieMetricsManager::CRoxieMetricsManager()
addMetric(restarts, 0);

addMetric(nodesLoaded, 1000);
addMetric(cacheHits, 1000);
addMetric(cacheAdds, 1000);

addMetric(blobCacheHits, 1000);
addMetric(blobCacheAdds, 1000);
Expand Down
7 changes: 0 additions & 7 deletions system/jhtree/jhtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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])++;
}
Expand Down Expand Up @@ -2756,8 +2753,6 @@ const CJHTreeNode *CNodeCache::getNode(const INodeLoader *keyIndex, unsigned iD,
}
}

RelaxedAtomic<unsigned> cacheAdds;
RelaxedAtomic<unsigned> cacheHits;
RelaxedAtomic<unsigned> nodesLoaded;
RelaxedAtomic<unsigned> blobCacheHits;
RelaxedAtomic<unsigned> blobCacheAdds;
Expand All @@ -2771,8 +2766,6 @@ RelaxedAtomic<unsigned> nodeCacheDups;

void clearNodeStats()
{
cacheAdds.store(0);
cacheHits.store(0);
nodesLoaded.store(0);
blobCacheHits.store(0);
blobCacheAdds.store(0);
Expand Down
4 changes: 3 additions & 1 deletion thorlcr/graph/thgraphslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f6c5723

Please sign in to comment.