Index: tools/perf/metrics/stats_table_util.py |
diff --git a/tools/perf/metrics/stats_table_util.py b/tools/perf/metrics/stats_table_util.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fb8af223d1a82ec920fac5ae2ed2983635bb828e |
--- /dev/null |
+++ b/tools/perf/metrics/stats_table_util.py |
@@ -0,0 +1,23 @@ |
+# Copyright 2013 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+"""This is a helper module to get and manipulate stats table data. |
+ |
+The status table data is the same data as is visible from "chrome://stats" and |
+relies on --enable-stats-table being set. |
+More information can be found at: chromium/src/base/metrics/stats_table.h |
+ |
+Stats table data is collected with the window.statsCollectionController object. |
+""" |
+ |
+import json |
+ |
+ |
+def GetStatsTable(tab): |
+ """Get the full stats table from the browser.""" |
+ stats_table_json = tab.EvaluateJavaScript( |
+ 'statsCollectionController.getStatsTable()') |
+ if stats_table_json: |
+ return json.loads(stats_table_json) |
+ return None |