9trace_output = sys.argv[1]
10trace_json = json.loads(trace_output)
11lottie_filename = sys.argv[2]
12output_json_file = sys.argv[3]
13seek_trace_name = sys.argv[4]
14render_trace_name = sys.argv[5]
15expected_dm_frames =
int(sys.argv[6])
21current_frame_duration = 0
24for trace
in trace_json:
25 if seek_trace_name
in trace[
'name']:
27 raise Exception(
'We got consecutive Animation::seek without a ' +
28 'render. Something is wrong.')
30 current_frame_duration = trace[
'dur']
31 elif render_trace_name
in trace[
'name']:
33 raise Exception(
'We got an Animation::render without a seek first. ' +
34 'Something is wrong.')
36 current_frame_duration += trace[
'dur']
39 frame_max =
max(frame_max, current_frame_duration)
40 frame_min = (
min(frame_min, current_frame_duration)
41 if frame_min
else current_frame_duration)
42 frame_cumulative += current_frame_duration
44expected_dm_frames = expected_dm_frames
45if total_frames != expected_dm_frames:
47 'Got ' + str(total_frames) +
' frames instead of ' +
48 str(expected_dm_frames))
49perf_results[
'frame_max_us'] = frame_max
50perf_results[
'frame_min_us'] = frame_min
51perf_results[
'frame_avg_us'] = frame_cumulative/total_frames
54with open(output_json_file,
'w')
as f:
55 f.write(json.dumps(perf_results))
static float max(float r, float g, float b)
static float min(float r, float g, float b)