Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1475)

Unified Diff: tools/perf/metrics/keychain_metric.py

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Move GetEncryptionPassword so that it gets compiled on iOS. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/measurements/tab_switching.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/keychain_metric.py
diff --git a/tools/perf/metrics/keychain_metric.py b/tools/perf/metrics/keychain_metric.py
new file mode 100644
index 0000000000000000000000000000000000000000..5657dfe985bb78177111956a917d9b32122a3c31
--- /dev/null
+++ b/tools/perf/metrics/keychain_metric.py
@@ -0,0 +1,40 @@
+# Copyright 2014 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.
+
+import sys
+
+from metrics import Metric
+from telemetry.value import histogram_util
+from telemetry.value import scalar
+
+
+class KeychainMetric(Metric):
+ """KeychainMetric gathers keychain statistics from the browser object.
+
+ This includes the number of times that the keychain was accessed.
+ """
+
+ DISPLAY_NAME = 'OSX_Keychain_Access'
+ HISTOGRAM_NAME = 'OSX.Keychain.Access'
+
+ @classmethod
+ def CustomizeBrowserOptions(cls, options):
+ """Adds a browser argument that allows for the collection of keychain
+ metrics. Has no effect on non-Mac platforms."""
+ if sys.platform != 'darwin':
+ return
+
+ options.AppendExtraBrowserArgs(['--enable-stats-collection-bindings'])
+
+ def AddResults(self, tab, results):
+ """Adds the number of times that the keychain was accessed to |results|.
+ Has no effect on non-Mac platforms."""
+ if sys.platform != 'darwin':
+ return
+
+ access_count = histogram_util.GetHistogramSum(
+ histogram_util.BROWSER_HISTOGRAM, KeychainMetric.HISTOGRAM_NAME, tab)
+ results.AddValue(scalar.ScalarValue(
+ results.current_page, KeychainMetric.DISPLAY_NAME, 'count',
+ access_count))
« no previous file with comments | « tools/perf/measurements/tab_switching.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698