blob: cf74d93e52ff8066fcebbd10644d626ba36692ed [file] [log] [blame]
Ahmad Sharif0dcbc4b2012-02-02 16:37:18 -08001#!/usr/bin/python
2
3# Copyright 2011 Google Inc. All Rights Reserved.
4
5import sys
6import textwrap
7from settings_factory import BenchmarkSettings
8from settings_factory import GlobalSettings
9from settings_factory import LabelSettings
10
11
12class Help(object):
13 def GetUsage(self):
14 return """%s [OPTIONS] [ACTION] EXPERIMENT_FILE""" % (sys.argv[0])
15
16 def _WrapLine(self, line):
17 return "\n".join(textwrap.wrap(line, 80))
18
19 def _GetFieldDescriptions(self, fields):
20 res = ""
21 for field_name in fields:
22 field = fields[field_name]
23 res += "Field:\t\t%s\n" % field.name
24 res += self._WrapLine("Description:\t%s" % field.description) + "\n"
25 res += "Type:\t\t%s\n" % type(field).__name__.replace("Field", "")
26 res += "Required:\t%s\n" % field.required
27 if field.default:
28 res += "Default:\t%s\n" % field.default
29 res += "\n"
30 return res
31
32 def GetHelp(self):
33 global_fields = self._GetFieldDescriptions(GlobalSettings("").fields)
34 benchmark_fields = self._GetFieldDescriptions(BenchmarkSettings("").fields)
35 label_fields = self._GetFieldDescriptions(LabelSettings("").fields)
36
37 return """%s is a script for running performance experiments on ChromeOS. It
38allows one to run ChromeOS Autotest benchmarks over several images and compare
39the results to determine whether there is a performance difference.
40
41Comparing several images using %s is referred to as running an
42"experiment". An "experiment file" is a configuration file which holds all the
43information that describes the experiment and how it should be run. An example
44of a simple experiment file is below:
45
46--------------------------------- test.exp ---------------------------------
47name: my_experiment
48board: x86-alex
49remote: chromeos-alex5 172.18.122.132
50
51benchmark: PageCycler {
52 iterations: 3
53}
54
55my_first_image {
56 chromeos_image: /usr/local/chromeos-1/chromiumos_image.bin
57}
58
59my_second_image {
60 chromeos_image: /usr/local/chromeos-2/chromiumos_image.bin
61}
62----------------------------------------------------------------------------
63
64This experiment file names the experiment "my_experiment". It will be run
65on the board x86-alex. Benchmarks will be run using two remote devices,
66one is a device specified by a hostname and the other is a device specified
67by it's IP address. Benchmarks will be run in parallel across these devices.
68There is currently no way to specify which benchmark will run on each device.
69
70We define one "benchmark" that will be run, PageCycler. This benchmark has one
71"field" which specifies how many iterations it will run for.
72
73We specify 2 "labels" or images which will be compared. The PageCycler benchmark
74will be run on each of these images 3 times and a result table will be output
75which compares the two.
76
77The full list of fields that can be specified are as follows:
78=================
79Global Fields
80=================
81%s
82=================
83Benchmark Fields
84=================
85%s
86=================
87Label Fields
88=================
89%s
90
91Note that global fields are overidden by label or benchmark fields, if they can
92be specified in both places. Fields that are specified as arguments override
93fields specified in experiment files.
94
95%s is invoked by passing it a path to an experiment file, as well as an action
96to execute on that experiment file. The possible actions to use are:
97
98run\t\tRun the experiment and cache the results.
99
100table\t\tDisplay cached results of an experiment, without running anything.
101
102email\t\tEmail a summary of the results to the user.
103
104do\t\tThe default action. Executes the following actions: run, table, email.
105""" % (sys.argv[0], sys.argv[0], global_fields,
106 benchmark_fields, label_fields, sys.argv[0])