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

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: Add a common subclass to measurements. Created 6 years, 1 month 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
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 json
6
7 from metrics import Metric
8 from telemetry.value import scalar
9
10
11 class KeychainMetric(Metric):
12 """KeychainMetric gathers keychain statistics from the browser object.
13
14 This includes the number of times that the keychain was accessed.
15 """
16
17 DISPLAY_NAME = 'OSX_Keychain_Access'
18 HISTOGRAM_NAME = 'OSX.Keychain.Access'
19
20 def AddResults(self, tab, results):
21 """Adds the number of times that the keychain was accessed to |results|."""
22 get_histogram_js = 'statsCollectionController.getBrowserHistogram("%s")'
23
24 result = tab.EvaluateJavaScript(get_histogram_js % self.HISTOGRAM_NAME)
25 result = json.loads(result)
26
27 access_count = 0
28 if result:
jeremy 2014/11/13 11:31:30 Do you think we should fail if there are no entrie
erikchen 2014/11/13 22:52:59 If the keychain is never accessed, then there are
29 access_count = result['sum']
30 results.AddValue(scalar.ScalarValue(
31 results.current_page, self.DISPLAY_NAME, 'count', access_count))
OLDNEW
« tools/perf/measurements/__init__.py ('K') | « tools/perf/measurements/webrtc.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698