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

Side by Side 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: Comments from jeremy. Created 6 years 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 unified diff | Download patch
« no previous file with comments | « tools/perf/measurements/tab_switching.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import sys
6
7 from metrics import Metric
8 from telemetry.value import histogram_util
9 from telemetry.value import scalar
10
11
12 class KeychainMetric(Metric):
13 """KeychainMetric gathers keychain statistics from the browser object.
14
15 This includes the number of times that the keychain was accessed.
16 """
17
18 DISPLAY_NAME = 'OSX_Keychain_Access'
19 HISTOGRAM_NAME = 'OSX.Keychain.Access'
20
21 @classmethod
22 def CustomizeBrowserOptionsMac(cls, options):
23 """Adds a browser argument that allows for the collection of keychain
24 metrics. Has no effect on non-Mac platforms."""
25 if sys.platform != 'darwin':
26 return
27
28 options.AppendExtraBrowserArgs(['--enable-stats-collection-bindings'])
29
30 def AddResultsMac(self, tab, results):
jeremy 2014/12/14 08:55:50 I feel quite strongly that these should just be ca
31 """Adds the number of times that the keychain was accessed to |results|.
32 Has no effect on non-Mac platforms."""
33 if sys.platform != 'darwin':
34 return
35
36 access_count = histogram_util.GetHistogramSum(
37 histogram_util.BROWSER_HISTOGRAM, KeychainMetric.HISTOGRAM_NAME, tab)
38 results.AddValue(scalar.ScalarValue(
39 results.current_page, KeychainMetric.DISPLAY_NAME, 'count',
40 access_count))
41
42 def AddResults(self, tab, results):
43 """This method should never be called."""
44 assert False
OLDNEW
« 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