control revision 76d9968f3a3618671f3e83c0113e06e1f3025bd2
1# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from autotest_lib.client.common_lib import utils
6
7AUTHOR = "llozano@chromium.org c-compiler-chrome@google.com"
8NAME = "telemetry_AFDOGenerate"
9PURPOSE = "Produce profile (AFDO format) of normal browsing for optimization."
10SUITE = "AFDO_record"
11TIME = "LONG"
12TEST_CATEGORY = "Benchmark"
13TEST_CLASS = "telemetry"
14TEST_TYPE = "server"
15# The test uses gsutil to do upload, which is not supported in container.
16REQUIRE_SSP = False
17
18DOC = """
19Run a pre-defined set of benchmarks on the DUT and create a sampled profile
20of the chrome execution. The profile is generated in AFDO format.
21See go/afdo for more information about AFDO.
22For now, this test is only designed to run on lumpy and parrot boards.
23It will fail if run on other boards.
24
25Example invocation:
26/usr/bin/test_that --debug --board=lumpy <DUT IP>
27  --args="ignore_failures=True local=True gs_test_location=True"
28  telemetry_PGOGenerate
29"""
30
31args_dict = utils.args_to_dict(args)
32
33profiler = 'custom_perf'
34# These are arguments to the linux "perf" tool.
35# The -e value is processor specific and comes from the Intel SDM vol 3b
36profiler_args = 'record -a -e r20c4 -c 500000 -b '
37
38job.default_profile_only = True
39job.profilers.add(profiler, profiler_args)
40
41def run_telemetry_AFDOGenerate(machine):
42    run_host = hosts.create_host(machine)
43
44    # TODO (llozano):
45    # Pass "disable_sysinfo=True" to run_test since it would be nice
46    # to avoid copying all the logs back to the server. However, we
47    # cannot do this because of crosbug 308646
48    job.run_test('telemetry_AFDOGenerate', host=run_host,
49                  args=args_dict)
50
51job.parallel_simple(run_telemetry_AFDOGenerate, machines)
52
53if profiler:
54    job.profilers.delete(profiler)
55