[libcamera-devel,v2,7/7] tracepoints: pipeline: Add tracepoint for bufferReady
diff mbox series

Message ID 20221213091558.621950-8-paul.elder@ideasonboard.com
State New
Headers show
Series
  • tracepoints: request: Improve request tracepoints
Related show

Commit Message

Paul Elder Dec. 13, 2022, 9:15 a.m. UTC
Add a tracepoint to track bufferReady. Only the Request address is
printed and not Request information, to prevent dereferencing a
potentially nullptr request.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
New in v2
---
 .../libcamera/internal/tracepoints/pipeline.tp | 18 ++++++++++++++++++
 src/libcamera/pipeline/vimc/vimc.cpp           |  3 +++
 2 files changed, 21 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/tracepoints/pipeline.tp b/include/libcamera/internal/tracepoints/pipeline.tp
index 71694dd4..c623683a 100644
--- a/include/libcamera/internal/tracepoints/pipeline.tp
+++ b/include/libcamera/internal/tracepoints/pipeline.tp
@@ -5,6 +5,9 @@ 
  * pipeline.tp - Tracepoints for pipelines
  */
 
+#include <libcamera/framebuffer.h>
+#include <libcamera/request.h>
+
 #include "libcamera/internal/pipeline_handler.h"
 
 TRACEPOINT_EVENT(
@@ -43,3 +46,18 @@  TRACEPOINT_EVENT(
 		ctf_string(name, pipe->name())
 	)
 )
+
+TRACEPOINT_EVENT(
+	libcamera,
+	pipe_buffer_ready,
+	TP_ARGS(
+		libcamera::PipelineHandler *, pipe,
+		libcamera::FrameBuffer *, buf,
+		libcamera::Request *, req
+	),
+	TP_FIELDS(
+		ctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))
+		ctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)
+		ctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))
+	)
+)
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 204f5ad7..79c401e7 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -36,6 +36,7 @@ 
 #include "libcamera/internal/ipa_manager.h"
 #include "libcamera/internal/media_device.h"
 #include "libcamera/internal/pipeline_handler.h"
+#include "libcamera/internal/tracepoints.h"
 #include "libcamera/internal/v4l2_subdevice.h"
 #include "libcamera/internal/v4l2_videodevice.h"
 
@@ -577,6 +578,8 @@  int VimcCameraData::init()
 
 void VimcCameraData::bufferReady(FrameBuffer *buffer)
 {
+	LIBCAMERA_TRACEPOINT(pipe_buffer_ready, this->pipe(), buffer, buffer->request());
+
 	PipelineHandlerVimc *pipe =
 		static_cast<PipelineHandlerVimc *>(this->pipe());
 	Request *request = buffer->request();