OLD | NEW |
---|---|
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 |
OLD | NEW |