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." 10ATTRIBUTES = "suite:AFDO_record" 11TIME = "LONG" 12TEST_CATEGORY = "Benchmark" 13TEST_CLASS = "telemetry" 14TEST_TYPE = "server" 15 16DOC = """ 17Run a pre-defined set of benchmarks on the DUT and create a sampled profile 18of the chrome execution. The profile is generated in AFDO format. 19See go/chromeos-toolchain and search for AFDO for more information about AFDO. 20For now, this test can only run on devices that support LBR PMU events and 21that have at lest 2GB of space in /tmp (autotest limitation). 22 23Example invocation: 24/usr/bin/test_that --debug --board=lumpy <DUT IP> 25 --args="ignore_failures=True local=True gs_test_location=True" 26 telemetry_AFDOGenerate 27""" 28 29args_dict = utils.args_to_dict(args) 30 31profiler = 'custom_perf' 32# These are arguments to the linux "perf" tool. 33# The -e value is processor specific and comes from the Intel SDM vol 3b 34profiler_args = 'record -a -e r20c4 -c 500000 -b ' 35 36job.default_profile_only = True 37job.profilers.add(profiler, profiler_args) 38 39def run_telemetry_AFDOGenerate(machine): 40 run_host = hosts.create_host(machine) 41 42 # TODO (llozano): 43 # Pass "disable_sysinfo=True" to run_test since it would be nice 44 # to avoid copying all the logs back to the server. However, we 45 # cannot do this because of crosbug 308646 46 job.run_test('telemetry_AFDOGenerate', host=run_host, 47 args=args_dict) 48 49job.parallel_simple(run_telemetry_AFDOGenerate, machines) 50 51if profiler: 52 job.profilers.delete(profiler) 53