diff --git a/infra/bots/recipes/perf_skottietrace.expected/Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing.json b/infra/bots/recipes/perf_skottietrace.expected/Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing.json new file mode 100644 index 0000000000..e31b81f6e2 --- /dev/null +++ b/infra/bots/recipes/perf_skottietrace.expected/Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing.json @@ -0,0 +1,964 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/tmp" + ], + "infra_step": true, + "name": "makedirs tmp_dir" + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/resources" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/resources" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nhost = sys.argv[1]\ndevice = sys.argv[2]\nfor d, _, fs in os.walk(host):\n p = os.path.relpath(d, host)\n if p != '.' and p.startswith('.'):\n continue\n for f in fs:\n print os.path.join(p,f)\n subprocess.check_call(['/opt/infra-android/tools/adb', 'push',\n os.path.realpath(os.path.join(host, p, f)),\n os.path.join(device, p, f)])\n", + "[START_DIR]/skia/resources", + "/sdcard/revenge_of_the_skiabot/resources" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/skia/resources/* /sdcard/revenge_of_the_skiabot/resources", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@host = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@device = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@for d, _, fs in os.walk(host):@@@", + "@@@STEP_LOG_LINE@python.inline@ p = os.path.relpath(d, host)@@@", + "@@@STEP_LOG_LINE@python.inline@ if p != '.' and p.startswith('.'):@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ for f in fs:@@@", + "@@@STEP_LOG_LINE@python.inline@ print os.path.join(p,f)@@@", + "@@@STEP_LOG_LINE@python.inline@ subprocess.check_call(['/opt/infra-android/tools/adb', 'push',@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.realpath(os.path.join(host, p, f)),@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.join(device, p, f)])@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[START_DIR]/skia/infra/bots/assets/lottie-samples/VERSION", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Get lottie-samples VERSION" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "42", + "[START_DIR]/tmp/LOTTIE_VERSION" + ], + "infra_step": true, + "name": "write LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-f", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-rf", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/lotties" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/lotties" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nhost = sys.argv[1]\ndevice = sys.argv[2]\nfor d, _, fs in os.walk(host):\n p = os.path.relpath(d, host)\n if p != '.' and p.startswith('.'):\n continue\n for f in fs:\n print os.path.join(p,f)\n subprocess.check_call(['/opt/infra-android/tools/adb', 'push',\n os.path.realpath(os.path.join(host, p, f)),\n os.path.join(device, p, f)])\n", + "[START_DIR]/lottie-samples", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/lottie-samples/* /sdcard/revenge_of_the_skiabot/lotties", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@host = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@device = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@for d, _, fs in os.walk(host):@@@", + "@@@STEP_LOG_LINE@python.inline@ p = os.path.relpath(d, host)@@@", + "@@@STEP_LOG_LINE@python.inline@ if p != '.' and p.startswith('.'):@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ for f in fs:@@@", + "@@@STEP_LOG_LINE@python.inline@ print os.path.join(p,f)@@@", + "@@@STEP_LOG_LINE@python.inline@ subprocess.check_call(['/opt/infra-android/tools/adb', 'push',@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.realpath(os.path.join(host, p, f)),@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.join(device, p, f)])@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/LOTTIE_VERSION", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/tmp/LOTTIE_VERSION /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-rf", + "/sdcard/revenge_of_the_skiabot/dm_out" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/dm_out" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/dm_out" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/dm_out" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "listdir", + "[START_DIR]/lottie-samples" + ], + "infra_step": true, + "name": "list lottie files", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/LICENSE@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie 3!.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie(test)'!2.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie1.json@@@", + "@@@STEP_LOG_END@listdir@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nimport time\nADB = sys.argv[1]\ncpu = int(sys.argv[2])\ngov = sys.argv[3]\n\nlog = subprocess.check_output([ADB, 'root'])\n# check for message like 'adbd cannot run as root in production builds'\nprint log\nif 'cannot' in log:\n raise Exception('adb root failed')\n\nsubprocess.check_output([ADB, 'shell', 'echo \"%s\" > '\n '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % (gov, cpu)])\nactual_gov = subprocess.check_output([ADB, 'shell', 'cat '\n '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % cpu]).strip()\nif actual_gov != gov:\n raise Exception('(actual, expected) (%s, %s)'\n % (actual_gov, gov))\n", + "/opt/infra-android/tools/adb", + "0", + "hotplug" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "Set CPU 0's governor to hotplug", + "timeout": 30, + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@import time@@@", + "@@@STEP_LOG_LINE@python.inline@ADB = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@cpu = int(sys.argv[2])@@@", + "@@@STEP_LOG_LINE@python.inline@gov = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@log = subprocess.check_output([ADB, 'root'])@@@", + "@@@STEP_LOG_LINE@python.inline@# check for message like 'adbd cannot run as root in production builds'@@@", + "@@@STEP_LOG_LINE@python.inline@print log@@@", + "@@@STEP_LOG_LINE@python.inline@if 'cannot' in log:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('adb root failed')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_output([ADB, 'shell', 'echo \"%s\" > '@@@", + "@@@STEP_LOG_LINE@python.inline@ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % (gov, cpu)])@@@", + "@@@STEP_LOG_LINE@python.inline@actual_gov = subprocess.check_output([ADB, 'shell', 'cat '@@@", + "@@@STEP_LOG_LINE@python.inline@ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % cpu]).strip()@@@", + "@@@STEP_LOG_LINE@python.inline@if actual_gov != gov:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('(actual, expected) (%s, %s)'@@@", + "@@@STEP_LOG_LINE@python.inline@ % (actual_gov, gov))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/build/dm", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/2.json --match \"^lottie 3!.json$\"; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/2.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/2.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie 3!.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie 3!.json trace", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/3.json --match \\^lottie\\(test\\)\\'\\!2\\.json\\$; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh (2)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh (2)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log (2)" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm (2)", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/3.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/3.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie(test)'!2.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie(test)'!2.json trace", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/4.json --match \\^lottie1\\.json\\$; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh (3)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh (3)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log (3)" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm (3)", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/4.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/4.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie1.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie1.json trace", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id (2)", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_TASK_ID', '')\n" + ], + "name": "get swarming task id", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_TASK_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/[SWARM_OUT_DIR]" + ], + "infra_step": true, + "name": "makedirs perf_dir" + }, + { + "cmd": [ + "python", + "-u", + "import json\nwith open('[START_DIR]/[SWARM_OUT_DIR]/perf.json', 'w') as outfile:\n json.dump(obj={'swarming_task_id': '', 'swarming_bot_id': '', 'results': {'gles': {\"lottie(test)'!2.json\": {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie1.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie 3!.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}}, 'key': {'extra_config': 'Android_SkottieTracing', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'Mali400MP2', 'arch': 'arm', 'source_type': 'skottie', 'model': 'AndroidOne', 'configuration': 'Release', 'os': 'Android', 'compiler': 'Clang'}, 'gitHash': 'abc123'}, fp=outfile, indent=4)\n" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "write perf.json", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@with open('[START_DIR]/[SWARM_OUT_DIR]/perf.json', 'w') as outfile:@@@", + "@@@STEP_LOG_LINE@python.inline@ json.dump(obj={'swarming_task_id': '', 'swarming_bot_id': '', 'results': {'gles': {\"lottie(test)'!2.json\": {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie1.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie 3!.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}}, 'key': {'extra_config': 'Android_SkottieTracing', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'Mali400MP2', 'arch': 'arm', 'source_type': 'skottie', 'model': 'AndroidOne', 'configuration': 'Release', 'os': 'Android', 'compiler': 'Clang'}, 'gitHash': 'abc123'}, fp=outfile, indent=4)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nout = sys.argv[1]\nlog = subprocess.check_output(['/opt/infra-android/tools/adb', 'logcat', '-d'])\nfor line in log.split('\\n'):\n tokens = line.split()\n if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc':\n addr, path = tokens[-2:]\n local = os.path.join(out, os.path.basename(path))\n if os.path.exists(local):\n sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr])\n line = line.replace(addr, addr + ' ' + sym.strip())\n print line\n", + "[START_DIR]/build" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "dump log", + "timeout": 300, + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@out = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@log = subprocess.check_output(['/opt/infra-android/tools/adb', 'logcat', '-d'])@@@", + "@@@STEP_LOG_LINE@python.inline@for line in log.split('\\n'):@@@", + "@@@STEP_LOG_LINE@python.inline@ tokens = line.split()@@@", + "@@@STEP_LOG_LINE@python.inline@ if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc':@@@", + "@@@STEP_LOG_LINE@python.inline@ addr, path = tokens[-2:]@@@", + "@@@STEP_LOG_LINE@python.inline@ local = os.path.join(out, os.path.basename(path))@@@", + "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(local):@@@", + "@@@STEP_LOG_LINE@python.inline@ sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr])@@@", + "@@@STEP_LOG_LINE@python.inline@ line = line.replace(addr, addr + ' ' + sym.strip())@@@", + "@@@STEP_LOG_LINE@python.inline@ print line@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "kill-server" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "kill adb server" + }, + { + "jsonResult": null, + "name": "$result" + } +] \ No newline at end of file diff --git a/infra/bots/recipes/perf_skottietrace.expected/skottietracing_parse_trace_error.json b/infra/bots/recipes/perf_skottietrace.expected/skottietracing_parse_trace_error.json new file mode 100644 index 0000000000..a71f126ce0 --- /dev/null +++ b/infra/bots/recipes/perf_skottietrace.expected/skottietracing_parse_trace_error.json @@ -0,0 +1,568 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/tmp" + ], + "infra_step": true, + "name": "makedirs tmp_dir" + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/resources" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/resources" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nhost = sys.argv[1]\ndevice = sys.argv[2]\nfor d, _, fs in os.walk(host):\n p = os.path.relpath(d, host)\n if p != '.' and p.startswith('.'):\n continue\n for f in fs:\n print os.path.join(p,f)\n subprocess.check_call(['/opt/infra-android/tools/adb', 'push',\n os.path.realpath(os.path.join(host, p, f)),\n os.path.join(device, p, f)])\n", + "[START_DIR]/skia/resources", + "/sdcard/revenge_of_the_skiabot/resources" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/skia/resources/* /sdcard/revenge_of_the_skiabot/resources", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@host = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@device = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@for d, _, fs in os.walk(host):@@@", + "@@@STEP_LOG_LINE@python.inline@ p = os.path.relpath(d, host)@@@", + "@@@STEP_LOG_LINE@python.inline@ if p != '.' and p.startswith('.'):@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ for f in fs:@@@", + "@@@STEP_LOG_LINE@python.inline@ print os.path.join(p,f)@@@", + "@@@STEP_LOG_LINE@python.inline@ subprocess.check_call(['/opt/infra-android/tools/adb', 'push',@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.realpath(os.path.join(host, p, f)),@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.join(device, p, f)])@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[START_DIR]/skia/infra/bots/assets/lottie-samples/VERSION", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Get lottie-samples VERSION" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "42", + "[START_DIR]/tmp/LOTTIE_VERSION" + ], + "infra_step": true, + "name": "write LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-f", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-rf", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/lotties" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/lotties" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nhost = sys.argv[1]\ndevice = sys.argv[2]\nfor d, _, fs in os.walk(host):\n p = os.path.relpath(d, host)\n if p != '.' and p.startswith('.'):\n continue\n for f in fs:\n print os.path.join(p,f)\n subprocess.check_call(['/opt/infra-android/tools/adb', 'push',\n os.path.realpath(os.path.join(host, p, f)),\n os.path.join(device, p, f)])\n", + "[START_DIR]/lottie-samples", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/lottie-samples/* /sdcard/revenge_of_the_skiabot/lotties", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@host = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@device = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@for d, _, fs in os.walk(host):@@@", + "@@@STEP_LOG_LINE@python.inline@ p = os.path.relpath(d, host)@@@", + "@@@STEP_LOG_LINE@python.inline@ if p != '.' and p.startswith('.'):@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ for f in fs:@@@", + "@@@STEP_LOG_LINE@python.inline@ print os.path.join(p,f)@@@", + "@@@STEP_LOG_LINE@python.inline@ subprocess.check_call(['/opt/infra-android/tools/adb', 'push',@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.realpath(os.path.join(host, p, f)),@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.join(device, p, f)])@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/LOTTIE_VERSION", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/tmp/LOTTIE_VERSION /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-rf", + "/sdcard/revenge_of_the_skiabot/dm_out" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/dm_out" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/dm_out" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/dm_out" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "listdir", + "[START_DIR]/lottie-samples" + ], + "infra_step": true, + "name": "list lottie files", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/LICENSE@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie 3!.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie(test)'!2.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie1.json@@@", + "@@@STEP_LOG_END@listdir@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nimport time\nADB = sys.argv[1]\ncpu = int(sys.argv[2])\ngov = sys.argv[3]\n\nlog = subprocess.check_output([ADB, 'root'])\n# check for message like 'adbd cannot run as root in production builds'\nprint log\nif 'cannot' in log:\n raise Exception('adb root failed')\n\nsubprocess.check_output([ADB, 'shell', 'echo \"%s\" > '\n '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % (gov, cpu)])\nactual_gov = subprocess.check_output([ADB, 'shell', 'cat '\n '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % cpu]).strip()\nif actual_gov != gov:\n raise Exception('(actual, expected) (%s, %s)'\n % (actual_gov, gov))\n", + "/opt/infra-android/tools/adb", + "0", + "hotplug" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "Set CPU 0's governor to hotplug", + "timeout": 30, + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@import time@@@", + "@@@STEP_LOG_LINE@python.inline@ADB = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@cpu = int(sys.argv[2])@@@", + "@@@STEP_LOG_LINE@python.inline@gov = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@log = subprocess.check_output([ADB, 'root'])@@@", + "@@@STEP_LOG_LINE@python.inline@# check for message like 'adbd cannot run as root in production builds'@@@", + "@@@STEP_LOG_LINE@python.inline@print log@@@", + "@@@STEP_LOG_LINE@python.inline@if 'cannot' in log:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('adb root failed')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_output([ADB, 'shell', 'echo \"%s\" > '@@@", + "@@@STEP_LOG_LINE@python.inline@ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % (gov, cpu)])@@@", + "@@@STEP_LOG_LINE@python.inline@actual_gov = subprocess.check_output([ADB, 'shell', 'cat '@@@", + "@@@STEP_LOG_LINE@python.inline@ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % cpu]).strip()@@@", + "@@@STEP_LOG_LINE@python.inline@if actual_gov != gov:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('(actual, expected) (%s, %s)'@@@", + "@@@STEP_LOG_LINE@python.inline@ % (actual_gov, gov))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/build/dm", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/2.json --match \"^lottie 3!.json$\"; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/2.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/2.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie 3!.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie 3!.json trace", + "~followup_annotations": [ + "step returned non-zero exit code: 1", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@", + "@@@STEP_FAILURE@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nout = sys.argv[1]\nlog = subprocess.check_output(['/opt/infra-android/tools/adb', 'logcat', '-d'])\nfor line in log.split('\\n'):\n tokens = line.split()\n if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc':\n addr, path = tokens[-2:]\n local = os.path.join(out, os.path.basename(path))\n if os.path.exists(local):\n sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr])\n line = line.replace(addr, addr + ' ' + sym.strip())\n print line\n", + "[START_DIR]/build" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "dump log", + "timeout": 300, + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@out = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@log = subprocess.check_output(['/opt/infra-android/tools/adb', 'logcat', '-d'])@@@", + "@@@STEP_LOG_LINE@python.inline@for line in log.split('\\n'):@@@", + "@@@STEP_LOG_LINE@python.inline@ tokens = line.split()@@@", + "@@@STEP_LOG_LINE@python.inline@ if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc':@@@", + "@@@STEP_LOG_LINE@python.inline@ addr, path = tokens[-2:]@@@", + "@@@STEP_LOG_LINE@python.inline@ local = os.path.join(out, os.path.basename(path))@@@", + "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(local):@@@", + "@@@STEP_LOG_LINE@python.inline@ sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr])@@@", + "@@@STEP_LOG_LINE@python.inline@ line = line.replace(addr, addr + ' ' + sym.strip())@@@", + "@@@STEP_LOG_LINE@python.inline@ print line@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "kill-server" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "kill adb server" + }, + { + "failure": { + "failure": { + "step": "parse lottie 3!.json trace" + }, + "humanReason": "Step('parse lottie 3!.json trace') failed with return_code 1" + }, + "name": "$result" + } +] \ No newline at end of file diff --git a/infra/bots/recipes/perf_skottietrace.expected/skottietracing_trybot.json b/infra/bots/recipes/perf_skottietrace.expected/skottietracing_trybot.json new file mode 100644 index 0000000000..5dcdad8228 --- /dev/null +++ b/infra/bots/recipes/perf_skottietrace.expected/skottietracing_trybot.json @@ -0,0 +1,964 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/tmp" + ], + "infra_step": true, + "name": "makedirs tmp_dir" + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/resources" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/resources" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nhost = sys.argv[1]\ndevice = sys.argv[2]\nfor d, _, fs in os.walk(host):\n p = os.path.relpath(d, host)\n if p != '.' and p.startswith('.'):\n continue\n for f in fs:\n print os.path.join(p,f)\n subprocess.check_call(['/opt/infra-android/tools/adb', 'push',\n os.path.realpath(os.path.join(host, p, f)),\n os.path.join(device, p, f)])\n", + "[START_DIR]/skia/resources", + "/sdcard/revenge_of_the_skiabot/resources" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/skia/resources/* /sdcard/revenge_of_the_skiabot/resources", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@host = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@device = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@for d, _, fs in os.walk(host):@@@", + "@@@STEP_LOG_LINE@python.inline@ p = os.path.relpath(d, host)@@@", + "@@@STEP_LOG_LINE@python.inline@ if p != '.' and p.startswith('.'):@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ for f in fs:@@@", + "@@@STEP_LOG_LINE@python.inline@ print os.path.join(p,f)@@@", + "@@@STEP_LOG_LINE@python.inline@ subprocess.check_call(['/opt/infra-android/tools/adb', 'push',@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.realpath(os.path.join(host, p, f)),@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.join(device, p, f)])@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[START_DIR]/skia/infra/bots/assets/lottie-samples/VERSION", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Get lottie-samples VERSION" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "42", + "[START_DIR]/tmp/LOTTIE_VERSION" + ], + "infra_step": true, + "name": "write LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-f", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-rf", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/lotties" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/lotties" + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nhost = sys.argv[1]\ndevice = sys.argv[2]\nfor d, _, fs in os.walk(host):\n p = os.path.relpath(d, host)\n if p != '.' and p.startswith('.'):\n continue\n for f in fs:\n print os.path.join(p,f)\n subprocess.check_call(['/opt/infra-android/tools/adb', 'push',\n os.path.realpath(os.path.join(host, p, f)),\n os.path.join(device, p, f)])\n", + "[START_DIR]/lottie-samples", + "/sdcard/revenge_of_the_skiabot/lotties" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/lottie-samples/* /sdcard/revenge_of_the_skiabot/lotties", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@host = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@device = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@for d, _, fs in os.walk(host):@@@", + "@@@STEP_LOG_LINE@python.inline@ p = os.path.relpath(d, host)@@@", + "@@@STEP_LOG_LINE@python.inline@ if p != '.' and p.startswith('.'):@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ for f in fs:@@@", + "@@@STEP_LOG_LINE@python.inline@ print os.path.join(p,f)@@@", + "@@@STEP_LOG_LINE@python.inline@ subprocess.check_call(['/opt/infra-android/tools/adb', 'push',@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.realpath(os.path.join(host, p, f)),@@@", + "@@@STEP_LOG_LINE@python.inline@ os.path.join(device, p, f)])@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/LOTTIE_VERSION", + "/sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push [START_DIR]/tmp/LOTTIE_VERSION /sdcard/revenge_of_the_skiabot/LOTTIE_VERSION" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "rm", + "-rf", + "/sdcard/revenge_of_the_skiabot/dm_out" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "rm /sdcard/revenge_of_the_skiabot/dm_out" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "mkdir", + "-p", + "/sdcard/revenge_of_the_skiabot/dm_out" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "mkdir /sdcard/revenge_of_the_skiabot/dm_out" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "listdir", + "[START_DIR]/lottie-samples" + ], + "infra_step": true, + "name": "list lottie files", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/LICENSE@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie 3!.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie(test)'!2.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie1.json@@@", + "@@@STEP_LOG_END@listdir@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nimport time\nADB = sys.argv[1]\ncpu = int(sys.argv[2])\ngov = sys.argv[3]\n\nlog = subprocess.check_output([ADB, 'root'])\n# check for message like 'adbd cannot run as root in production builds'\nprint log\nif 'cannot' in log:\n raise Exception('adb root failed')\n\nsubprocess.check_output([ADB, 'shell', 'echo \"%s\" > '\n '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % (gov, cpu)])\nactual_gov = subprocess.check_output([ADB, 'shell', 'cat '\n '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % cpu]).strip()\nif actual_gov != gov:\n raise Exception('(actual, expected) (%s, %s)'\n % (actual_gov, gov))\n", + "/opt/infra-android/tools/adb", + "0", + "hotplug" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "Set CPU 0's governor to hotplug", + "timeout": 30, + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@import time@@@", + "@@@STEP_LOG_LINE@python.inline@ADB = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@cpu = int(sys.argv[2])@@@", + "@@@STEP_LOG_LINE@python.inline@gov = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@log = subprocess.check_output([ADB, 'root'])@@@", + "@@@STEP_LOG_LINE@python.inline@# check for message like 'adbd cannot run as root in production builds'@@@", + "@@@STEP_LOG_LINE@python.inline@print log@@@", + "@@@STEP_LOG_LINE@python.inline@if 'cannot' in log:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('adb root failed')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_output([ADB, 'shell', 'echo \"%s\" > '@@@", + "@@@STEP_LOG_LINE@python.inline@ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % (gov, cpu)])@@@", + "@@@STEP_LOG_LINE@python.inline@actual_gov = subprocess.check_output([ADB, 'shell', 'cat '@@@", + "@@@STEP_LOG_LINE@python.inline@ '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor' % cpu]).strip()@@@", + "@@@STEP_LOG_LINE@python.inline@if actual_gov != gov:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('(actual, expected) (%s, %s)'@@@", + "@@@STEP_LOG_LINE@python.inline@ % (actual_gov, gov))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/build/dm", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/2.json --match \"^lottie 3!.json$\"; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/2.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/2.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie 3!.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie 3!.json trace", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/3.json --match \\^lottie\\(test\\)\\'\\!2\\.json\\$; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh (2)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh (2)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log (2)" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm (2)", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/3.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/3.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie(test)'!2.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie(test)'!2.json trace", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "set -x; /data/local/tmp/dm --resourcePath /sdcard/revenge_of_the_skiabot/resources --lotties /sdcard/revenge_of_the_skiabot/lotties --nocpu --config gles --src lottie --nonativeFonts --verbose --traceMatch skottie --trace /sdcard/revenge_of_the_skiabot/dm_out/4.json --match \\^lottie1\\.json\\$; echo $? >/data/local/tmp/rc", + "[START_DIR]/tmp/dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "write dm.sh (3)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "push", + "[START_DIR]/tmp/dm.sh", + "/data/local/tmp/" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "push dm.sh (3)" + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "logcat", + "-c" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "clear log (3)" + }, + { + "cmd": [ + "python", + "-u", + "\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n", + "/data/local/tmp/", + "dm.sh" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "dm (3)", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['/opt/infra-android/tools/adb', 'shell', 'sh', bin_dir + sh])@@@", + "@@@STEP_LOG_LINE@python.inline@try:@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['/opt/infra-android/tools/adb', 'shell', 'cat',@@@", + "@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@", + "@@@STEP_LOG_LINE@python.inline@except ValueError:@@@", + "@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@", + "@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "shell", + "cat", + "/sdcard/revenge_of_the_skiabot/dm_out/4.json" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "read /sdcard/revenge_of_the_skiabot/dm_out/4.json", + "stdout": "/path/to/tmp/" + }, + { + "cmd": [ + "python", + "-u", + "\nimport json\nimport sys\n\ntrace_output = sys.argv[1]\ntrace_json = json.loads(trace_output)\nlottie_filename = sys.argv[2]\noutput_json_file = sys.argv[3]\n\nperf_results = {}\nframe_max = 0\nframe_min = 0\nframe_cumulative = 0\ncurrent_frame_duration = 0\ntotal_frames = 0\nframe_start = False\nskipped_first_seek = False # Skip the first seek constructor call.\nfor trace in trace_json:\n if 'skottie::Animation::seek' in trace['name']:\n if not skipped_first_seek:\n skipped_first_seek = True\n continue\n if frame_start:\n raise Exception('We got consecutive Animation::seek without a ' +\n 'render. Something is wrong.')\n frame_start = True\n current_frame_duration = trace['dur']\n elif 'skottie::Animation::render' in trace['name']:\n if not frame_start:\n raise Exception('We got an Animation::render without a seek first. ' +\n 'Something is wrong.')\n\n current_frame_duration += trace['dur']\n frame_start = False\n total_frames += 1\n frame_max = max(frame_max, current_frame_duration)\n frame_min = (min(frame_min, current_frame_duration)\n if frame_min else current_frame_duration)\n frame_cumulative += current_frame_duration\n\nexpected_dm_frames = 25\nif total_frames != expected_dm_frames:\n raise Exception(\n 'Got ' + str(total_frames) + ' frames instead of ' +\n str(expected_dm_frames))\nperf_results['frame_max_us'] = frame_max\nperf_results['frame_min_us'] = frame_min\nperf_results['frame_avg_us'] = frame_cumulative/total_frames\n\n# Write perf_results to the output json.\nwith open(output_json_file, 'w') as f:\n f.write(json.dumps(perf_results))\n", + "\n[{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":452,\"dur\":2.57,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPaint(const SkPaint &)\",\"ts\":473,\"dur\":2.67e+03,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.15e+03,\"dur\":2.25,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.15e+03,\"dur\":216,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void SkCanvas::drawPath(const SkPath &, const SkPaint &)\",\"ts\":3.35e+03,\"dur\":15.1,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::seek(SkScalar)\",\"ts\":3.37e+03,\"dur\":1.17,\"tid\":1,\"pid\":0},{\"ph\":\"X\",\"name\":\"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const\",\"ts\":3.37e+03,\"dur\":140,\"tid\":1,\"pid\":0}]\n", + "lottie1.json", + "/path/to/tmp/json" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "parse lottie1.json trace", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_avg_us\": 179.71, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_max_us\": 218.25, @@@", + "@@@STEP_LOG_LINE@json.output@ \"frame_min_us\": 141.17@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@", + "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@", + "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@", + "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@", + "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@", + "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@", + "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@skipped_first_seek = False # Skip the first seek constructor call.@@@", + "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@", + "@@@STEP_LOG_LINE@python.inline@ if 'skottie::Animation::seek' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not skipped_first_seek:@@@", + "@@@STEP_LOG_LINE@python.inline@ skipped_first_seek = True@@@", + "@@@STEP_LOG_LINE@python.inline@ continue@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got consecutive Animation::seek without a ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'render. Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = True@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration = trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ elif 'skottie::Animation::render' in trace['name']:@@@", + "@@@STEP_LOG_LINE@python.inline@ if not frame_start:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception('We got an Animation::render without a seek first. ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Something is wrong.')@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@ current_frame_duration += trace['dur']@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_start = False@@@", + "@@@STEP_LOG_LINE@python.inline@ total_frames += 1@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_max = max(frame_max, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_min = (min(frame_min, current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ if frame_min else current_frame_duration)@@@", + "@@@STEP_LOG_LINE@python.inline@ frame_cumulative += current_frame_duration@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@", + "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@", + "@@@STEP_LOG_LINE@python.inline@ raise Exception(@@@", + "@@@STEP_LOG_LINE@python.inline@ 'Got ' + str(total_frames) + ' frames instead of ' +@@@", + "@@@STEP_LOG_LINE@python.inline@ str(expected_dm_frames))@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@", + "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@", + "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@", + "@@@STEP_LOG_LINE@python.inline@ f.write(json.dumps(perf_results))@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id (2)", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_TASK_ID', '')\n" + ], + "name": "get swarming task id", + "stdout": "/path/to/tmp/", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_TASK_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/[SWARM_OUT_DIR]" + ], + "infra_step": true, + "name": "makedirs perf_dir" + }, + { + "cmd": [ + "python", + "-u", + "import json\nwith open('[START_DIR]/[SWARM_OUT_DIR]/perf.json', 'w') as outfile:\n json.dump(obj={'gitHash': 'abc123', 'results': {'gles': {\"lottie(test)'!2.json\": {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie1.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie 3!.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}}, 'patch_storage': 'gerrit', 'swarming_task_id': '', 'key': {'extra_config': 'Android_SkottieTracing', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'Mali400MP2', 'arch': 'arm', 'source_type': 'skottie', 'model': 'AndroidOne', 'configuration': 'Release', 'os': 'Android', 'compiler': 'Clang'}, 'swarming_bot_id': '', 'patchset': 7, 'issue': 1234}, fp=outfile, indent=4)\n" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "write perf.json", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@with open('[START_DIR]/[SWARM_OUT_DIR]/perf.json', 'w') as outfile:@@@", + "@@@STEP_LOG_LINE@python.inline@ json.dump(obj={'gitHash': 'abc123', 'results': {'gles': {\"lottie(test)'!2.json\": {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie1.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}, 'lottie 3!.json': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}}, 'patch_storage': 'gerrit', 'swarming_task_id': '', 'key': {'extra_config': 'Android_SkottieTracing', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'Mali400MP2', 'arch': 'arm', 'source_type': 'skottie', 'model': 'AndroidOne', 'configuration': 'Release', 'os': 'Android', 'compiler': 'Clang'}, 'swarming_bot_id': '', 'patchset': 7, 'issue': 1234}, fp=outfile, indent=4)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os\nimport subprocess\nimport sys\nout = sys.argv[1]\nlog = subprocess.check_output(['/opt/infra-android/tools/adb', 'logcat', '-d'])\nfor line in log.split('\\n'):\n tokens = line.split()\n if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc':\n addr, path = tokens[-2:]\n local = os.path.join(out, os.path.basename(path))\n if os.path.exists(local):\n sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr])\n line = line.replace(addr, addr + ' ' + sym.strip())\n print line\n", + "[START_DIR]/build" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "dump log", + "timeout": 300, + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@import subprocess@@@", + "@@@STEP_LOG_LINE@python.inline@import sys@@@", + "@@@STEP_LOG_LINE@python.inline@out = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@log = subprocess.check_output(['/opt/infra-android/tools/adb', 'logcat', '-d'])@@@", + "@@@STEP_LOG_LINE@python.inline@for line in log.split('\\n'):@@@", + "@@@STEP_LOG_LINE@python.inline@ tokens = line.split()@@@", + "@@@STEP_LOG_LINE@python.inline@ if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc':@@@", + "@@@STEP_LOG_LINE@python.inline@ addr, path = tokens[-2:]@@@", + "@@@STEP_LOG_LINE@python.inline@ local = os.path.join(out, os.path.basename(path))@@@", + "@@@STEP_LOG_LINE@python.inline@ if os.path.exists(local):@@@", + "@@@STEP_LOG_LINE@python.inline@ sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr])@@@", + "@@@STEP_LOG_LINE@python.inline@ line = line.replace(addr, addr + ' ' + sym.strip())@@@", + "@@@STEP_LOG_LINE@python.inline@ print line@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "/opt/infra-android/tools/adb", + "kill-server" + ], + "cwd": "[START_DIR]/skia", + "env": { + "ADB_VENDOR_KEYS": "/home/chrome-bot/.android/chrome_infrastructure_adbkey", + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "infra_step": true, + "name": "kill adb server" + }, + { + "jsonResult": null, + "name": "$result" + } +] \ No newline at end of file diff --git a/infra/bots/recipes/perf_skottietrace.py b/infra/bots/recipes/perf_skottietrace.py new file mode 100644 index 0000000000..7e4bc33fd5 --- /dev/null +++ b/infra/bots/recipes/perf_skottietrace.py @@ -0,0 +1,314 @@ +# Copyright 2019 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. + +# Recipe which runs DM with trace flag on lottie files and then parses the +# trace output into perf.json files to ingest to perf.skia.org. +# Design doc: go/skottie-tracing + + +import re +import string + + +DEPS = [ + 'flavor', + 'recipe_engine/context', + 'recipe_engine/file', + 'recipe_engine/json', + 'recipe_engine/path', + 'recipe_engine/step', + 'recipe_engine/properties', + 'recipe_engine/python', + 'recipe_engine/raw_io', + 'run', + 'vars', +] + +SEEK_TRACE_NAME = 'skottie::Animation::seek' +RENDER_TRACE_NAME = 'skottie::Animation::render' +EXPECTED_DM_FRAMES = 25 + + +def perf_steps(api): + """Run DM on lottie files with tracing turned on and then parse the output.""" + api.flavor.create_clean_device_dir( + api.flavor.device_dirs.dm_dir) + + lottie_files = api.file.listdir( + 'list lottie files', api.flavor.host_dirs.lotties_dir, + test_data=['lottie1.json', 'lottie(test)\'!2.json', 'lottie 3!.json', + 'LICENSE']) + perf_results = {} + push_dm = True + # Run DM on each lottie file and parse the trace files. + for idx, lottie_file in enumerate(lottie_files): + lottie_filename = api.path.basename(lottie_file) + if not lottie_filename.endswith('.json'): + continue + + trace_output_path = api.flavor.device_dirs.dm_dir + '/%s.json' % (idx + 1) + # See go/skottie-tracing for how these flags were selected. + dm_args = [ + 'dm', + '--resourcePath', api.flavor.device_dirs.resource_dir, + '--lotties', api.flavor.device_dirs.lotties_dir, + '--nocpu', + '--config', 'gles', + '--src', 'lottie', + '--nonativeFonts', + '--verbose', + '--traceMatch', 'skottie', # recipe can OOM without this. + '--trace', trace_output_path, + '--match', get_trace_match(lottie_filename), + ] + api.run(api.flavor.step, 'dm', cmd=dm_args, abort_on_failure=False, + skip_binary_push=not push_dm) + # We already pushed the binary once. No need to waste time by pushing + # the same binary for future runs. + push_dm = False + + trace_test_data = api.properties.get('trace_test_data', '{}') + trace_file_content = api.flavor.read_file_on_device(trace_output_path) + if not trace_file_content and trace_test_data: + trace_file_content = trace_test_data + + perf_results[lottie_filename] = parse_trace( + trace_file_content, lottie_filename, api) + + # Construct contents of perf.json + perf_json = { + 'gitHash': api.properties['revision'], + 'swarming_bot_id': api.vars.swarming_bot_id, + 'swarming_task_id': api.vars.swarming_task_id, + 'key': { + 'bench_type': 'tracing', + 'source_type': 'skottie', + }, + 'results': { + 'gles': perf_results, + }, + } + if api.vars.is_trybot: + perf_json['issue'] = api.vars.issue + perf_json['patchset'] = api.vars.patchset + perf_json['patch_storage'] = api.vars.patch_storage + # Add tokens from the builder name to the key. + reg = re.compile('Perf-(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-GPU-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + 'All(-(?P[A-Za-z0-9_]+)|)') + m = reg.match(api.properties['buildername']) + keys = ['os', 'compiler', 'model', 'cpu_or_gpu_value', 'arch', + 'configuration', 'extra_config'] + for k in keys: + perf_json['key'][k] = m.group(k) + + # Create the perf.json file in perf_data_dir for the Upload task to upload. + api.file.ensure_directory( + 'makedirs perf_dir', + api.flavor.host_dirs.perf_data_dir) + api.run( + api.python.inline, + 'write perf.json', + program="""import json +with open('%s', 'w') as outfile: + json.dump(obj=%s, fp=outfile, indent=4) + """ % (api.flavor.host_dirs.perf_data_dir.join('perf.json'), perf_json)) + + +def get_trace_match(lottie_filename): + """Returns the DM regex to match the specified lottie file name.""" + trace_match = '^%s$' % lottie_filename + if ' ' not in trace_match: + # Punctuation characters confuse DM so escape them. Do not need to do this + # when there is a space in the match because subprocess.list2cmdline + # automatically adds quotes in that case. + for sp_char in string.punctuation: + if sp_char == '\\': + # No need to escape the escape char. + continue + trace_match = trace_match.replace(sp_char, '\%s' % sp_char) + return trace_match + + +def parse_trace(trace_json, lottie_filename, api): + """parse_trace parses the specified trace JSON. + + Parses the trace JSON and calculates the time of a single frame. Frame time is + considered the same as seek time + render time. + Note: The first seek is ignored because it is a constructor call. + + A dictionary is returned that has the following structure: + { + 'frame_max_us': 100, + 'frame_min_us': 90, + 'frame_avg_us': 95, + } + """ + step_result = api.run( + api.python.inline, + 'parse %s trace' % lottie_filename, + program=""" + import json + import sys + + trace_output = sys.argv[1] + trace_json = json.loads(trace_output) + lottie_filename = sys.argv[2] + output_json_file = sys.argv[3] + + perf_results = {} + frame_max = 0 + frame_min = 0 + frame_cumulative = 0 + current_frame_duration = 0 + total_frames = 0 + frame_start = False + skipped_first_seek = False # Skip the first seek constructor call. + for trace in trace_json: + if '%s' in trace['name']: + if not skipped_first_seek: + skipped_first_seek = True + continue + if frame_start: + raise Exception('We got consecutive Animation::seek without a ' + + 'render. Something is wrong.') + frame_start = True + current_frame_duration = trace['dur'] + elif '%s' in trace['name']: + if not frame_start: + raise Exception('We got an Animation::render without a seek first. ' + + 'Something is wrong.') + + current_frame_duration += trace['dur'] + frame_start = False + total_frames += 1 + frame_max = max(frame_max, current_frame_duration) + frame_min = (min(frame_min, current_frame_duration) + if frame_min else current_frame_duration) + frame_cumulative += current_frame_duration + + expected_dm_frames = %d + if total_frames != expected_dm_frames: + raise Exception( + 'Got ' + str(total_frames) + ' frames instead of ' + + str(expected_dm_frames)) + perf_results['frame_max_us'] = frame_max + perf_results['frame_min_us'] = frame_min + perf_results['frame_avg_us'] = frame_cumulative/total_frames + + # Write perf_results to the output json. + with open(output_json_file, 'w') as f: + f.write(json.dumps(perf_results)) + """ % (SEEK_TRACE_NAME, RENDER_TRACE_NAME, EXPECTED_DM_FRAMES), + args=[trace_json, lottie_filename, api.json.output()]) + + # Sanitize float outputs to 2 precision points. + output = dict(step_result.json.output) + output['frame_max_us'] = float("%.2f" % output['frame_max_us']) + output['frame_min_us'] = float("%.2f" % output['frame_min_us']) + output['frame_avg_us'] = float("%.2f" % output['frame_avg_us']) + return output + + +def RunSteps(api): + api.vars.setup() + api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir) + api.flavor.setup() + + with api.context(): + try: + api.flavor.install(resources=True, lotties=True) + perf_steps(api) + finally: + api.flavor.cleanup_steps() + api.run.check_failure() + + +def GenTests(api): + trace_output = """ +[{"ph":"X","name":"void skottie::Animation::seek(SkScalar)","ts":452,"dur":2.57,"tid":1,"pid":0},{"ph":"X","name":"void SkCanvas::drawPaint(const SkPaint &)","ts":473,"dur":2.67e+03,"tid":1,"pid":0},{"ph":"X","name":"void skottie::Animation::seek(SkScalar)","ts":3.15e+03,"dur":2.25,"tid":1,"pid":0},{"ph":"X","name":"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const","ts":3.15e+03,"dur":216,"tid":1,"pid":0},{"ph":"X","name":"void SkCanvas::drawPath(const SkPath &, const SkPaint &)","ts":3.35e+03,"dur":15.1,"tid":1,"pid":0},{"ph":"X","name":"void skottie::Animation::seek(SkScalar)","ts":3.37e+03,"dur":1.17,"tid":1,"pid":0},{"ph":"X","name":"void skottie::Animation::render(SkCanvas *, const SkRect *, RenderFlags) const","ts":3.37e+03,"dur":140,"tid":1,"pid":0}] +""" + dm_json_test_data = """ +{ + "gitHash": "bac53f089dbc473862bc5a2e328ba7600e0ed9c4", + "swarming_bot_id": "skia-rpi-094", + "swarming_task_id": "438f11c0e19eab11", + "key": { + "arch": "arm", + "compiler": "Clang", + "cpu_or_gpu": "GPU", + "cpu_or_gpu_value": "Mali400MP2", + "extra_config": "Android", + "model": "AndroidOne", + "os": "Android" + }, + "results": { + } +} +""" + parse_trace_json = { + 'frame_avg_us': 179.71, + 'frame_min_us': 141.17, + 'frame_max_us': 218.25 + } + buildername = ('Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-' + 'All-Android_SkottieTracing') + yield ( + api.test(buildername) + + api.properties(buildername=buildername, + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + task_id='abc123', + trace_test_data=trace_output, + dm_json_test_data=dm_json_test_data, + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]') + + api.step_data('parse lottie(test)\'!2.json trace', + api.json.output(parse_trace_json)) + + api.step_data('parse lottie1.json trace', + api.json.output(parse_trace_json)) + + api.step_data('parse lottie 3!.json trace', + api.json.output(parse_trace_json)) + ) + yield ( + api.test('skottietracing_parse_trace_error') + + api.properties(buildername=buildername, + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + task_id='abc123', + trace_test_data=trace_output, + dm_json_test_data=dm_json_test_data, + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]') + + api.step_data('parse lottie 3!.json trace', + api.json.output(parse_trace_json), retcode=1) + ) + yield ( + api.test('skottietracing_trybot') + + api.properties(buildername=buildername, + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + task_id='abc123', + trace_test_data=trace_output, + dm_json_test_data=dm_json_test_data, + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]', + patch_ref='89/456789/12', + patch_repo='https://skia.googlesource.com/skia.git', + patch_storage='gerrit', + patch_set=7, + patch_issue=1234, + gerrit_project='skia', + gerrit_url='https://skia-review.googlesource.com/') + + api.step_data('parse lottie(test)\'!2.json trace', + api.json.output(parse_trace_json)) + + api.step_data('parse lottie1.json trace', + api.json.output(parse_trace_json)) + + api.step_data('parse lottie 3!.json trace', + api.json.output(parse_trace_json)) + )