Show a patch.

GET /api/patches/10298/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 10298,
    "url": "https://patchwork.libcamera.org/api/patches/10298/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10298/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20201029101629.61798-3-paul.elder@ideasonboard.com>",
    "date": "2020-10-29T10:16:25",
    "name": "[libcamera-devel,v3,2/6] libcamera: request: Add tracepoints",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e841f76183bee4895548e892d106bd5cfdda52c8",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10298/mbox/",
    "series": [
        {
            "id": 1432,
            "url": "https://patchwork.libcamera.org/api/series/1432/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1432",
            "date": "2020-10-29T10:16:23",
            "name": "Tracing",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1432/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10298/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10298/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4285EBDB9B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 29 Oct 2020 10:16:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F894628CA;\n\tThu, 29 Oct 2020 11:16:46 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 04875627D7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Oct 2020 11:16:44 +0100 (CET)",
            "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EDB8750E;\n\tThu, 29 Oct 2020 11:16:41 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"MG3S3qZP\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603966603;\n\tbh=3eqqcxqeH2Jvk7Zx/jETZOyuKYpmbmxPiz8Al5x2Los=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=MG3S3qZP1FubdIsJaBAcd98HFV+W4Fs9CYr4EvTbua/v8794ghGHD2IzJSu7vv8Z8\n\tgPWrep6GKhpY3/fxarqqcCIbxzKGWbEPeV5gJ6i9B+qiio0bkXZATwS0Vu/3CFLElp\n\tbPGRChwiwvjLSnQrEqaaAL9Va3Xb2EOhz0Mqx9O8=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 29 Oct 2020 19:16:25 +0900",
        "Message-Id": "<20201029101629.61798-3-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201029101629.61798-1-paul.elder@ideasonboard.com>",
        "References": "<20201029101629.61798-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 2/6] libcamera: request: Add tracepoints",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add and use tracepoints in Request. Requests are core to libcamera\noperation, thus detecting delays in their processing is important, and\nserves as a good usage example of tracepoints.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nI wasn't sure what the best way to handle the FrameBuffer enum in the tp\nfile... should it go in a separate file? Will we ever need to use the\nFrameBuffer status enum in other tracepoints? If we do, it can't be\ndefined multiple times, so it'll have to go in its own tp file, and in\nthe meson tp file list it will have to go first. I guess that's the\ndrawback of concating all the tp files together...\n\nChanges in v3:\n- expand the changelog\n- add enum tracepoint values so that request status and buffer status\n  are strings instead of ints in the trace\n- remove cancelled from all request tracepoints, except complete_buffer\n- expand the complete_buffer tracepoint to include information on the\n  buffer\n- display the address of the request in all tracepoints\n- remove tracepoints for add_buffer and find_buffer\n\nChanges in v2:\n- remove tracepoints from uvcvideo\n- remove comment in changelog that this is only used for demonstration\n- use Request pointers instead of feeding the fields manually to the\n  tracepoint\n---\n .../internal/tracepoints/meson.build          |  1 +\n .../libcamera/internal/tracepoints/request.tp | 90 +++++++++++++++++++\n src/libcamera/request.cpp                     | 11 +++\n 3 files changed, 102 insertions(+)\n create mode 100644 include/libcamera/internal/tracepoints/request.tp",
    "diff": "diff --git a/include/libcamera/internal/tracepoints/meson.build b/include/libcamera/internal/tracepoints/meson.build\nindex 2dd6733e..8410c205 100644\n--- a/include/libcamera/internal/tracepoints/meson.build\n+++ b/include/libcamera/internal/tracepoints/meson.build\n@@ -1,4 +1,5 @@\n # SPDX-License-Identifier: CC0-1.0\n \n tracepoint_files = files([\n+    'request.tp',\n ])\ndiff --git a/include/libcamera/internal/tracepoints/request.tp b/include/libcamera/internal/tracepoints/request.tp\nnew file mode 100644\nindex 00000000..92308dcd\n--- /dev/null\n+++ b/include/libcamera/internal/tracepoints/request.tp\n@@ -0,0 +1,90 @@\n+#include <libcamera/buffer.h>\n+#include <libcamera/request.h>\n+\n+TRACEPOINT_ENUM(\n+\tlibcamera,\n+\trequest_status,\n+\tTP_ENUM_VALUES(\n+\t\tctf_enum_value(\"RequestPending\", 0)\n+\t\tctf_enum_value(\"RequestComplete\", 1)\n+\t\tctf_enum_value(\"RequestCancelled\", 2)\n+\t)\n+)\n+\n+TRACEPOINT_ENUM(\n+\tlibcamera,\n+\tbuffer_status,\n+\tTP_ENUM_VALUES(\n+\t\tctf_enum_value(\"FrameSuccess\", 0)\n+\t\tctf_enum_value(\"FrameError\", 1)\n+\t\tctf_enum_value(\"FrameCancelled\", 2)\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_CLASS(\n+\tlibcamera,\n+\trequest,\n+\tTP_ARGS(\n+\t\tlibcamera::Request *, req\n+\t),\n+\tTP_FIELDS(\n+\t\tctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))\n+\t\tctf_integer(uint64_t, cookie, req->cookie())\n+\t\tctf_enum(libcamera, request_status, uint32_t, status, req->status())\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_INSTANCE(\n+\tlibcamera,\n+\trequest,\n+\trequest_construct,\n+\tTP_ARGS(\n+\t\tlibcamera::Request *, req\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_INSTANCE(\n+\tlibcamera,\n+\trequest,\n+\trequest_destroy,\n+\tTP_ARGS(\n+\t\tlibcamera::Request *, req\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_INSTANCE(\n+\tlibcamera,\n+\trequest,\n+\trequest_reuse,\n+\tTP_ARGS(\n+\t\tlibcamera::Request *, req\n+\t)\n+)\n+\n+TRACEPOINT_EVENT_INSTANCE(\n+\tlibcamera,\n+\trequest,\n+\trequest_complete,\n+\tTP_ARGS(\n+\t\tlibcamera::Request *, req\n+\t)\n+)\n+\n+\n+TRACEPOINT_EVENT(\n+\tlibcamera,\n+\trequest_complete_buffer,\n+\tTP_ARGS(\n+\t\tlibcamera::Request *, req,\n+\t\tint, cancelled,\n+\t\tlibcamera::FrameBuffer *, buf\n+\t),\n+\tTP_FIELDS(\n+\t\tctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))\n+\t\tctf_integer(uint64_t, cookie, req->cookie())\n+\t\tctf_integer(int, status, req->status())\n+\t\tctf_integer(int, cancelled, cancelled)\n+\t\tctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))\n+\t\tctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)\n+\t)\n+)\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex ae8b1660..d1b43697 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -16,6 +16,7 @@\n \n #include \"libcamera/internal/camera_controls.h\"\n #include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/tracepoints.h\"\n \n /**\n  * \\file request.h\n@@ -85,10 +86,14 @@ Request::Request(Camera *camera, uint64_t cookie)\n \t * \\todo: Add a validator for metadata controls.\n \t */\n \tmetadata_ = new ControlList(controls::controls);\n+\n+\tLIBCAMERA_TRACEPOINT(request_construct, this);\n }\n \n Request::~Request()\n {\n+\tLIBCAMERA_TRACEPOINT(request_destroy, this);\n+\n \tdelete metadata_;\n \tdelete controls_;\n \tdelete validator_;\n@@ -106,6 +111,8 @@ Request::~Request()\n  */\n void Request::reuse(ReuseFlag flags)\n {\n+\tLIBCAMERA_TRACEPOINT(request_reuse, this);\n+\n \tpending_.clear();\n \tif (flags & ReuseBuffers) {\n \t\tfor (auto pair : bufferMap_) {\n@@ -259,6 +266,8 @@ void Request::complete()\n \tLOG(Request, Debug)\n \t\t<< \"Request has completed - cookie: \" << cookie_\n \t\t<< (cancelled_ ? \" [Cancelled]\" : \"\");\n+\n+\tLIBCAMERA_TRACEPOINT(request_complete, this);\n }\n \n /**\n@@ -276,6 +285,8 @@ void Request::complete()\n  */\n bool Request::completeBuffer(FrameBuffer *buffer)\n {\n+\tLIBCAMERA_TRACEPOINT(request_complete_buffer, this, cancelled_, buffer);\n+\n \tint ret = pending_.erase(buffer);\n \tASSERT(ret == 1);\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "2/6"
    ]
}