diff options
author | Louis Williams <louis.williams@mongodb.com> | 2020-11-09 09:17:07 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-09 14:48:16 +0000 |
commit | a09a1afbe18353ac5c865a643c97029e5cba4925 (patch) | |
tree | 7caa77af6a208654628a86271db35756cd07c346 /src/mongo/db/stats/resource_consumption_metrics.h | |
parent | 9363cfebe2ab8123ced86632a6b674fb5903e420 (diff) | |
download | mongo-a09a1afbe18353ac5c865a643c97029e5cba4925.tar.gz |
SERVER-51668 Report total CPU time spent by operations in serverStatus
Diffstat (limited to 'src/mongo/db/stats/resource_consumption_metrics.h')
-rw-r--r-- | src/mongo/db/stats/resource_consumption_metrics.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mongo/db/stats/resource_consumption_metrics.h b/src/mongo/db/stats/resource_consumption_metrics.h index a4c8e02b247..2f7855dd870 100644 --- a/src/mongo/db/stats/resource_consumption_metrics.h +++ b/src/mongo/db/stats/resource_consumption_metrics.h @@ -350,21 +350,31 @@ public: void merge(OperationContext* opCtx, const std::string& dbName, const OperationMetrics& metrics); /** - * Returns a copy of the Metrics map. + * Returns a copy of the per-database metrics map. */ using MetricsMap = std::map<std::string, AggregatedMetrics>; - MetricsMap getMetrics() const; + MetricsMap getDbMetrics() const; /** - * Returns the Metrics map and then clears the contents. This attempts to swap and return the - * metrics map rather than making a full copy like getMetrics. + * Returns the per-database metrics map and then clears the contents. This attempts to swap and + * return the metrics map rather than making a full copy like getDbMetrics. */ - MetricsMap getAndClearMetrics(); + MetricsMap getAndClearDbMetrics(); + + /** + * Returns the globally-aggregated CPU time. + */ + Nanoseconds getCpuTime() const; + + /** + * Clears the existing CPU time. + */ + Nanoseconds getAndClearCpuTime(); private: - // Protects _metrics + // Protects _dbMetrics and _cpuTime mutable Mutex _mutex = MONGO_MAKE_LATCH("ResourceConsumption::_mutex"); - MetricsMap _metrics; + MetricsMap _dbMetrics; + Nanoseconds _cpuTime; }; - } // namespace mongo |