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

Side by Side Diff: base/perf_util.cc

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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/perf_util.h" 5 #include "base/perf_util.h"
6 6
7 #include "base/metrics/histogram.h"
7 #include "base/time/time.h" 8 #include "base/time/time.h"
8 9
9 namespace base { 10 namespace base {
10 11
11 void SpinCpuMicroseconds(int64_t microseconds) { 12 void SpinCpuMicroseconds(int64_t microseconds) {
12 Time start(Time::Now()); 13 Time start(Time::Now());
13 while (true) { 14 while (true) {
14 Time now(Time::Now()); 15 Time now(Time::Now());
15 TimeDelta delta = now - start; 16 TimeDelta delta = now - start;
16 if (delta.InMicroseconds() > microseconds) 17 if (delta.InMicroseconds() > microseconds)
17 break; 18 break;
18 } 19 }
jeremy 2014/11/13 11:31:29 Shouldn't be part of this CL.
erikchen 2014/11/13 22:52:59 Right. I removed the dependency of this CL on the
19 } 20 }
20 21
22 void EmitAccessKeychainHistogram() {
jeremy 2014/11/13 11:31:29 nit: rename IncrementKeychainAccessHistogram().
erikchen 2014/11/13 22:52:59 Done.
23 LOCAL_HISTOGRAM_BOOLEAN("OSX.Keychain.Access", true);
jeremy 2014/11/13 11:31:29 needs a comment here that explains what this histo
erikchen 2014/11/13 22:52:59 I added copious documentation to the header file,
24 }
25
21 } // namespace base 26 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698