• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..16-Feb-2021-

bin/H16-Feb-2021-762543

build/H16-Feb-2021-311208

docs/H16-Feb-2021-210139

examples/H16-Feb-2021-750505

telemetry/H16-Feb-2021-69,99255,659

third_party/H16-Feb-2021-44,97834,750

BUILD.gnH A D16-Feb-20211.9 KiB7267

OWNERSH A D16-Feb-2021750 3730

PRESUBMIT.pyH A D16-Feb-20215.2 KiB140104

README.mdH A D16-Feb-20219.1 KiB181142

cloud_storageH A D16-Feb-20215.8 KiB201139

json_formatH A D16-Feb-20211.8 KiB5943

pylintrcH A D16-Feb-20211.8 KiB7445

telemetry.gypH A D16-Feb-2021382 1715

telemetry.isolateH A D16-Feb-2021649 2120

update_docsH A D16-Feb-2021307 125

validate_binary_dependenciesH A D16-Feb-20211.6 KiB5036

README.md

1<!-- Copyright 2015 The Chromium 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-->
5
6# Telemetry
7
8Telemetry is the performance testing framework used by Chrome.  It allows you
9to perform arbitrary actions on a set of web pages (or any android application!)
10and report metrics about it.  The framework abstracts:
11
12*   Launching a browser with arbitrary flags on any platform.
13*   Opening a tab and navigating to the page under test.
14*   Launching an Android application with intents through ADB.
15*   Fetching data via the Inspector timeline and traces.
16*   Using [Web Page Replay](../web_page_replay_go/README.md) to
17    cache real-world websites so they don’t change when used in benchmarks.
18
19## How to run the unit tests
20
21Run
22`catapult/telemetry/bin/run_tests --help`
23and see the usage info at the top.
24
25### Running tests on ChromeOS?
26
27See [this page](https://chromium.googlesource.com/chromiumos/docs/+/master/cros_vm.md#Run-telemetry-unit-tests).
28
29## Design Principles
30
31*   Write one performance test that runs on major platforms - Windows, Mac,
32    Linux, Chrome OS, and Android for both Chrome and ContentShell.
33*   Run on browser binaries, without a full Chromium checkout, and without
34    having to build the browser yourself.
35*   Use Web Page Replay to get repeatable test results.
36*   Clean architecture for writing benchmarks that keeps measurements and use
37    cases separate.
38
39**Telemetry is designed for measuring performance rather than checking
40  correctness. If you want to check for correctness,
41  [browser tests](http://www.chromium.org/developers/testing/browser-tests) are
42  your friend.**
43
44**If you are a Chromium developer looking to add a new Telemetry benchmark to
45[`src/tools/perf/`](https://code.google.com/p/chromium/codesearch#chromium/src/tools/perf/),
46please make sure to read our
47[Benchmark Policy](https://docs.google.com/document/d/1ni2MIeVnlH4bTj4yvEDMVNxgL73PqK_O9_NUm3NW3BA/preview)
48first.**
49
50## Code Concepts
51
52Telemetry provides two major functionality groups: those that provide test
53automation, and those that provide the capability to collect data.
54
55### Test Automation
56
57The test automation facilities of Telemetry provide Python wrappers for a number
58of different system concepts.
59
60*   _Platforms_ use a variety of libraries & tools to abstract away the OS
61    specific logic.
62*   _Browser_ wraps Chrome's
63    [DevTools Remote Debugging Protocol](https://developer.chrome.com/devtools/docs/remote-debugging)
64    to perform actions and extract information from the browser.
65*   _Android App_ is a Python wrapper around
66    [`adb shell`](http://developer.android.com/tools/help/adb.html).
67
68The Telemetry framework lives in
69[`src/third_party/catapult/telemetry/`](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/)
70and performance benchmarks that use Telemetry live in
71[`src/tools/perf/`](https://code.google.com/p/chromium/codesearch#chromium/src/tools/perf/).
72
73### Data Collection
74
75Telemetry offers a framework for collecting metrics that quantify the
76performance of automated actions in terms of benchmarks, measurements, and story
77sets.
78
79*   A
80    [_benchmark_](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/benchmark.py)
81    combines a _measurement_ together with a _story set_, and optionally a set
82    of browser options.
83    *   We strongly discourage benchmark authors from using command-line flags
84        to specify the behavior of benchmarks, since benchmarks should be
85        cross-platform.
86    *   Benchmarks are discovered and run by the
87        [benchmark runner](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/benchmark_runner.py),
88        which is wrapped by scripts like
89        [`run_benchmark`](https://code.google.com/p/chromium/codesearch#chromium/src/tools/perf/run_benchmark)
90        in `tools/perf`.
91*   A _measurement_ (called
92    [`StoryTest`](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/web_perf/story_test.py)
93    in the code) is responsible for setting up and tearing down the testing
94    platform, and for collecting _metrics_ that quantify the application
95    scenario under test.
96    *   Measurements need to work with all story sets, to provide consistency
97        and prevent benchmark rot.
98    *   You probably don't need to override `StoryTest` (see "Timeline Based
99        Measurement" below). If you think you do, please talk to us.
100*   A
101    [_story set_](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/story/story_set.py)
102    is a set of _stories_ together with a
103    [_shared state_](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/story/shared_state.py)
104    that describes application-level configuration options.
105*   A
106    [_story_](https://cs.chromium.org/chromium/src/third_party/catapult/telemetry/telemetry/story/story.py)
107    is an application scenario and a set of actions to run in that scenario. In
108    the typical Chromium use case, this will be a web page together with actions
109    like scrolling, clicking, or executing JavaScript.
110*   There are two major ways to collect data (often referred to as
111    _measurements_ or _metrics_) about the stories:
112    * _Ad hoc measurements:_  These are measurements that do not require traces,
113        for example when a metric is calculated directly in the test page in
114        Javascript and we simply want to extract and report this number.
115        Currently `PressBenchmark` and associated `PressStory` subclasses are
116        examples that use ad hoc measurements. (In reality, PressBenchmark uses
117        `DualMetricMeasurement` StoryTest, where you can have both ad hoc and
118        timeline based metrics.)
119    *  _Timeline Based Measurements:_ These are measurements that require
120       recording a timeline of events, for example a [chrome
121       trace](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool).
122       Telemetry collects traces and other artifacts as it interacts with the
123       page and stores them in the form of test results, then [Results Processor](https://source.chromium.org/chromium/chromium/src/+/master:tools/perf/core/results_processor/README.md)
124       computes metrics using these test results. New metrics should generally
125       be timeline based measurements: Computing metrics on the trace makes it
126       possible to compute many different metrics from the same run easily, and
127       the collected trace is useful for debugging metrics values.
128        *  The current supported programming model is known as [Timeline Based Measurements v2](https://github.com/catapult-project/catapult/blob/master/docs/how-to-write-metrics.md)
129           **This is the current recommended method of adding metrics to telemetry**.
130        *  [TBMv3](https://source.chromium.org/chromium/chromium/src/+/master:tools/perf/core/tbmv3/),
131           a new version of Timeline Based Measurement based on Perfetto is
132           currently under development. It is not ready for general use yet but
133           there are active experiments on the FYI bots. Ideally this will
134           eventually replace TBMv2, but this will only happen once have an easy
135           migration path of current TBMv2 metrics to TBMv3.
136
137## Next Steps
138
139*   [Run Telemetry benchmarks locally](/telemetry/docs/run_benchmarks_locally.md)
140*   [Record a story set](https://sites.google.com/a/chromium.org/dev/developers/telemetry/record_a_page_set)
141    with Web Page Replay
142*   [Feature guidelines](https://sites.google.com/a/chromium.org/dev/developers/telemetry/telemetry-feature-guidelines)
143*   [Profile generation](https://sites.google.com/a/chromium.org/dev/developers/telemetry/telemetry-profile-generation)
144*   [Telemetry unittests](/telemetry/docs/run_telemetry_tests.md)
145
146## Contact Us or Follow Along
147
148If you have questions, please email telemetry@chromium.org.
149
150You can keep up with Telemetry related discussions by joining the
151[telemetry group](https://groups.google.com/a/chromium.org/forum/#!forum/telemetry).
152
153[For Googlers](http://go/telemetry)
154
155## Frequently Asked Questions
156
157### I get an error when I try to use recorded story sets.
158
159The recordings are not included in the Chromium source tree. If you are a Google
160partner, run `gsutil config` to authenticate, then try running the test again.
161If you don't have `gsutil` installed on your machine, you can find it in
162`build/third_party/gsutil/gsutil`.
163
164If you are not a Google partner, you can run on live sites with
165--use-live-sites` or
166[record your own](http://dev.chromium.org/developers/telemetry/record_a_page_set)
167story set archive.
168
169### I get mysterious errors about device\_forwarder failing.
170
171Your forwarder binary may be outdated. If you have built the forwarder in
172src/out that one will be used. if there isn't anything there Telemetry will
173default to downloading a pre-built binary. Try re-building the forwarder, or
174alternatively wiping the contents of `src/out/` and running `run_benchmark`,
175which should download the latest binary.
176
177### I'm having problems with keychain prompts on Mac.
178
179Make sure that your keychain is
180[correctly configured](https://sites.google.com/a/chromium.org/dev/developers/telemetry/telemetry-mac-keychain-setup).
181