Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGc311424ea579: catapult: add a bit more documentation on how to use catapult tracing
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | contrib/catapipe.py (10 lines) | |||
M | tests/run-tests.py (1 line) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Kyle Lippincott | Nov 1 2018, 7:51 PM |
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# | # | ||||
# Copyright 2018 Google LLC. | # Copyright 2018 Google LLC. | ||||
# | # | ||||
# This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
# GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
"""Tool read primitive events from a pipe to produce a catapult trace. | """Tool read primitive events from a pipe to produce a catapult trace. | ||||
Usage: | |||||
Terminal 1: $ catapipe.py /tmp/mypipe /tmp/trace.json | |||||
Terminal 2: $ HGCATAPULTSERVERPIPE=/tmp/mypipe hg root | |||||
<ctrl-c catapipe.py in Terminal 1> | |||||
$ catapult/tracing/bin/trace2html /tmp/trace.json # produce /tmp/trace.html | |||||
<open trace.html in your browser of choice; the WASD keys are very useful> | |||||
(catapult is located at https://github.com/catapult-project/catapult) | |||||
For now the event stream supports | For now the event stream supports | ||||
START $SESSIONID ... | START $SESSIONID ... | ||||
and | and | ||||
END $SESSIONID ... | END $SESSIONID ... | ||||
events. Everything after the SESSIONID (which must not contain spaces) | events. Everything after the SESSIONID (which must not contain spaces) | ||||
is used as a label for the event. Events are timestamped as of when | is used as a label for the event. Events are timestamped as of when | ||||
they arrive in this process and are then used to produce catapult | they arrive in this process and are then used to produce catapult | ||||
traces that can be loaded in Chrome's about:tracing utility. It's | traces that can be loaded in Chrome's about:tracing utility. It's | ||||
important that the event stream *into* this process stay simple, | important that the event stream *into* this process stay simple, | ||||
because we have to emit it from the shell scripts produced by | because we have to emit it from the shell scripts produced by | ||||
run-tests.py. | run-tests.py. | ||||
Typically you'll want to place the path to the named pipe in the | Typically you'll want to place the path to the named pipe in the | ||||
HGCATAPULTSERVERPIPE environment variable, which both run-tests and hg | HGCATAPULTSERVERPIPE environment variable, which both run-tests and hg | ||||
understand. | understand. To trace *only* run-tests, use HGTESTCATAPULTSERVERPIPE instead. | ||||
""" | """ | ||||
from __future__ import absolute_import, print_function | from __future__ import absolute_import, print_function | ||||
import argparse | import argparse | ||||
import json | import json | ||||
import os | import os | ||||
import timeit | import timeit | ||||
env["HGEDITOR"] = ('"' + sys.executable + '"' | env["HGEDITOR"] = ('"' + sys.executable + '"' | ||||
+ ' -c "import sys; sys.exit(0)"') | + ' -c "import sys; sys.exit(0)"') | ||||
env["HGMERGE"] = "internal:merge" | env["HGMERGE"] = "internal:merge" | ||||
env["HGUSER"] = "test" | env["HGUSER"] = "test" | ||||
env["HGENCODING"] = "ascii" | env["HGENCODING"] = "ascii" | ||||
env["HGENCODINGMODE"] = "strict" | env["HGENCODINGMODE"] = "strict" | ||||
env["HGHOSTNAME"] = "test-hostname" | env["HGHOSTNAME"] = "test-hostname" | ||||
env['HGIPV6'] = str(int(self._useipv6)) | env['HGIPV6'] = str(int(self._useipv6)) | ||||
# See contrib/catapipe.py for how to use this functionality. | |||||
if 'HGTESTCATAPULTSERVERPIPE' not in env: | if 'HGTESTCATAPULTSERVERPIPE' not in env: | ||||
# If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the | # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the | ||||
# non-test one in as a default, otherwise set to devnull | # non-test one in as a default, otherwise set to devnull | ||||
env['HGTESTCATAPULTSERVERPIPE'] = \ | env['HGTESTCATAPULTSERVERPIPE'] = \ | ||||
env.get('HGCATAPULTSERVERPIPE', os.devnull) | env.get('HGCATAPULTSERVERPIPE', os.devnull) | ||||
extraextensions = [] | extraextensions = [] | ||||
for opt in self._extraconfigopts: | for opt in self._extraconfigopts: |