OLD | NEW |
1 Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 Copyright (c) 2010 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 This is the Chromium OS 'bootstat' utility. The utility is used | 5 This is the Chromium OS 'bootstat' utility. The utility is used |
6 to generate timestamps and other performance statistics during | 6 to generate timestamps and other performance statistics during |
7 system boot. | 7 system boot. |
8 | 8 |
9 ==== Functional specification | 9 ==== Command specifications |
10 Usage: | 10 'bootstat' command usage: |
11 bootstat <event-name> | 11 bootstat <event-name> |
12 | 12 |
13 Summary: The command gathers and records the contents of | 13 Summary: The command gathers and records the contents of |
14 /proc/uptime and disk statistics for the boot disk (the full disk, | 14 /proc/uptime and disk statistics for the boot disk (the full disk, |
15 not the boot partition), and associates the data with the passed | 15 not the boot partition), and associates the data with the passed |
16 in <event-name>. | 16 in <event-name>. |
17 | 17 |
| 18 ---- |
| 19 'bootstat_get_last' command usage: |
| 20 bootstat_get_last <event-name> [ <stat> ... ] |
| 21 |
| 22 Summary: Print on standard output the value of selected statistics |
| 23 recorded when a specified event occurred. These are the available |
| 24 statistics: |
| 25 time: Total time since kernel startup at the time of the event. |
| 26 read-sectors: Total sectors read from any partition of the boot |
| 27 device since kernel startup. |
| 28 write-sectors: Total sectors written to any partition of the |
| 29 boot device since kernel startup. |
| 30 |
| 31 If multiple statistics requested, they are reported in order, one |
| 32 per line. If no statistics are listed on the command line, the |
| 33 default is to report 'time'. |
| 34 |
| 35 If an event has occurred more than once since kernel startup, only |
| 36 the statistics from the last occurrence are reported. |
| 37 |
18 ==== API specification | 38 ==== API specification |
19 The C and C++ API is defined in "bootstat.h". See that header for | 39 The C and C++ API is defined in "bootstat.h". See that header for |
20 specification details. | 40 specification details. |
21 | 41 |
22 ==== Design and implementation details | 42 ==== Design and implementation details |
23 Uptime data are stored in a file named /tmp/uptime-<event-name>; | 43 Uptime data are stored in a file named /tmp/uptime-<event-name>; |
24 disk statistics are stored in a file named /tmp/disk-<event-name>. | 44 disk statistics are stored in a file named /tmp/disk-<event-name>. |
25 This convention is a concession to pre-existing code that depends on | 45 This convention is a concession to pre-existing code that depends on |
26 these files existing with these specific names, including the | 46 these files existing with these specific names, including the |
27 platform_BootPerf test in autotest, the boot-complete upstart job, | 47 platform_BootPerf test in autotest, the boot-complete upstart job, |
28 and the Chrome code to report boot time on the login screen. | 48 and the Chrome code to report boot time on the login screen. |
29 | 49 |
30 New code should treat the file names as an implementation detail, | 50 New code should treat the file names as an implementation detail, |
31 not as the interface. You should not add new code that depends on | 51 not as the interface. You should not add new code that depends on |
32 the file names; instead, you should enhance the bootstat command | 52 the file names; instead, you should enhance the bootstat command |
33 and/or library to provide access to the data you need. | 53 and/or library to provide access to the data you need. |
34 | 54 |
35 ==== Code conventions | 55 ==== Code conventions |
36 This is currently C code, because a) the code is required for use | 56 This is currently C code, because a) the code is required for use |
37 as a library accessible to both C and C++ code, and b) it's too | 57 as a library accessible to both C and C++ code, and b) it's too |
38 small to justify the boilerplate required to have separate C and | 58 small to justify the boilerplate required to have separate C and |
39 C++ bindings. However, if the program grows, it may be appropriate | 59 C++ bindings. However, if the program grows, it may be appropriate |
40 to convert all or part to C++. | 60 to convert all or part to C++. |
41 | 61 |
42 To the extent that the code can be acceptable both to C and C++ | 62 To the extent that the code can be acceptable both to C and C++ |
43 compilers, it should also adhere to Google's C++ coding conventions. | 63 compilers, it should also adhere to Google's C++ coding conventions. |
44 In areas where the code is C specific, use your best judgement (note | 64 In areas where the code is C specific, use your best judgement (note |
45 that Google also has Objective-C coding conventions that may be | 65 that Google also has Objective-C coding conventions that may be |
46 useful). | 66 useful). |
OLD | NEW |