summaryrefslogtreecommitdiff
path: root/chromium/base/process/process_metrics.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/base/process/process_metrics.h
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
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();