1[
2  {
3    "cmd": [
4      "vpython",
5      "-u",
6      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
7      "--json-output",
8      "/path/to/tmp/json",
9      "ensure-directory",
10      "--mode",
11      "0777",
12      "[START_DIR]/tmp"
13    ],
14    "infra_step": true,
15    "name": "makedirs tmp_dir"
16  },
17  {
18    "cmd": [
19      "vpython",
20      "-u",
21      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
22      "--json-output",
23      "/path/to/tmp/json",
24      "copy",
25      "[START_DIR]/skia/infra/bots/assets/lottie-samples/VERSION",
26      "/path/to/tmp/"
27    ],
28    "infra_step": true,
29    "name": "Get lottie-samples VERSION",
30    "~followup_annotations": [
31      "@@@STEP_LOG_LINE@VERSION@42@@@",
32      "@@@STEP_LOG_END@VERSION@@@"
33    ]
34  },
35  {
36    "cmd": [
37      "vpython",
38      "-u",
39      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
40      "--json-output",
41      "/path/to/tmp/json",
42      "copy",
43      "42",
44      "[START_DIR]/tmp/LOTTIE_VERSION"
45    ],
46    "infra_step": true,
47    "name": "write LOTTIE_VERSION",
48    "~followup_annotations": [
49      "@@@STEP_LOG_LINE@LOTTIE_VERSION@42@@@",
50      "@@@STEP_LOG_END@LOTTIE_VERSION@@@"
51    ]
52  },
53  {
54    "cmd": [
55      "vpython",
56      "-u",
57      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
58      "--json-output",
59      "/path/to/tmp/json",
60      "rmtree",
61      "[START_DIR]/[SWARM_OUT_DIR]"
62    ],
63    "infra_step": true,
64    "name": "rmtree [SWARM_OUT_DIR]"
65  },
66  {
67    "cmd": [
68      "vpython",
69      "-u",
70      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
71      "--json-output",
72      "/path/to/tmp/json",
73      "ensure-directory",
74      "--mode",
75      "0777",
76      "[START_DIR]/[SWARM_OUT_DIR]"
77    ],
78    "infra_step": true,
79    "name": "makedirs [SWARM_OUT_DIR]"
80  },
81  {
82    "cmd": [
83      "vpython",
84      "-u",
85      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
86      "--json-output",
87      "/path/to/tmp/json",
88      "listdir",
89      "[START_DIR]/lottie-samples"
90    ],
91    "infra_step": true,
92    "name": "list lottie files",
93    "~followup_annotations": [
94      "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/LICENSE@@@",
95      "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie 3!.json@@@",
96      "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie(test)'!2.json@@@",
97      "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie1.json@@@",
98      "@@@STEP_LOG_END@listdir@@@"
99    ]
100  },
101  {
102    "cmd": [
103      "python",
104      "-u",
105      "RECIPE_MODULE[skia::flavor]/resources/symbolize_stack_trace.py",
106      "[START_DIR]",
107      "catchsegv",
108      "[START_DIR]/build/dm",
109      "--resourcePath",
110      "[START_DIR]/skia/resources",
111      "--lotties",
112      "[START_DIR]/lottie-samples",
113      "--src",
114      "lottie",
115      "--nonativeFonts",
116      "--verbose",
117      "--traceMatch",
118      "skottie",
119      "--trace",
120      "[START_DIR]/[SWARM_OUT_DIR]/2.json",
121      "--match",
122      "^lottie 3!.json$",
123      "--config",
124      "gles",
125      "--nocpu"
126    ],
127    "cwd": "[START_DIR]/skia",
128    "env": {
129      "CHROME_HEADLESS": "1",
130      "LD_LIBRARY_PATH": "[START_DIR]/mesa_intel_driver_linux",
131      "LIBGL_DRIVERS_PATH": "[START_DIR]/mesa_intel_driver_linux",
132      "PATH": "<PATH>:RECIPE_REPO[depot_tools]",
133      "VK_ICD_FILENAMES": "[START_DIR]/mesa_intel_driver_linux/intel_icd.x86_64.json"
134    },
135    "name": "symbolized dm"
136  },
137  {
138    "cmd": [
139      "vpython",
140      "-u",
141      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
142      "--json-output",
143      "/path/to/tmp/json",
144      "copy",
145      "[START_DIR]/[SWARM_OUT_DIR]/2.json",
146      "/path/to/tmp/"
147    ],
148    "infra_step": true,
149    "name": "read [START_DIR]/[SWARM_OUT_DIR]/2.json",
150    "~followup_annotations": [
151      "@@@STEP_LOG_END@2.json@@@"
152    ]
153  },
154  {
155    "cmd": [
156      "python",
157      "-u",
158      "\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\nfor trace in trace_json:\n  if 'skottie::Animation::seek' in trace['name']:\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",
159      "\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",
160      "lottie 3!.json",
161      "/path/to/tmp/json"
162    ],
163    "env": {
164      "CHROME_HEADLESS": "1",
165      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
166    },
167    "name": "parse lottie 3!.json trace",
168    "~followup_annotations": [
169      "@@@STEP_LOG_LINE@json.output@{@@@",
170      "@@@STEP_LOG_LINE@json.output@  \"frame_avg_us\": 179.71, @@@",
171      "@@@STEP_LOG_LINE@json.output@  \"frame_max_us\": 218.25, @@@",
172      "@@@STEP_LOG_LINE@json.output@  \"frame_min_us\": 141.17@@@",
173      "@@@STEP_LOG_LINE@json.output@}@@@",
174      "@@@STEP_LOG_END@json.output@@@",
175      "@@@STEP_LOG_LINE@python.inline@@@@",
176      "@@@STEP_LOG_LINE@python.inline@import json@@@",
177      "@@@STEP_LOG_LINE@python.inline@import sys@@@",
178      "@@@STEP_LOG_LINE@python.inline@@@@",
179      "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@",
180      "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@",
181      "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@",
182      "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@",
183      "@@@STEP_LOG_LINE@python.inline@@@@",
184      "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@",
185      "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@",
186      "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@",
187      "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@",
188      "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@",
189      "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@",
190      "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@",
191      "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@",
192      "@@@STEP_LOG_LINE@python.inline@  if 'skottie::Animation::seek' in trace['name']:@@@",
193      "@@@STEP_LOG_LINE@python.inline@    if frame_start:@@@",
194      "@@@STEP_LOG_LINE@python.inline@      raise Exception('We got consecutive Animation::seek without a ' +@@@",
195      "@@@STEP_LOG_LINE@python.inline@                      'render. Something is wrong.')@@@",
196      "@@@STEP_LOG_LINE@python.inline@    frame_start = True@@@",
197      "@@@STEP_LOG_LINE@python.inline@    current_frame_duration = trace['dur']@@@",
198      "@@@STEP_LOG_LINE@python.inline@  elif 'skottie::Animation::render' in trace['name']:@@@",
199      "@@@STEP_LOG_LINE@python.inline@    if not frame_start:@@@",
200      "@@@STEP_LOG_LINE@python.inline@      raise Exception('We got an Animation::render without a seek first. ' +@@@",
201      "@@@STEP_LOG_LINE@python.inline@                      'Something is wrong.')@@@",
202      "@@@STEP_LOG_LINE@python.inline@@@@",
203      "@@@STEP_LOG_LINE@python.inline@    current_frame_duration += trace['dur']@@@",
204      "@@@STEP_LOG_LINE@python.inline@    frame_start = False@@@",
205      "@@@STEP_LOG_LINE@python.inline@    total_frames += 1@@@",
206      "@@@STEP_LOG_LINE@python.inline@    frame_max = max(frame_max, current_frame_duration)@@@",
207      "@@@STEP_LOG_LINE@python.inline@    frame_min = (min(frame_min, current_frame_duration)@@@",
208      "@@@STEP_LOG_LINE@python.inline@                 if frame_min else current_frame_duration)@@@",
209      "@@@STEP_LOG_LINE@python.inline@    frame_cumulative += current_frame_duration@@@",
210      "@@@STEP_LOG_LINE@python.inline@@@@",
211      "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@",
212      "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@",
213      "@@@STEP_LOG_LINE@python.inline@  raise Exception(@@@",
214      "@@@STEP_LOG_LINE@python.inline@      'Got ' + str(total_frames) + ' frames instead of ' +@@@",
215      "@@@STEP_LOG_LINE@python.inline@      str(expected_dm_frames))@@@",
216      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@",
217      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@",
218      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@",
219      "@@@STEP_LOG_LINE@python.inline@@@@",
220      "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@",
221      "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@",
222      "@@@STEP_LOG_LINE@python.inline@  f.write(json.dumps(perf_results))@@@",
223      "@@@STEP_LOG_END@python.inline@@@"
224    ]
225  },
226  {
227    "cmd": [
228      "vpython",
229      "-u",
230      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
231      "--json-output",
232      "/path/to/tmp/json",
233      "remove",
234      "[START_DIR]/[SWARM_OUT_DIR]/2.json"
235    ],
236    "infra_step": true,
237    "name": "remove [START_DIR]/[SWARM_OUT_DIR]/2.json"
238  },
239  {
240    "cmd": [
241      "python",
242      "-u",
243      "RECIPE_MODULE[skia::flavor]/resources/symbolize_stack_trace.py",
244      "[START_DIR]",
245      "catchsegv",
246      "[START_DIR]/build/dm",
247      "--resourcePath",
248      "[START_DIR]/skia/resources",
249      "--lotties",
250      "[START_DIR]/lottie-samples",
251      "--src",
252      "lottie",
253      "--nonativeFonts",
254      "--verbose",
255      "--traceMatch",
256      "skottie",
257      "--trace",
258      "[START_DIR]/[SWARM_OUT_DIR]/3.json",
259      "--match",
260      "^lottie(test)'!2.json$",
261      "--config",
262      "gles",
263      "--nocpu"
264    ],
265    "cwd": "[START_DIR]/skia",
266    "env": {
267      "CHROME_HEADLESS": "1",
268      "LD_LIBRARY_PATH": "[START_DIR]/mesa_intel_driver_linux",
269      "LIBGL_DRIVERS_PATH": "[START_DIR]/mesa_intel_driver_linux",
270      "PATH": "<PATH>:RECIPE_REPO[depot_tools]",
271      "VK_ICD_FILENAMES": "[START_DIR]/mesa_intel_driver_linux/intel_icd.x86_64.json"
272    },
273    "name": "symbolized dm (2)"
274  },
275  {
276    "cmd": [
277      "vpython",
278      "-u",
279      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
280      "--json-output",
281      "/path/to/tmp/json",
282      "copy",
283      "[START_DIR]/[SWARM_OUT_DIR]/3.json",
284      "/path/to/tmp/"
285    ],
286    "infra_step": true,
287    "name": "read [START_DIR]/[SWARM_OUT_DIR]/3.json",
288    "~followup_annotations": [
289      "@@@STEP_LOG_END@3.json@@@"
290    ]
291  },
292  {
293    "cmd": [
294      "python",
295      "-u",
296      "\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\nfor trace in trace_json:\n  if 'skottie::Animation::seek' in trace['name']:\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",
297      "\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",
298      "lottie(test)'!2.json",
299      "/path/to/tmp/json"
300    ],
301    "env": {
302      "CHROME_HEADLESS": "1",
303      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
304    },
305    "name": "parse lottie(test)'!2.json trace",
306    "~followup_annotations": [
307      "@@@STEP_LOG_LINE@json.output@{@@@",
308      "@@@STEP_LOG_LINE@json.output@  \"frame_avg_us\": 179.71, @@@",
309      "@@@STEP_LOG_LINE@json.output@  \"frame_max_us\": 218.25, @@@",
310      "@@@STEP_LOG_LINE@json.output@  \"frame_min_us\": 141.17@@@",
311      "@@@STEP_LOG_LINE@json.output@}@@@",
312      "@@@STEP_LOG_END@json.output@@@",
313      "@@@STEP_LOG_LINE@python.inline@@@@",
314      "@@@STEP_LOG_LINE@python.inline@import json@@@",
315      "@@@STEP_LOG_LINE@python.inline@import sys@@@",
316      "@@@STEP_LOG_LINE@python.inline@@@@",
317      "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@",
318      "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@",
319      "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@",
320      "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@",
321      "@@@STEP_LOG_LINE@python.inline@@@@",
322      "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@",
323      "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@",
324      "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@",
325      "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@",
326      "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@",
327      "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@",
328      "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@",
329      "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@",
330      "@@@STEP_LOG_LINE@python.inline@  if 'skottie::Animation::seek' in trace['name']:@@@",
331      "@@@STEP_LOG_LINE@python.inline@    if frame_start:@@@",
332      "@@@STEP_LOG_LINE@python.inline@      raise Exception('We got consecutive Animation::seek without a ' +@@@",
333      "@@@STEP_LOG_LINE@python.inline@                      'render. Something is wrong.')@@@",
334      "@@@STEP_LOG_LINE@python.inline@    frame_start = True@@@",
335      "@@@STEP_LOG_LINE@python.inline@    current_frame_duration = trace['dur']@@@",
336      "@@@STEP_LOG_LINE@python.inline@  elif 'skottie::Animation::render' in trace['name']:@@@",
337      "@@@STEP_LOG_LINE@python.inline@    if not frame_start:@@@",
338      "@@@STEP_LOG_LINE@python.inline@      raise Exception('We got an Animation::render without a seek first. ' +@@@",
339      "@@@STEP_LOG_LINE@python.inline@                      'Something is wrong.')@@@",
340      "@@@STEP_LOG_LINE@python.inline@@@@",
341      "@@@STEP_LOG_LINE@python.inline@    current_frame_duration += trace['dur']@@@",
342      "@@@STEP_LOG_LINE@python.inline@    frame_start = False@@@",
343      "@@@STEP_LOG_LINE@python.inline@    total_frames += 1@@@",
344      "@@@STEP_LOG_LINE@python.inline@    frame_max = max(frame_max, current_frame_duration)@@@",
345      "@@@STEP_LOG_LINE@python.inline@    frame_min = (min(frame_min, current_frame_duration)@@@",
346      "@@@STEP_LOG_LINE@python.inline@                 if frame_min else current_frame_duration)@@@",
347      "@@@STEP_LOG_LINE@python.inline@    frame_cumulative += current_frame_duration@@@",
348      "@@@STEP_LOG_LINE@python.inline@@@@",
349      "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@",
350      "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@",
351      "@@@STEP_LOG_LINE@python.inline@  raise Exception(@@@",
352      "@@@STEP_LOG_LINE@python.inline@      'Got ' + str(total_frames) + ' frames instead of ' +@@@",
353      "@@@STEP_LOG_LINE@python.inline@      str(expected_dm_frames))@@@",
354      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@",
355      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@",
356      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@",
357      "@@@STEP_LOG_LINE@python.inline@@@@",
358      "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@",
359      "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@",
360      "@@@STEP_LOG_LINE@python.inline@  f.write(json.dumps(perf_results))@@@",
361      "@@@STEP_LOG_END@python.inline@@@"
362    ]
363  },
364  {
365    "cmd": [
366      "vpython",
367      "-u",
368      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
369      "--json-output",
370      "/path/to/tmp/json",
371      "remove",
372      "[START_DIR]/[SWARM_OUT_DIR]/3.json"
373    ],
374    "infra_step": true,
375    "name": "remove [START_DIR]/[SWARM_OUT_DIR]/3.json"
376  },
377  {
378    "cmd": [
379      "python",
380      "-u",
381      "RECIPE_MODULE[skia::flavor]/resources/symbolize_stack_trace.py",
382      "[START_DIR]",
383      "catchsegv",
384      "[START_DIR]/build/dm",
385      "--resourcePath",
386      "[START_DIR]/skia/resources",
387      "--lotties",
388      "[START_DIR]/lottie-samples",
389      "--src",
390      "lottie",
391      "--nonativeFonts",
392      "--verbose",
393      "--traceMatch",
394      "skottie",
395      "--trace",
396      "[START_DIR]/[SWARM_OUT_DIR]/4.json",
397      "--match",
398      "^lottie1.json$",
399      "--config",
400      "gles",
401      "--nocpu"
402    ],
403    "cwd": "[START_DIR]/skia",
404    "env": {
405      "CHROME_HEADLESS": "1",
406      "LD_LIBRARY_PATH": "[START_DIR]/mesa_intel_driver_linux",
407      "LIBGL_DRIVERS_PATH": "[START_DIR]/mesa_intel_driver_linux",
408      "PATH": "<PATH>:RECIPE_REPO[depot_tools]",
409      "VK_ICD_FILENAMES": "[START_DIR]/mesa_intel_driver_linux/intel_icd.x86_64.json"
410    },
411    "name": "symbolized dm (3)"
412  },
413  {
414    "cmd": [
415      "vpython",
416      "-u",
417      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
418      "--json-output",
419      "/path/to/tmp/json",
420      "copy",
421      "[START_DIR]/[SWARM_OUT_DIR]/4.json",
422      "/path/to/tmp/"
423    ],
424    "infra_step": true,
425    "name": "read [START_DIR]/[SWARM_OUT_DIR]/4.json",
426    "~followup_annotations": [
427      "@@@STEP_LOG_END@4.json@@@"
428    ]
429  },
430  {
431    "cmd": [
432      "python",
433      "-u",
434      "\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\nfor trace in trace_json:\n  if 'skottie::Animation::seek' in trace['name']:\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",
435      "\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",
436      "lottie1.json",
437      "/path/to/tmp/json"
438    ],
439    "env": {
440      "CHROME_HEADLESS": "1",
441      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
442    },
443    "name": "parse lottie1.json trace",
444    "~followup_annotations": [
445      "@@@STEP_LOG_LINE@json.output@{@@@",
446      "@@@STEP_LOG_LINE@json.output@  \"frame_avg_us\": 179.71, @@@",
447      "@@@STEP_LOG_LINE@json.output@  \"frame_max_us\": 218.25, @@@",
448      "@@@STEP_LOG_LINE@json.output@  \"frame_min_us\": 141.17@@@",
449      "@@@STEP_LOG_LINE@json.output@}@@@",
450      "@@@STEP_LOG_END@json.output@@@",
451      "@@@STEP_LOG_LINE@python.inline@@@@",
452      "@@@STEP_LOG_LINE@python.inline@import json@@@",
453      "@@@STEP_LOG_LINE@python.inline@import sys@@@",
454      "@@@STEP_LOG_LINE@python.inline@@@@",
455      "@@@STEP_LOG_LINE@python.inline@trace_output = sys.argv[1]@@@",
456      "@@@STEP_LOG_LINE@python.inline@trace_json = json.loads(trace_output)@@@",
457      "@@@STEP_LOG_LINE@python.inline@lottie_filename = sys.argv[2]@@@",
458      "@@@STEP_LOG_LINE@python.inline@output_json_file = sys.argv[3]@@@",
459      "@@@STEP_LOG_LINE@python.inline@@@@",
460      "@@@STEP_LOG_LINE@python.inline@perf_results = {}@@@",
461      "@@@STEP_LOG_LINE@python.inline@frame_max = 0@@@",
462      "@@@STEP_LOG_LINE@python.inline@frame_min = 0@@@",
463      "@@@STEP_LOG_LINE@python.inline@frame_cumulative = 0@@@",
464      "@@@STEP_LOG_LINE@python.inline@current_frame_duration = 0@@@",
465      "@@@STEP_LOG_LINE@python.inline@total_frames = 0@@@",
466      "@@@STEP_LOG_LINE@python.inline@frame_start = False@@@",
467      "@@@STEP_LOG_LINE@python.inline@for trace in trace_json:@@@",
468      "@@@STEP_LOG_LINE@python.inline@  if 'skottie::Animation::seek' in trace['name']:@@@",
469      "@@@STEP_LOG_LINE@python.inline@    if frame_start:@@@",
470      "@@@STEP_LOG_LINE@python.inline@      raise Exception('We got consecutive Animation::seek without a ' +@@@",
471      "@@@STEP_LOG_LINE@python.inline@                      'render. Something is wrong.')@@@",
472      "@@@STEP_LOG_LINE@python.inline@    frame_start = True@@@",
473      "@@@STEP_LOG_LINE@python.inline@    current_frame_duration = trace['dur']@@@",
474      "@@@STEP_LOG_LINE@python.inline@  elif 'skottie::Animation::render' in trace['name']:@@@",
475      "@@@STEP_LOG_LINE@python.inline@    if not frame_start:@@@",
476      "@@@STEP_LOG_LINE@python.inline@      raise Exception('We got an Animation::render without a seek first. ' +@@@",
477      "@@@STEP_LOG_LINE@python.inline@                      'Something is wrong.')@@@",
478      "@@@STEP_LOG_LINE@python.inline@@@@",
479      "@@@STEP_LOG_LINE@python.inline@    current_frame_duration += trace['dur']@@@",
480      "@@@STEP_LOG_LINE@python.inline@    frame_start = False@@@",
481      "@@@STEP_LOG_LINE@python.inline@    total_frames += 1@@@",
482      "@@@STEP_LOG_LINE@python.inline@    frame_max = max(frame_max, current_frame_duration)@@@",
483      "@@@STEP_LOG_LINE@python.inline@    frame_min = (min(frame_min, current_frame_duration)@@@",
484      "@@@STEP_LOG_LINE@python.inline@                 if frame_min else current_frame_duration)@@@",
485      "@@@STEP_LOG_LINE@python.inline@    frame_cumulative += current_frame_duration@@@",
486      "@@@STEP_LOG_LINE@python.inline@@@@",
487      "@@@STEP_LOG_LINE@python.inline@expected_dm_frames = 25@@@",
488      "@@@STEP_LOG_LINE@python.inline@if total_frames != expected_dm_frames:@@@",
489      "@@@STEP_LOG_LINE@python.inline@  raise Exception(@@@",
490      "@@@STEP_LOG_LINE@python.inline@      'Got ' + str(total_frames) + ' frames instead of ' +@@@",
491      "@@@STEP_LOG_LINE@python.inline@      str(expected_dm_frames))@@@",
492      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_max_us'] = frame_max@@@",
493      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_min_us'] = frame_min@@@",
494      "@@@STEP_LOG_LINE@python.inline@perf_results['frame_avg_us'] = frame_cumulative/total_frames@@@",
495      "@@@STEP_LOG_LINE@python.inline@@@@",
496      "@@@STEP_LOG_LINE@python.inline@# Write perf_results to the output json.@@@",
497      "@@@STEP_LOG_LINE@python.inline@with open(output_json_file, 'w') as f:@@@",
498      "@@@STEP_LOG_LINE@python.inline@  f.write(json.dumps(perf_results))@@@",
499      "@@@STEP_LOG_END@python.inline@@@"
500    ]
501  },
502  {
503    "cmd": [
504      "vpython",
505      "-u",
506      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
507      "--json-output",
508      "/path/to/tmp/json",
509      "remove",
510      "[START_DIR]/[SWARM_OUT_DIR]/4.json"
511    ],
512    "infra_step": true,
513    "name": "remove [START_DIR]/[SWARM_OUT_DIR]/4.json"
514  },
515  {
516    "cmd": [
517      "python",
518      "-u",
519      "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n"
520    ],
521    "name": "get swarming bot id",
522    "~followup_annotations": [
523      "@@@STEP_LOG_LINE@python.inline@import os@@@",
524      "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@",
525      "@@@STEP_LOG_END@python.inline@@@"
526    ]
527  },
528  {
529    "cmd": [
530      "python",
531      "-u",
532      "import os\nprint os.environ.get('SWARMING_TASK_ID', '')\n"
533    ],
534    "name": "get swarming task id",
535    "~followup_annotations": [
536      "@@@STEP_LOG_LINE@python.inline@import os@@@",
537      "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_TASK_ID', '')@@@",
538      "@@@STEP_LOG_END@python.inline@@@"
539    ]
540  },
541  {
542    "cmd": [
543      "vpython",
544      "-u",
545      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
546      "--json-output",
547      "/path/to/tmp/json",
548      "ensure-directory",
549      "--mode",
550      "0777",
551      "[START_DIR]/[SWARM_OUT_DIR]"
552    ],
553    "infra_step": true,
554    "name": "makedirs perf_dir"
555  },
556  {
557    "cmd": [
558      "python",
559      "-u",
560      "import json\nwith open('[START_DIR]/[SWARM_OUT_DIR]/perf_abc123_1337000001.json', 'w') as outfile:\n  json.dump(obj={'gitHash': 'abc123', 'results': {\"lottie(test)'!2.json\": {'gles': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}, 'lottie1.json': {'gles': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}, 'lottie 3!.json': {'gles': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}}, 'swarming_task_id': '', 'renderer': 'skottie', 'key': {'extra_config': 'SkottieTracing', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'IntelIris640', 'arch': 'x86_64', 'source_type': 'skottie', 'cpu_or_gpu': 'GPU', 'model': 'NUC7i5BNK', 'configuration': 'Release', 'os': 'Debian10', 'compiler': 'Clang'}, 'swarming_bot_id': ''}, fp=outfile, indent=4)\n"
561    ],
562    "env": {
563      "CHROME_HEADLESS": "1",
564      "PATH": "<PATH>:RECIPE_REPO[depot_tools]"
565    },
566    "name": "write output JSON",
567    "~followup_annotations": [
568      "@@@STEP_LOG_LINE@python.inline@import json@@@",
569      "@@@STEP_LOG_LINE@python.inline@with open('[START_DIR]/[SWARM_OUT_DIR]/perf_abc123_1337000001.json', 'w') as outfile:@@@",
570      "@@@STEP_LOG_LINE@python.inline@  json.dump(obj={'gitHash': 'abc123', 'results': {\"lottie(test)'!2.json\": {'gles': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}, 'lottie1.json': {'gles': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}, 'lottie 3!.json': {'gles': {'frame_avg_us': 179.71, 'frame_max_us': 218.25, 'frame_min_us': 141.17}}}, 'swarming_task_id': '', 'renderer': 'skottie', 'key': {'extra_config': 'SkottieTracing', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'IntelIris640', 'arch': 'x86_64', 'source_type': 'skottie', 'cpu_or_gpu': 'GPU', 'model': 'NUC7i5BNK', 'configuration': 'Release', 'os': 'Debian10', 'compiler': 'Clang'}, 'swarming_bot_id': ''}, fp=outfile, indent=4)@@@",
571      "@@@STEP_LOG_END@python.inline@@@"
572    ]
573  },
574  {
575    "name": "$result"
576  }
577]