summaryrefslogtreecommitdiff
path: root/src/android/jpeg
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-05-19 01:54:53 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-05 16:23:10 +0300
commitf929a2890ccc3d2cf9be0a73fadcc4c9c40ece79 (patch)
tree08e55c6d0b52e21d0fa40dfadd6cceaad3d40b97 /src/android/jpeg
parentcb45af8a9eba68a0da2fa9435a4ce82bbdf80f50 (diff)
cam: Add FrameSink base class
The FrameSink class serves as a base to implement components that consume frames. This allows handling frame sinks in a generic way, independent of their nature. The BufferWrite class will be ported to FrameSink in a second step. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'src/android/jpeg')
0 files changed, 0 insertions, 0 deletions
span> bt2 import statistics as stats import sys # pipeline -> {function -> stack(timestamps)} timestamps = {} # pipeline:function -> samples[] samples = {} def main(argv): parser = argparse.ArgumentParser( description='A simple analysis script to get statistics on time taken for IPA calls') parser.add_argument('-p', '--pipeline', type=str, help='Name of pipeline to filter for') parser.add_argument('trace_path', type=str, help='Path to lttng trace (eg. ~/lttng-traces/demo-20201029-184003)') args = parser.parse_args(argv[1:]) traces = bt2.TraceCollectionMessageIterator(args.trace_path) for msg in traces: if type(msg) is not bt2._EventMessageConst or \ 'pipeline_name' not in msg.event.payload_field or \ (args.pipeline is not None and \ msg.event.payload_field['pipeline_name'] != args.pipeline): continue pipeline = msg.event.payload_field['pipeline_name'] event = msg.event.name func = msg.event.payload_field['function_name'] timestamp_ns = msg.default_clock_snapshot.ns_from_origin if event == 'libcamera:ipa_call_begin': if pipeline not in timestamps: timestamps[pipeline] = {} if func not in timestamps[pipeline]: timestamps[pipeline][func] = [] timestamps[pipeline][func].append(timestamp_ns) if event == 'libcamera:ipa_call_end': ts = timestamps[pipeline][func].pop() key = f'{pipeline}:{func}' if key not in samples: samples[key] = [] samples[key].append(timestamp_ns - ts) # Compute stats rows = [] rows.append(['pipeline:function', 'min', 'max', 'mean', 'stddev']) for k, v in samples.items(): mean = int(stats.mean(v)) stddev = int(stats.stdev(v)) minv = min(v) maxv = max(v) rows.append([k, str(minv), str(maxv), str(mean), str(stddev)]) # Get maximum string width for every column widths = [] for i in range(len(rows[0])): widths.append(max([len(row[i]) for row in rows])) # Print stats table for row in rows: fmt = [row[i].rjust(widths[i]) for i in range(1, 5)] print('{} {} {} {} {}'.format(row[0].ljust(widths[0]), *fmt)) if __name__ == '__main__': sys.exit(main(sys.argv))