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 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/browser_list_observer.h" | 21 #include "chrome/browser/ui/browser_list_observer.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
24 #include "chromeos/dbus/debug_daemon_client.h" | 24 #include "chromeos/dbus/debug_daemon_client.h" |
25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Partition time since login into successive intervals of this size. In each | 29 // Partition time since login into successive intervals of this size. In each |
30 // interval, pick a random time to collect a profile. | 30 // interval, pick a random time to collect a profile. |
31 // This interval is twenty-four hours. | 31 const size_t kPerfProfilingIntervalMs = 3 * 60 * 60 * 1000; |
32 const size_t kPerfProfilingIntervalMs = 24 * 60 * 60 * 1000; | |
33 | 32 |
34 // Default time in seconds perf is run for. | 33 // Default time in seconds perf is run for. |
35 const size_t kPerfCommandDurationDefaultSeconds = 2; | 34 const size_t kPerfCommandDurationDefaultSeconds = 2; |
36 | 35 |
37 // Limit the total size of protobufs that can be cached, so they don't take up | 36 // Limit the total size of protobufs that can be cached, so they don't take up |
38 // too much memory. If the size of cached protobufs exceeds this value, stop | 37 // too much memory. If the size of cached protobufs exceeds this value, stop |
39 // collecting further perf data. The current value is 4 MB. | 38 // collecting further perf data. The current value is 4 MB. |
40 const size_t kCachedPerfDataProtobufSizeThreshold = 4 * 1024 * 1024; | 39 const size_t kCachedPerfDataProtobufSizeThreshold = 4 * 1024 * 1024; |
41 | 40 |
42 // There may be too many suspends to collect a profile each time there is a | 41 // There may be too many suspends to collect a profile each time there is a |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 DCHECK(!login_time_.is_null()); | 395 DCHECK(!login_time_.is_null()); |
397 collection_data. | 396 collection_data. |
398 set_ms_after_login((base::TimeTicks::Now() - login_time_) | 397 set_ms_after_login((base::TimeTicks::Now() - login_time_) |
399 .InMilliseconds()); | 398 .InMilliseconds()); |
400 | 399 |
401 // Finally, store the perf data itself. | 400 // Finally, store the perf data itself. |
402 collection_data.mutable_perf_data()->Swap(&perf_data_proto); | 401 collection_data.mutable_perf_data()->Swap(&perf_data_proto); |
403 } | 402 } |
404 | 403 |
405 } // namespace metrics | 404 } // namespace metrics |
OLD | NEW |