[libcamera-devel,v2,2/7] tracepoints: request: Add event class for request and buffer
diff mbox series

Message ID 20221213091558.621950-3-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
Currently there is one tracepoint event request_complete_buffer that
outputs information on both the request and its buffer. We want to add
another event for add_buffer. Add an event class to cover this.

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

---
Changes in v2:
- Change arg from private to public Request pointer
---
 .../libcamera/internal/tracepoints/request.tp | 28 +++++++++++++------
 src/libcamera/request.cpp                     |  2 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/internal/tracepoints/request.tp b/include/libcamera/internal/tracepoints/request.tp
index 9d0bcbfa..b295b44f 100644
--- a/include/libcamera/internal/tracepoints/request.tp
+++ b/include/libcamera/internal/tracepoints/request.tp
@@ -21,6 +21,22 @@  TRACEPOINT_EVENT_CLASS(
 	)
 )
 
+TRACEPOINT_EVENT_CLASS(
+	libcamera,
+	request_with_buffer,
+	TP_ARGS(
+		libcamera::Request*, req,
+		libcamera::FrameBuffer *, buf
+	),
+	TP_FIELDS(
+		ctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))
+		ctf_integer(uint64_t, cookie, req->cookie())
+		ctf_integer(int, status, req->status())
+		ctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))
+		ctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)
+	)
+)
+
 TRACEPOINT_EVENT_INSTANCE(
 	libcamera,
 	request,
@@ -84,18 +100,12 @@  TRACEPOINT_EVENT_INSTANCE(
 	)
 )
 
-TRACEPOINT_EVENT(
+TRACEPOINT_EVENT_INSTANCE(
 	libcamera,
+	request_with_buffer,
 	request_complete_buffer,
 	TP_ARGS(
-		libcamera::Request::Private *, req,
+		libcamera::Request *, req,
 		libcamera::FrameBuffer *, buf
-	),
-	TP_FIELDS(
-		ctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))
-		ctf_integer(uint64_t, cookie, req->_o<libcamera::Request>()->cookie())
-		ctf_integer(int, status, req->_o<libcamera::Request>()->status())
-		ctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))
-		ctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)
 	)
 )
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 1dedc26e..652b7b70 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -90,7 +90,7 @@  bool Request::Private::hasPendingBuffers() const
  */
 bool Request::Private::completeBuffer(FrameBuffer *buffer)
 {
-	LIBCAMERA_TRACEPOINT(request_complete_buffer, this, buffer);
+	LIBCAMERA_TRACEPOINT(request_complete_buffer, _o<Request>(), buffer);
 
 	int ret = pending_.erase(buffer);
 	ASSERT(ret == 1);