[libcamera-devel] [PATCH 2/2] utils: ipc: Generate IPA tracepoints
Paul Elder
paul.elder at ideasonboard.com
Fri Mar 5 07:37:42 CET 2021
Generate ipa_call_begin and ipa_recv tracepoints. ipa_call_begin
tracepoints are planted where an IPA call is made, or when an IPA emits
a signal to the pipeline handler. ipa_recv tracepoints are planted in
the callback function on both the pipeline handler and IPA, inside the
switch-case so that the command can be obtained.
ipa_call_end is not used, as we don't have a way to automatically figure
out which IPA response corresponds to which IPA call. This means the
analyzer script will not yet be useful.
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
src/libcamera/proxy/worker/meson.build | 2 +-
.../generators/libcamera_templates/module_ipa_proxy.cpp.tmpl | 3 +++
.../libcamera_templates/module_ipa_proxy_worker.cpp.tmpl | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build
index 3796103e..a3f69354 100644
--- a/src/libcamera/proxy/worker/meson.build
+++ b/src/libcamera/proxy/worker/meson.build
@@ -21,7 +21,7 @@ foreach mojom : ipa_mojoms
[worker, libcamera_generated_ipa_headers],
install : true,
install_dir : proxy_install_dir,
- dependencies : libcamera_dep)
+ dependencies : [libcamera_dep, libdl])
endforeach
config_h.set('IPA_PROXY_DIR',
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
index d451fab3..55413f1c 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl
@@ -33,6 +33,7 @@
#include "libcamera/internal/log.h"
#include "libcamera/internal/process.h"
#include "libcamera/internal/thread.h"
+#include "libcamera/internal/tracepoints.h"
namespace libcamera {
@@ -112,6 +113,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
switch (_cmd) {
{%- for method in interface_event.methods %}
case {{cmd_event_enum_name}}::{{method.mojom_name|cap}}: {
+ LIBCAMERA_TRACEPOINT_IPA_RECV({{module_name}}, {{method.mojom_name}});
{{method.mojom_name}}IPC(data.data().cbegin(), dataSize, data.fds());
break;
}
@@ -125,6 +127,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data)
{% for method in interface_main.methods %}
{{proxy_funcs.func_sig(proxy_name, method)}}
{
+ LIBCAMERA_TRACEPOINT_IPA_BEGIN({{module_name}}, {{method.mojom_name}});
if (isolate_)
{{"return " if method|method_return_value != "void"}}{{method.mojom_name}}IPC(
{%- for param in method|method_param_names -%}
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
index ac037fa1..d08af76d 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
@@ -37,6 +37,7 @@
#include "libcamera/internal/ipc_unixsocket.h"
#include "libcamera/internal/log.h"
#include "libcamera/internal/thread.h"
+#include "libcamera/internal/tracepoints.h"
using namespace libcamera;
@@ -78,6 +79,7 @@ public:
{% for method in interface_main.methods %}
case {{cmd_enum_name}}::{{method.mojom_name|cap}}: {
+ LIBCAMERA_TRACEPOINT_IPA_RECV({{module_name}}IPA, {{method.mojom_name}});
{{proxy_funcs.deserialize_call(method|method_param_inputs, '_ipcMessage.data()', '_ipcMessage.fds()', false, true)|indent(8, true)}}
{% for param in method|method_param_outputs %}
{{param|name}} {{param.mojom_name}};
@@ -167,6 +169,7 @@ private:
socket_.send(_message.payload());
+ LIBCAMERA_TRACEPOINT_IPA_BEGIN({{module_name}}IPA, {{method.mojom_name}});
LOG({{proxy_worker_name}}, Debug) << "{{method.mojom_name}} done";
}
{% endfor %}
--
2.27.0
More information about the libcamera-devel
mailing list