Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: bootperf-bin/showbootdata

Issue 4148011: Create bootperf-bin tools for running boot time tests and reporting results (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Apply selected fixes recommended by gpylint Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bootperf-bin/resultset.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """A command to display summary statistics from runs of 'bootperf'.
8
9 Command line options allow selecting from one of two sets of
10 performance statistics: The boot time statistics (selected by
11 --timestats) measure time spent from kernel startup in milliseconds.
12 The disk statistics (selected by --diskstats) measure total bytes
13 read from the boot device since kernel startup.
14
15 Boot time statistics are recorded as cumulative time (or disk read)
16 since kernel startup, measured when specific events occur during
17 boot. Events include such things as 'startup', the moment when the
18 upstart 'startup' job begins running, and 'login', when the
19 Chrome OS login screen is displayed. By default, all recorded events
20 are included in the output; command line options allow restricting
21 the view to a selected subset of events.
22
23 Separate command line options allow selecting from one of two
24 different display modes. When --averages is selected, the display
25 shows the average value and sample standard deviation (as a percent
26 of the average) for all selected events. The --averages display also
27 calculates the time (or bytes) between adjacent events, and shows
28 the avearage and sample standard deviation of the differences.
29
30 The --rawdata display shows the raw data value associated with each
31 event for each boot: Each line of output represents the event values
32 for one boot cycle.
33
34 """
35
36 import sys
37 import optparse
38
39 import perfprinter
40
41
42 _usage = "%prog [options] [results-directory ...]"
43 _description = """\
44 Summarize boot time performance results. The result directory
45 arguments are directories previously specified as output for the
46 'bootperf' script.
47 """
48 optparser = optparse.OptionParser(usage=_usage, description=_description)
49
50 optgroup = optparse.OptionGroup(
51 optparser, "Selecting boot time or disk statistics (choose one)")
52 optgroup.add_option(
53 "-d", "--diskstats", action="store_true",
54 dest="use_diskstats",
55 help="use statistics for bytes read since kernel startup")
56 optgroup.add_option(
57 "-t", "--timestats", action="store_true",
58 dest="use_timestats",
59 help="use statistics for time since kernel startup (default)")
60 optparser.add_option_group(optgroup)
61 optparser.set_defaults(use_diskstats=False)
62 optparser.set_defaults(use_timestats=False)
63
64 optgroup = optparse.OptionGroup(optparser, "Event selection")
65 optgroup.add_option(
66 "-e", "--event", action="append",
67 dest="eventnames",
68 help="restrict statistics to the comma-separated list of events")
69 optparser.add_option_group(optgroup)
70
71 optgroup = optparse.OptionGroup(
72 optparser, "Display mode selection (choose one)")
73 optgroup.add_option(
74 "-a", "--averages", action="store_true",
75 dest="print_averages",
76 help="display a summary of the averages of chosen statistics (default)")
77 optgroup.add_option(
78 "-r", "--rawdata", action="store_true",
79 dest="print_raw",
80 help="display raw data from all boot iterations")
81 optparser.add_option_group(optgroup)
82 optparser.set_defaults(print_averages=False)
83 optparser.set_defaults(print_raw=False)
84
85
86 def main(argv):
87 (options, args) = optparser.parse_args(argv)
88 if options.print_averages and options.print_raw:
89 print >>sys.stderr, "Can't use -a and -r together.\n"
90 optparser.print_help()
91 sys.exit(1)
92 elif options.print_raw:
93 printfunc = perfprinter.PrintRawData
94 else:
95 printfunc = perfprinter.PrintStatisticsSummary
96 if options.use_timestats and options.use_diskstats:
97 print >>sys.stderr, "Can't use -t and -d together.\n"
98 optparser.print_help()
99 sys.exit(1)
100 elif options.use_diskstats:
101 use_timestats = False
102 else:
103 use_timestats = True
104 if options.eventnames:
105 keylist = []
106 for kl in options.eventnames:
107 keylist.extend(kl.split(','))
108 else:
109 keylist = None
110 printfunc(args, use_timestats, keylist)
111
112 if __name__ == "__main__":
113 if len(sys.argv) > 1:
114 main(sys.argv[1:])
115 else:
116 main(["."])
OLDNEW
« no previous file with comments | « bootperf-bin/resultset.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698