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

Message ID 20221213091558.621950-7-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 for stopping the pipeline. This was used for debugging
the segfault caused at camera stop time, where buffers were turning into
nullptrs.

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

---
New in v2
---
 include/libcamera/internal/tracepoints/pipeline.tp | 13 +++++++++++++
 src/libcamera/pipeline_handler.cpp                 |  2 ++
 2 files changed, 15 insertions(+)

Patch
diff mbox series

diff --git a/include/libcamera/internal/tracepoints/pipeline.tp b/include/libcamera/internal/tracepoints/pipeline.tp
index 950aa918..71694dd4 100644
--- a/include/libcamera/internal/tracepoints/pipeline.tp
+++ b/include/libcamera/internal/tracepoints/pipeline.tp
@@ -5,6 +5,8 @@ 
  * pipeline.tp - Tracepoints for pipelines
  */
 
+#include "libcamera/internal/pipeline_handler.h"
+
 TRACEPOINT_EVENT(
 	libcamera,
 	ipa_call_begin,
@@ -30,3 +32,14 @@  TRACEPOINT_EVENT(
 		ctf_string(function_name, func)
 	)
 )
+
+TRACEPOINT_EVENT(
+	libcamera,
+	pipe_stop,
+	TP_ARGS(
+		libcamera::PipelineHandler *, pipe
+	),
+	TP_FIELDS(
+		ctf_string(name, pipe->name())
+	)
+)
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index cfade490..7adb7628 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -326,6 +326,8 @@  void PipelineHandler::unlockMediaDevices()
  */
 void PipelineHandler::stop(Camera *camera)
 {
+	LIBCAMERA_TRACEPOINT(pipe_stop, this);
+
 	/* Stop the pipeline handler and let the queued requests complete. */
 	stopDevice(camera);