Show a patch.

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

{
    "id": 10301,
    "url": "https://patchwork.libcamera.org/api/patches/10301/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10301/",
    "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-6-paul.elder@ideasonboard.com>",
    "date": "2020-10-29T10:16:28",
    "name": "[libcamera-devel,v3,5/6] utils: tracepoints: Add simple statistics script",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b040a23de34e27e8392df16676967283d64b480e",
    "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/10301/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/10301/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10301/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 71335BDB9B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 29 Oct 2020 10:16:52 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3F5046289D;\n\tThu, 29 Oct 2020 11:16:52 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EFA9B628BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Oct 2020 11:16:49 +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 8383A527;\n\tThu, 29 Oct 2020 11:16:48 +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=\"Xsd2XpnZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603966609;\n\tbh=PpjVvGziD0VNQq6Y8hEJvtg3OTTrnFtQxH9dJCSGwdo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Xsd2XpnZMBzkLDtWg7m8/I9Yyr7OvNAUlVJtwHA7ByNjQH9THr+KHAQ+8fGWBBw79\n\tS/s+XOuAC+tGBwxXircWGMt1D2LvJ0nskX5KcpVLTpaYr/Wzn0Psryp3ho64PeylIO\n\t6Y0gjcp5ApTppzui/jkHkJTm5/Wlvk2lgkUyhcx8=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 29 Oct 2020 19:16:28 +0900",
        "Message-Id": "<20201029101629.61798-6-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 5/6] utils: tracepoints: Add simple\n\tstatistics script",
        "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 a script that scans a trace for IPA call tracepoints, and returns\nstatistics on the time taken for IPA calls.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nI'll fix output indentation in the next version.\n\nChanges in v3:\n- check for the new tracepoint names, ipa_call_begin and ipa_call_end\n- fix babeltrace2 parsing in the case that the event doesn't have a\n  pipeline_name field\n- change script description\n- add argparse description\n- add example for trace_path argument\n- change double quotes to single quotes\n\nNew in v2\n---\n utils/tracepoints/analyze.py | 66 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 66 insertions(+)\n create mode 100755 utils/tracepoints/analyze.py",
    "diff": "diff --git a/utils/tracepoints/analyze.py b/utils/tracepoints/analyze.py\nnew file mode 100755\nindex 00000000..43da9b1f\n--- /dev/null\n+++ b/utils/tracepoints/analyze.py\n@@ -0,0 +1,66 @@\n+#!/usr/bin/env python3\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+# Copyright (C) 2020, Google Inc.\n+#\n+# Author: Paul Elder <paul.elder@ideasonboard.com>\n+#\n+# analyze.py - Example of how to extract information from libcamera lttng traces\n+\n+import argparse\n+import bt2\n+import statistics as stats\n+import sys\n+\n+# pipeline -> {function -> stack(timestamps)}\n+timestamps = {}\n+\n+# pipeline:function -> samples[]\n+samples = {}\n+\n+def main(argv):\n+    parser = argparse.ArgumentParser(\n+            description='A simple analysis script to get statistics on time taken for IPA calls')\n+    parser.add_argument('-p', '--pipeline', type=str,\n+                        help='Name of pipeline to filter for')\n+    parser.add_argument('trace_path', type=str,\n+                        help='Path to lttng trace (eg. ~/lttng-traces/demo-20201029-184003)')\n+    args = parser.parse_args(argv[1:])\n+\n+    traces = bt2.TraceCollectionMessageIterator(args.trace_path)\n+    for msg in traces:\n+        if type(msg) is not bt2._EventMessageConst or \\\n+           'pipeline_name' not in msg.event.payload_field or \\\n+           (args.pipeline is not None and \\\n+            msg.event.payload_field['pipeline_name'] != args.pipeline):\n+            continue\n+\n+        pipeline = msg.event.payload_field['pipeline_name']\n+        event = msg.event.name\n+        func = msg.event.payload_field['function_name']\n+        timestamp_ns = msg.default_clock_snapshot.ns_from_origin\n+\n+        if event == 'libcamera:ipa_call_begin':\n+            if pipeline not in timestamps:\n+                timestamps[pipeline] = {}\n+            if func not in timestamps[pipeline]:\n+                timestamps[pipeline][func] = []\n+            timestamps[pipeline][func].append(timestamp_ns)\n+\n+        if event == 'libcamera:ipa_call_end':\n+            ts = timestamps[pipeline][func].pop()\n+            key = f'{pipeline}:{func}'\n+            if key not in samples:\n+                samples[key] = []\n+            samples[key].append(timestamp_ns - ts)\n+\n+    print('pipeline:function\\t:\\tmin\\tmax\\tmean\\tstddev')\n+    for k, v in samples.items():\n+        mean = int(stats.mean(v))\n+        stddev = int(stats.stdev(v))\n+        minv = min(v)\n+        maxv = max(v)\n+        print(f'{k}\\t:\\t{minv}\\t{maxv}\\t{mean}\\t{stddev}')\n+\n+\n+if __name__ == '__main__':\n+    sys.exit(main(sys.argv))\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "5/6"
    ]
}