Add new InodeMap metrics

Summary: InodeMap, in subsequent diffs, will report metrics when looking up inodes (hits, misses, errors). Adding a new stats subtype with counters for this purpose.

Reviewed By: chadaustin

Differential Revision: D49477890

fbshipit-source-id: 18386cd18e83da57053f39f6eea2966de48dbfb5
This commit is contained in:
John Elliott 2023-09-21 18:58:45 -07:00 committed by Facebook GitHub Bot
parent 5632c1a87f
commit 3be15e3b69

View File

@ -29,6 +29,7 @@ struct JournalStats;
struct ThriftStats;
struct TelemetryStats;
struct OverlayStats;
struct InodeMapStats;
/**
* StatsGroupBase is a base class for a group of thread-local stats
@ -124,6 +125,7 @@ class EdenStats : public RefCounted {
ThreadLocal<ThriftStats> thriftStats_;
ThreadLocal<TelemetryStats> telemetryStats_;
ThreadLocal<OverlayStats> overlayStats_;
ThreadLocal<InodeMapStats> inodeMapStats_;
};
using EdenStatsPtr = RefPtr<EdenStats>;
@ -185,6 +187,11 @@ inline OverlayStats& EdenStats::getStatsForCurrentThread<OverlayStats>() {
return *overlayStats_.get();
}
template <>
inline InodeMapStats& EdenStats::getStatsForCurrentThread<InodeMapStats>() {
return *inodeMapStats_.get();
}
template <typename T>
class StatsGroup : public StatsGroupBase {
public:
@ -384,6 +391,14 @@ struct OverlayStats : StatsGroup<OverlayStats> {
Duration renameChild{"overlay.rename_child_us"};
};
struct InodeMapStats : StatsGroup<InodeMapStats> {
Counter lookupTreeInodeHit{"inode_map.lookup_tree_inode_hit"};
Counter lookupBlobInodeHit{"inode_map.lookup_blob_inode_hit"};
Counter lookupTreeInodeMiss{"inode_map.lookup_tree_inode_miss"};
Counter lookupBlobInodeMiss{"inode_map.lookup_blob_inode_miss"};
Counter lookupInodeError{"inode_map.lookup_inode_error"};
};
/**
* On construction, notes the current time. On destruction, records the elapsed
* time in the specified EdenStats Duration.