Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-30308 Remove unnecessary atomics cacheAdds and cacheHits #17789

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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