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 ==== Functional specification |
10 Usage: | 10 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 ==== Design details and API | 18 ==== API specification |
| 19 The C and C++ API is defined in "bootstat.h". See that header for |
| 20 specification details. |
| 21 |
| 22 ==== Design and implementation details |
19 Uptime data are stored in a file named /tmp/uptime-<event-name>; | 23 Uptime data are stored in a file named /tmp/uptime-<event-name>; |
20 disk statistics are stored in a file named /tmp/disk-<event-name>. | 24 disk statistics are stored in a file named /tmp/disk-<event-name>. |
21 This file naming convention is a concession to existing code that | 25 This convention is a concession to pre-existing code that depends on |
22 depends on these files existing with these specific names, including | 26 these files existing with these specific names, including the |
23 the platform_BootPerf test in autotest, /etc/boot-complete.conf, and | 27 platform_BootPerf test in autotest, the boot-complete upstart job, |
24 portions of Chrome. | 28 and the Chrome code to report boot time on the login screen. |
25 | 29 |
26 New code should treat the file names as an implementation detail, | 30 New code should treat the file names as an implementation detail, |
27 not as the interface. You should not add new code that depends on | 31 not as the interface. You should not add new code that depends on |
28 the file names; instead, you should enhance the bootstat command | 32 the file names; instead, you should enhance the bootstat command |
29 and/or library to provide access to the data you need. | 33 and/or library to provide access to the data you need. |
30 | 34 |
31 ==== Code conventions | 35 ==== Code conventions |
32 This is currently C code, because a) the code is intended for use | 36 This is currently C code, because a) the code is required for use |
33 as a library accessible to C and C++ code, and b) it's too small to | 37 as a library accessible to both C and C++ code, and b) it's too |
34 make sense using C++ features. However, if the program grows, it | 38 small to justify the boilerplate required to have separate C and |
35 may be appropriate to convert all or part to C++. | 39 C++ bindings. However, if the program grows, it may be appropriate |
| 40 to convert all or part to C++. |
36 | 41 |
37 To the extent that the code should be acceptable to a C++ compiler, | 42 To the extent that the code can be acceptable both to C and C++ |
38 it should also adhere to Google's C++ coding conventions. In areas | 43 compilers, it should also adhere to Google's C++ coding conventions. |
39 where the code is C specific, use your best judgement (note that | 44 In areas where the code is C specific, use your best judgement (note |
40 Google also has Objective-C coding conventions that may be useful). | 45 that Google also has Objective-C coding conventions that may be |
| 46 useful). |
OLD | NEW |