Commit 2705cdc5 authored by Mikhail Khokhlov's avatar Mikhail Khokhlov Committed by Commit Bot

[tools/perf] Add a build target for the uploader script

The target will wrap the uploader script with path to
trace_processor_shell as an argument. The Perfetto revision
will be determined automatically by the script itself.

This target is intended to be built by perfetto-uploader CI bots.

Bug: 1050517
Change-Id: I57a93f8268181250a85400b5899e845b5cfa9d97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2120427
Commit-Queue: Mikhail Khokhlov <khokhlov@google.com>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754008}
parent fdb1522f
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/util/generate_wrapper.gni")
generate_wrapper("upload_trace_processor") {
data_deps =
[ "//third_party/perfetto/src/trace_processor:trace_processor_shell" ]
executable = "upload_trace_processor.py"
wrapper_script = "$root_build_dir/upload_trace_processor"
executable_args = [
"--path",
"@WrappedPath(./trace_processor_shell)",
]
}
......@@ -5,6 +5,7 @@
import argparse
import os
import subprocess
import sys
# Add tools/perf to sys.path.
......@@ -18,17 +19,29 @@ from core.perfetto_binary_roller import binary_deps_manager
from core.tbmv3 import trace_processor
def main(argv):
def _PerfettoRevision():
perfetto_dir = os.path.join(path_util.GetChromiumSrcDir(), 'third_party',
'perfetto')
revision = subprocess.check_output(
['git', '-C', perfetto_dir, 'rev-parse', 'HEAD'])
return revision.strip()
def main(args):
parser = argparse.ArgumentParser()
parser.add_argument(
'path', help='Path to trace_processor_shell binary.')
'--path', help='Path to trace_processor_shell binary.', required=True)
parser.add_argument(
'revision', help='Perfetto revision.')
args = parser.parse_args()
'--revision',
help=('Perfetto revision. '
'If not supplied, will try to infer from //third_party/perfetto.'))
args = parser.parse_args(args)
revision = args.revision or _PerfettoRevision()
binary_deps_manager.UploadHostBinary(
trace_processor.TP_BINARY_NAME, args.path, args.revision)
binary_deps_manager.UploadHostBinary(trace_processor.TP_BINARY_NAME,
args.path, revision)
if __name__ == '__main__':
sys.exit(main(sys.argv))
sys.exit(main(sys.argv[1:]))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment