summaryrefslogtreecommitdiff
path: root/chromium/base/process/process_metrics.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/base/process/process_metrics.h')
-rw-r--r--chromium/base/process/process_metrics.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/chromium/base/process/process_metrics.h b/chromium/base/process/process_metrics.h
index 2b7cfe14f73..be23db0f928 100644
--- a/chromium/base/process/process_metrics.h
+++ b/chromium/base/process/process_metrics.h
@@ -13,11 +13,14 @@
#include <memory>
#include <string>
+#include <utility>
+#include <vector>
#include "base/base_export.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/process/process_handle.h"
+#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -118,6 +121,17 @@ class BASE_EXPORT ProcessMetrics {
// will result in a time delta of 2 seconds/per 1 wall-clock second.
TimeDelta GetCumulativeCPUUsage();
+ // Emits the cumulative CPU usage for all currently active threads since they
+ // were started into the output parameter (replacing its current contents).
+ // Threads that have already terminated will not be reported. Thus, the sum of
+ // these times may not equal the value returned by GetCumulativeCPUUsage().
+ // Returns false on failure. We return the usage via an output parameter to
+ // allow reuse of CPUUsagePerThread's std::vector by the caller, e.g. to avoid
+ // allocations between repeated calls to method.
+ // NOTE: Currently only supported on Linux/Android.
+ using CPUUsagePerThread = std::vector<std::pair<PlatformThreadId, TimeDelta>>;
+ bool GetCumulativeCPUUsagePerThread(CPUUsagePerThread&);
+
// Returns the number of average idle cpu wakeups per second since the last
// call.
int GetIdleWakeupsPerSecond();