OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "window_manager/metrics_reporter.h" | 5 #include "window_manager/metrics_reporter.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "window_manager/layout_manager.h" | 9 #include "window_manager/layout_manager.h" |
10 #include "window_manager/system_metrics.pb.h" | 10 #include "window_manager/system_metrics.pb.h" |
11 #include "window_manager/window.h" | 11 #include "window_manager/window.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace window_manager { |
14 | 14 |
15 // This is the path to a file that's created by boot scripts, which contains | 15 // This is the path to a file that's created by boot scripts, which contains |
16 // the boot time drawn from bootchart. | 16 // the boot time drawn from bootchart. |
17 // TODO: communicate this information over something like DBus. | 17 // TODO: communicate this information over something like DBus. |
18 const char kBootTimeFilename[] = "/tmp/boot-time"; | 18 const char kBootTimeFilename[] = "/tmp/boot-time"; |
19 | 19 |
20 class ScopedFilePointer { | 20 class ScopedFilePointer { |
21 public: | 21 public: |
22 explicit ScopedFilePointer(FILE* const fp) : fp_(fp) {} | 22 explicit ScopedFilePointer(FILE* const fp) : fp_(fp) {} |
23 ~ScopedFilePointer() { | 23 ~ScopedFilePointer() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return false; | 66 return false; |
67 } | 67 } |
68 int boot_time; | 68 int boot_time; |
69 if (0 == sscanf(line, "%d", &boot_time)) { // should ignore trailing \n | 69 if (0 == sscanf(line, "%d", &boot_time)) { // should ignore trailing \n |
70 return false; | 70 return false; |
71 } | 71 } |
72 metrics->set_boot_time_ms(boot_time); | 72 metrics->set_boot_time_ms(boot_time); |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 } // namespace chromeos | 76 } // namespace window_manager |
OLD | NEW |