You will need a device with USB debugging enabled, connected to your computer. In addition:
export ID=android
# Verify that the device has connected to your workstation successfully: its # serial number must be listed below and have "device" next to it: third_party/catapult/devil/bin/deps/linux2/x86_64/bin/adb devices ... <serial> device ... # Set mobile device ID: export $ID=<serial>
src/tools/perf/page_sets
(codesearching the test name will likely be easiest). Copy the story class and add this year as the suffix to the class and the story name. Example: CnnStory2019
and NAME='browse:news:cnn:2019'
Set the tag for this year: TAGS = [ ... , story_tags.YEAR_2019]
The following command will guide you through all of the steps required to record, validate, and upload a new recording.
desktop_system_health_story_set
or mobile_system_health_story_set
. Otherwise, use the actual name of the benchmark.# Desktop: tools/perf/update_wpr --story="$NAME" --benchmark-or-story-set="$BSS" auto # Mobile: tools/perf/update_wpr --story="$NAME" --device-id=$ID --benchmark-or-story-set="$BSS" auto
You can run specific steps from the guided process described above with the following commands:
# Desktop: tools/perf/update_wpr --story="$NAME" --benchmark-or-story-set="$BSS" live # Mobile: tools/perf/update_wpr --story="$NAME" --device-id=$ID --benchmark-or-story-set="$BSS" live
# Desktop: tools/perf/update_wpr --story="$NAME" --benchmark-or-story-set="$BSS" record # Mobile: tools/perf/update_wpr --story="$NAME" --device-dd=$ID --benchmark-or-story-set="$BSS" record
If the story requires login, then you need to add SKIP_LOGIN = False
to the story class definition while recording and remove it after recording (crbug.com/882479). In order to make the WPR archive more robust, temporarily add pauses using action_runner.Wait(10)
between the user interactions like page navigation and at the end of the story.
# Desktop: tools/perf/update_wpr --story="$NAME" --benchmark-or-story-set="$BSS" replay # Mobile: tools/perf/update_wpr --story="$NAME" --device-dd=$ID --benchmark-or-story-set="$BSS" replay
Check that the console:error:all metrics have low values and are similar to the live run.
If there are missing files or broken request you can try to manually add static files to the existing archive. Typically you have to ignore requests to ad networks as they include many randomly generated query parameters or domain names, which causes the replay server to miss. Note that this does work well only for static files, as there is currently no way to specify cookies. You will find the $WPR_ARCHIVE in the system_health_{desktop/mobile}.json file. See the catapult instructions on how to install the required go packages.
go run third_party/catapult/web_page_replay_go/src/httparchive.go add "$WPR_ARCHIVE" "$WPR_ARCHIVE" url1 url2...
After updating the archive, go back to the previous replay step and iterate.
# Desktop: tools/perf/update_wpr --story="$NAME" upload # Mobile: tools/perf/update_wpr --story="$NAME" --device-dd=$ID upload
Commit all changes and upload a CL with the following description:
[perf] Add $NAME system health story Bug:878390
Run a pinpoint job and check that there are the same low number of console:error:all
metrics.
# Desktop: tools/perf/update_wpr --story="$NAME" --pageset-repeat=20 pinpoint # Mobile: tools/perf/update_wpr --story="$NAME" --pageset-repeat=20 --device-dd=$ID pinpoint
Or manually test the newly created story by using a pinpoint job
# Desktop Bot: linux-perf Benchmark: system_health.common_desktop Story: $NAME Extra Test Arguments: --pageset-repeat=20 # Mobile Bot: Android Pixel2 Perf Benchmark: system_health.common_mobile Story: $NAME Extra Test Arguments: --pageset-repeat=20
Once the pinpoint jobs finish, check the console:error:* metrics. The task log output will also contain the specific error messages.
If everything looks good, send the CL to browser-perf-engprod@google.com for review.
To run a story on a live site:
# Desktop: ./tools/perf/run_benchmark run system_health.memory_desktop --browser-executable=$(pwd)/out/Release/chrome --browser=exact --output-format=html --show-stdout --reset-results --use-live-sites --story-filter="$NAME" # Mobile: ./tools/perf/run_benchmark run system_health.memory_mobile --browser-executable=$(pwd)/out/Release/apks/ChromePublic.apk --browser=exact --device=$YOUR_DEVICE_ID --output-format=html --show-stdout --reset-results --use-live-sites --story-filter="$NAME"
Adjust the story definition if the run fails and try again.
To record a story:
# Desktop: tools/perf/record_wpr --browser-executable=$(pwd)/out/Release/chrome --story-filter="$NAME" desktop_system_health_story_set # Mobile: tools/perf/record_wpr --device=YOUR_DEVICE_ID --browser-executable=$(pwd)/out/Release/apks/ChromePublic.apk --story-filter="$NAME" mobile_system_health_story_set
In order to reduce HTTP 404 errors, add action_runner.Wait(10)
commands in story interaction before page navigations and the story end.
To test a recording:
To upload a recording:
Look up the wpr version number $NNN in the associated .json file (example - tools/perf/page_sets/data/system_health_desktop.json):
# Desktop: upload_to_google_storage.py --bucket chrome-partner-telemetry tools/perf/page_sets/data/system_health_desktop_${NNN}.wprgo # Mobile: upload_to_google_storage.py --bucket chrome-partner-telemetry tools/perf/page_sets/data/system_health_mobile_${NNN}.wprgo
Running this command will generate a .sha1 file. Add this to your CL.