summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-10-19 19:18:17 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-11-03 11:07:21 +0900
commitfcc6d4bd76874585336cb0bbbd369702b59515d2 (patch)
tree7d35d18c516ef49e39cc8bf9e5c9aabfc7bb7dc2 /utils
parent4757ff4ab7b4dac560cad26db12e28ef741c96ff (diff)
libcamera: tracing: Implement tracing infrastructure
Implement tracing infrastructure in libcamera. It takes .tp files, as required by lttng, and generates a tracepoint header and C file, as lttng requires. meson is updated accordingly to get it to compile with the rest of libcamera. Update the documentation accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/meson.build1
-rw-r--r--utils/tracepoints/gen-tp-header.py38
-rw-r--r--utils/tracepoints/meson.build5
3 files changed, 44 insertions, 0 deletions
diff --git a/utils/meson.build b/utils/meson.build
index 3d83b975..7f2b9b4d 100644
--- a/utils/meson.build
+++ b/utils/meson.build
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: CC0-1.0
subdir('ipu3')
+subdir('tracepoints')
## Code generation
py_modules += ['yaml']
diff --git a/utils/tracepoints/gen-tp-header.py b/utils/tracepoints/gen-tp-header.py
new file mode 100644
index 00000000..bbd472d9
--- /dev/null
+++ b/utils/tracepoints/gen-tp-header.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2020, Google Inc.
+#
+# Author: Paul Elder <paul.elder@ideasonboard.com>
+#
+# gen-tp-header.py - Generate header file to contain lttng tracepoints
+
+import datetime
+import jinja2
+import os
+import sys
+
+def main(argv):
+ if len(argv) < 3:
+ print(f'Usage: {argv[0]} output template tp_files...')
+ return 1
+
+ output = argv[1]
+ template = argv[2]
+
+ year = datetime.datetime.now().year
+ path = output.replace('include/', '', 1)
+
+ source = ''
+ for fname in argv[3:]:
+ source += open(fname, 'r', encoding='utf-8').read() + '\n\n'
+
+ template = jinja2.Template(open(template, 'r', encoding='utf-8').read())
+ string = template.render(year=year, path=path, source=source)
+
+ f = open(output, 'w', encoding='utf-8').write(string)
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/utils/tracepoints/meson.build b/utils/tracepoints/meson.build
new file mode 100644
index 00000000..807230fc
--- /dev/null
+++ b/utils/tracepoints/meson.build
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: CC0-1.0
+
+py_modules += ['jinja2']
+
+gen_tracepoints_header = find_program('./gen-tp-header.py')