OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // before it is triggered. The following 2 variables determine the upper and | 39 // before it is triggered. The following 2 variables determine the upper and |
40 // lower bound on the interval. | 40 // lower bound on the interval. |
41 // The reason we do not always want to collect the initial profile after a fixed | 41 // The reason we do not always want to collect the initial profile after a fixed |
42 // period is to not over-represent task X in the profile where task X always | 42 // period is to not over-represent task X in the profile where task X always |
43 // runs at a fixed period after start-up. By selecting a period randomly between | 43 // runs at a fixed period after start-up. By selecting a period randomly between |
44 // a lower and upper bound, we will hopefully collect a more fair profile. | 44 // a lower and upper bound, we will hopefully collect a more fair profile. |
45 const size_t kPerfCommandStartIntervalLowerBoundMinutes = 10; | 45 const size_t kPerfCommandStartIntervalLowerBoundMinutes = 10; |
46 | 46 |
47 const size_t kPerfCommandStartIntervalUpperBoundMinutes = 20; | 47 const size_t kPerfCommandStartIntervalUpperBoundMinutes = 20; |
48 | 48 |
49 const size_t kNumberOfSecondsInAMinute = 60; | |
50 | |
51 // Default time in seconds perf is run for. | 49 // Default time in seconds perf is run for. |
52 const size_t kPerfCommandDurationDefaultSeconds = 2; | 50 const size_t kPerfCommandDurationDefaultSeconds = 2; |
53 | 51 |
54 // Enumeration representing success and various failure modes for collecting and | 52 // Enumeration representing success and various failure modes for collecting and |
55 // sending perf data. | 53 // sending perf data. |
56 enum GetPerfDataOutcome { | 54 enum GetPerfDataOutcome { |
57 SUCCESS, | 55 SUCCESS, |
58 NOT_READY_TO_UPLOAD, | 56 NOT_READY_TO_UPLOAD, |
59 NOT_READY_TO_COLLECT, | 57 NOT_READY_TO_COLLECT, |
60 INCOGNITO_ACTIVE, | 58 INCOGNITO_ACTIVE, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 186 |
189 if (!perf_data_proto_.ParseFromArray(data.data(), data.size())) { | 187 if (!perf_data_proto_.ParseFromArray(data.data(), data.size())) { |
190 AddToPerfHistogram(PROTOBUF_NOT_PARSED); | 188 AddToPerfHistogram(PROTOBUF_NOT_PARSED); |
191 perf_data_proto_.Clear(); | 189 perf_data_proto_.Clear(); |
192 return; | 190 return; |
193 } | 191 } |
194 | 192 |
195 state_ = READY_TO_UPLOAD; | 193 state_ = READY_TO_UPLOAD; |
196 } | 194 } |
197 } // namespace metrics | 195 } // namespace metrics |
OLD | NEW |