[{"id":26059,"web_url":"https://patchwork.libcamera.org/comment/26059/","msgid":"<Y5lx1cSjoGBQOhBf@pyrite.rasen.tech>","date":"2022-12-14T06:48:53","subject":"Re: [libcamera-devel] [PATCH v2 1/1] Use tracing with perfetto in\n\tChromeOS","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Harvey,\n\nSorry for the delay.\n\nOn Fri, Jul 22, 2022 at 12:00:28PM +0000, Harvey Yang via libcamera-devel wrote:\n> As ChromeOS is using perfetto (project named as CrOSetto). When ChromeOS\n> uses libcamera, it should use perfetto to collect traces instead of\n> lttng.\n> \n> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>\n> ---\n>  Documentation/guides/tracing.rst              | 114 ++++++++++++++----\n>  include/libcamera/internal/tracepoints.h.in   |  37 +++++-\n>  .../internal/tracepoints/meson.build          |  25 ++--\n>  .../internal/tracepoints/pipeline.perfetto    |  10 ++\n>  .../internal/tracepoints/request.perfetto     |  30 +++++\n>  meson.build                                   |   7 +-\n>  src/android/cros/camera3_hal.cpp              |   5 +\n>  src/android/cros/meson.build                  |   1 +\n>  src/libcamera/meson.build                     |  14 ++-\n>  src/libcamera/pipeline_perfetto.cpp           |  24 ++++\n>  src/libcamera/request_perfetto.cpp            |  73 +++++++++++\n>  src/libcamera/tracepoints.cpp                 |  11 ++\n>  12 files changed, 312 insertions(+), 39 deletions(-)\n>  create mode 100644 include/libcamera/internal/tracepoints/pipeline.perfetto\n>  create mode 100644 include/libcamera/internal/tracepoints/request.perfetto\n>  create mode 100644 src/libcamera/pipeline_perfetto.cpp\n>  create mode 100644 src/libcamera/request_perfetto.cpp\n> \n> diff --git a/Documentation/guides/tracing.rst b/Documentation/guides/tracing.rst\n> index ae960d85..53d6232e 100644\n> --- a/Documentation/guides/tracing.rst\n> +++ b/Documentation/guides/tracing.rst\n> @@ -16,33 +16,50 @@ at periodic points in time. This can be done with other tools such as\n>  callgrind, perf, gprof, etc., without modification to the application,\n>  and is out of scope for this guide.\n>  \n> +Library: Perfetto vs lttng-ust\n> +---------\n\nThe underline needs to be extended. (also in the other instances below)\n\n> +\n> +To integrate with CrOS tracing infrastructure, which uses perfetto (or called\n> +CrOSetto in CrOS), we implement the tracepoint macros (will be described below)\n> +with two different libraries: CrOS with perfetto, and the rest with lttng-ust.\n> +\n>  Compiling\n>  ---------\n>  \n> -To compile libcamera with tracing support, it must be enabled through the\n> -meson ``tracing`` option. It depends on the lttng-ust library (available in the\n> -``liblttng-ust-dev`` package for Debian-based distributions).\n> -By default the tracing option in meson is set to ``auto``, so if\n> -liblttng is detected, it will be enabled by default. Conversely, if the option\n> -is set to disabled, then libcamera will be compiled without tracing support.\n> +To compile libcamera with perfetto support in CrOS, it must be enabled through\n\nI'd rather the wording specify \"tracing\" generically first, then\nelaborate between perfetto and lttng.\n\n> +the meson ``tracing`` option. In CrOS, it depends on the perfetto library,\n> +which is by default available in CrOS; In the rest, it depends on the lttng-ust\n> +library (available in the ``liblttng-ust-dev`` package for Debian-based\n> +distributions).\n> +By default the tracing option in meson is set to ``auto``, so if the library is\n> +detected, it will be enabled by default. Conversely, if the option is set to\n> +disabled, then libcamera will be compiled without tracing support.\n\nI'm wondering, does it make sense to allow both to be compiled in at the\nsame time? I guess we wouldn't use the same binary on CrOS and on\nnon-CrOS, and we wouldn't use perfetto on non-CrOS. So I guess the only\nuse case would be if lttng would ever be used on CrOS. Is that ever a\nuse case?\n\n>  \n>  Defining tracepoints\n>  --------------------\n>  \n>  libcamera already contains a set of tracepoints. To define additional\n> -tracepoints, create a file\n> -``include/libcamera/internal/tracepoints/{file}.tp``, where ``file`` is a\n> -reasonable name related to the category of tracepoints that you wish to\n> -define. For example, the tracepoints file for the Request object is called\n> -``request.tp``. An entry for this file must be added in\n> -``include/libcamera/internal/tracepoints/meson.build``.\n> -\n> -In this tracepoints file, define your tracepoints `as mandated by lttng\n> +tracepoints, create two files ``{file}.tp`` and ``{file}.perfetto``, for lttng\n> +and perfetto respectively, under ``include/libcamera/internal/tracepoints/``,\n> +and the perfetto implementation file ``src/libcamera/{file}_perfetto.cpp``,\n> +where ``file`` is a reasonable name related to the category of tracepoints that\n> +you wish to define. For example, the tracepoints files for the Request object is\n> +called ``request.tp`` and ``request.perfetto``. Entries for the files must be\n> +added in ``include/libcamera/internal/tracepoints/meson.build``.\n> +\n> +In the perfetto tracepoints files, declare the tracepoint functions in\n> +``{file}.perfetto``, and define them in ``{file}_perfetto.cpp``, `as mandated\n> +by perfetto <https://perfetto.dev/docs/instrumentation/track-events>`_.\n> +Currently the only enabled perfetto::Category is ``libcamera``. If you intend to\n> +use another category, remember to define it in\n\nI'm wondering if category here in perfetto means something different\nthan lttng's? lttng only has the top-level category then the trace name\n(afaik), so the top-level category is \"libcamera\" and after that we end\nup using an underscore-separated prefix.\n\nDoes perfetto allow another level of catetories? I don't seem to see\nany, in which case I think we should just remove this section, as all\nthe tracepoints that this section refers to are internal to libcamera,\nso they'd all use the \"libcamera\" category.\n\n> +``include/libcamera/internal/tracepoints.h.in``, and enable it when collecting\n> +traces.\n\nDo you think it's feasible to have just one definition and we can use it\nto generate the other? I'd say use lttng's (because it's more specific,\nlike how it specifies the types of the fields) and then use that to\ngenerate perfetto's.\n\nOr is it better to just make sure that each tracepoint is defined twice?\nI'm not fond of the duplicate work though, so tbh I'd rather one\ndefinition that generates the other, if that's feasible. (Is it time for\nme to write yet another code generator?)\n\n> +\n> +In the lttng tracepoints file, define your tracepoints `as mandated by lttng\n>  <https://lttng.org/man/3/lttng-ust>`_. The header boilerplate must *not* be\n>  included (as it will conflict with the rest of our infrastructure), and\n>  only the tracepoint definitions (with the ``TRACEPOINT_*`` macros) should be\n>  included.\n> -\n>  All tracepoint providers shall be ``libcamera``. According to lttng, the\n>  tracepoint provider should be per-project; this is the rationale for this\n>  decision. To group tracepoint events, we recommend using\n> @@ -68,9 +85,9 @@ Then to use the tracepoint:\n>  \n>  ``LIBCAMERA_TRACEPOINT({tracepoint_event}, args...)``\n>  \n> -This macro must be used, as opposed to lttng's macros directly, because\n> -lttng is an optional dependency of libcamera, so the code must compile and run\n> -even when lttng is not present or when tracing is disabled.\n> +This macro must be used, as opposed to perfetto's/lttng's macros directly,\n\ns$perfetto's/lttng's$perfetto's or lttng's$\n\n> +because tracing support is optional of libcamera, so the code must compile and\n> +run even when perfetto/lttng is not present or when tracing is disabled.\n\ns$perfetto/lttng is$perfetto or lttng are/\n\n>  \n>  The tracepoint provider name, as declared in the tracepoint definition, is not\n>  included in the parameters of the tracepoint.\n> @@ -86,7 +103,7 @@ and when the pipeline handler receives the corresponding response from the IPA,\n>  respectively. These are the tracepoints that our sample analysis script\n>  (see \"Analyzing a trace\") scans for when computing statistics on IPA call time.\n>  \n> -Using tracepoints (from an application)\n> +Using lttng tracepoints (from an application)\n\nI think this section applies regardless of if we're using lttng or\nperfetto.\n\n>  ---------------------------------------\n>  \n>  As applications are not part of libcamera, but rather users of libcamera,\n> @@ -94,13 +111,66 @@ applications should seek their own tracing mechanisms. For ease of tracing\n>  the application alongside tracing libcamera, it is recommended to also\n>  `use lttng <https://lttng.org/docs/#doc-tracing-your-own-user-application>`_.\n>  \n> -Using tracepoints (from closed-source IPA)\n> +Using lttng tracepoints (from closed-source IPA)\n\nSame here.\n\n>  ------------------------------------------\n>  \n>  Similar to applications, closed-source IPAs can simply use lttng on their own,\n>  or any other tracing mechanism if desired.\n>  \n> -Collecting a trace\n> +Collecting a perfetto trace\n> +------------------\n> +\n> +A trace can be collected with the following steps:\n> +\n> +1. Start `traced` if it hasn't been started.\n> +.. code-block:: bash\n> +\n> +   start traced\n> +\n> +2. Start a consumer that includes “track_event” data source in the trace\n> +   config, and “libcamera” category.\n> +.. code-block:: bash\n> +\n> +   perfetto -c - --txt -o /tmp/perfetto-trace \\\n> +   <<EOF\n> +\n> +   buffers: {\n> +       size_kb: 63488\n> +       fill_policy: DISCARD\n> +   }\n> +   buffers: {\n> +       size_kb: 2048\n> +       fill_policy: DISCARD\n> +   }\n> +   data_sources: {\n> +        config {\n> +            name: \"track_event\"\n> +            track_event_config {\n> +                enabled_categories: \"libcamera\"\n> +            }\n> +        }\n> +   }\n> +   duration_ms: 10000\n> +\n> +   EOF\n\nDoes this have to be fed through stdin or is there an option for\nfeeding it as a file?\n\n> +\n> +3. Execute the libcamera behavior you intend to trace during the set duration\n> +   (10000 ms) in the above example.\n> +\n> +4. After the consumer (cmd `perfetto`) is done, you can find the trace result\n> +   in ``/tmp/perfetto-trace``.\n> +\n> +Analyzing a perfetto trace\n> +-----------------\n> +\n> +Follow the `guide <https://perfetto.dev/docs/visualization/perfetto-ui>`_ to\n> +visualize the trace.\n> +\n> +In other words, upload the trace to `Perfetto UI <https://ui.perfetto.dev/>`_,\n> +where you can check the timeline of tracepoints on each process/thread. You can\n> +also run SQL queries to do analysis.\n> +\n> +Collecting a lttng trace\n\ns/a/an/ (yeah, english sucks)\n\n>  ------------------\n>  \n>  A trace can be collected fairly simply from lttng:\n> @@ -123,7 +193,7 @@ viewed by: ``lttng view -t $PATH_TO_TRACE``, where ``$PATH_TO_TRACE`` is the\n>  path that was printed when the session was created. This is the same path that\n>  is used when analyzing traces programatically, as described in the next section.\n>  \n> -Analyzing a trace\n> +Analyzing a lttng trace\n\nSame here.\n\n>  -----------------\n>  \n>  As mentioned above, while an lttng tracing session exists and the trace is not\n> diff --git a/include/libcamera/internal/tracepoints.h.in b/include/libcamera/internal/tracepoints.h.in\n> index d0fc1365..d91fadd7 100644\n> --- a/include/libcamera/internal/tracepoints.h.in\n> +++ b/include/libcamera/internal/tracepoints.h.in\n> @@ -9,7 +9,24 @@\n>  #ifndef __LIBCAMERA_INTERNAL_TRACEPOINTS_H__\n>  #define __LIBCAMERA_INTERNAL_TRACEPOINTS_H__\n>  \n> -#if HAVE_TRACING\n> +#if HAVE_PERFETTO\n> +\n> +#include <perfetto/perfetto.h>\n> +\n> +PERFETTO_DEFINE_CATEGORIES(\n> +\tperfetto::Category(\"libcamera\")\n> +\t\t.SetDescription(\"Events from libcamera\"));\n> +\n> +#define LIBCAMERA_TRACEPOINT(t_name, ...) \\\n> +LIBCAMERA_TRACE_EVENT_##t_name(__VA_ARGS__)\n> +\n> +#define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func) \\\n> +LIBCAMERA_TRACE_EVENT_ipa_call_begin(#pipe, #func)\n> +\n> +#define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func) \\\n> +LIBCAMERA_TRACE_EVENT_ipa_call_end(#pipe, #func)\n> +\n> +#elif HAVE_TRACING /* !HAVE_PERFETTO */\n>  #define LIBCAMERA_TRACEPOINT(...) tracepoint(libcamera, __VA_ARGS__)\n>  \n>  #define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func) \\\n> @@ -18,7 +35,7 @@ tracepoint(libcamera, ipa_call_begin, #pipe, #func)\n>  #define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func) \\\n>  tracepoint(libcamera, ipa_call_end, #pipe, #func)\n>  \n> -#else\n> +#else /* HAVE_PERFETTO */\n\nShould this be /* !HAVE_PERFETTO && !HAVE_TRACING */ ?\n\nAlso, probably we should rename TRACING to LTTNG everywhere. perfetto is\ntracing too, so it sounds kind of weird to say \"!HAVE_TRACING but\nHAVE_PERFETTO\", at least imo.\n\n>  \n>  namespace {\n>  \n> @@ -34,12 +51,15 @@ inline void unused([[maybe_unused]] Args&& ...args)\n>  #define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func)\n>  #define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func)\n>  \n> -#endif /* HAVE_TRACING */\n> +#endif /* HAVE_PERFETTO */\n>  \n>  #endif /* __LIBCAMERA_INTERNAL_TRACEPOINTS_H__ */\n>  \n> +#if HAVE_PERFETTO\n> +\n> +#include <perfetto/perfetto.h>\n>  \n> -#if HAVE_TRACING\n> +#elif HAVE_TRACING\n>  \n>  #undef TRACEPOINT_PROVIDER\n>  #define TRACEPOINT_PROVIDER libcamera\n> @@ -52,10 +72,15 @@ inline void unused([[maybe_unused]] Args&& ...args)\n>  \n>  #include <lttng/tracepoint.h>\n>  \n> -{{source}}\n\nThis won't work, as we need the header guard on the next line.\n\n>  \n>  #endif /* INCLUDE_LIBCAMERA_INTERNAL_TRACEPOINTS_TP_H */\n>  \n>  #include <lttng/tracepoint-event.h>\n>  \n> -#endif /* HAVE_TRACING */\n> +#endif /* HAVE_PERFETTO */\n> +\n> +#if HAVE_PERFETTO || HAVE_TRACING\n> +\n> +{{source}}\n> +\n> +#endif /* HAVE_PERFETTO || HAVE_TRACING */\n\nSo this needs to be shuffled around.\n\n> diff --git a/include/libcamera/internal/tracepoints/meson.build b/include/libcamera/internal/tracepoints/meson.build\n> index d9b2fca5..ff5aece6 100644\n> --- a/include/libcamera/internal/tracepoints/meson.build\n> +++ b/include/libcamera/internal/tracepoints/meson.build\n> @@ -1,12 +1,19 @@\n>  # SPDX-License-Identifier: CC0-1.0\n>  \n> -# enum files must go first\n> -tracepoint_files = files([\n> -    'buffer_enums.tp',\n> -    'request_enums.tp',\n> -])\n> +if get_option('android').enabled() and get_option('android_platform') == 'cros'\n> +  tracepoint_files = files([\n> +      'pipeline.perfetto',\n> +      'request.perfetto',\n> +  ])\n> +else\n> +  # enum files must go first\n> +  tracepoint_files = files([\n> +      'buffer_enums.tp',\n> +      'request_enums.tp',\n> +  ])\n>  \n> -tracepoint_files += files([\n> -    'pipeline.tp',\n> -    'request.tp',\n> -])\n> +  tracepoint_files += files([\n> +      'pipeline.tp',\n> +      'request.tp',\n> +  ])\n> +endif\n> diff --git a/include/libcamera/internal/tracepoints/pipeline.perfetto b/include/libcamera/internal/tracepoints/pipeline.perfetto\n> new file mode 100644\n> index 00000000..5f45295e\n> --- /dev/null\n> +++ b/include/libcamera/internal/tracepoints/pipeline.perfetto\n> @@ -0,0 +1,10 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2022, Google Inc.\n> + *\n> + * pipeline.tp - Tracepoints for pipelines\n> + */\n> +\n> +void LIBCAMERA_TRACE_EVENT_ipa_call_begin(const char *pipe, const char *func);\n> +\n> +void LIBCAMERA_TRACE_EVENT_ipa_call_end(const char *pipe, const char *func);\n> diff --git a/include/libcamera/internal/tracepoints/request.perfetto b/include/libcamera/internal/tracepoints/request.perfetto\n> new file mode 100644\n> index 00000000..fd6a42a4\n> --- /dev/null\n> +++ b/include/libcamera/internal/tracepoints/request.perfetto\n> @@ -0,0 +1,30 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2022, Google Inc.\n> + *\n> + * request.tp - Tracepoints for the request object\n> + */\n> +\n> +#include <libcamera/internal/request.h>\n> +\n> +#include <libcamera/framebuffer.h>\n> +\n> +void LIBCAMERA_TRACE_EVENT_request(libcamera::Request *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_construct(libcamera::Request *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_destroy(libcamera::Request *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_reuse(libcamera::Request *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_queue(libcamera::Request *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_device_queue(libcamera::Request *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_complete(libcamera::Request::Private *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_cancel(libcamera::Request::Private *req);\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_complete_buffer(\n> +\t\tlibcamera::Request::Private *req,\n> +\t\tlibcamera::FrameBuffer * buf);\n> diff --git a/meson.build b/meson.build\n> index 29d8542d..434540e1 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -125,7 +125,11 @@ libcamera_includes = include_directories('include')\n>  py_modules = []\n>  \n>  # Libraries used by multiple components\n> -liblttng = cc.find_library('lttng-ust', required : get_option('tracing'))\n> +libperfetto = dependency('perfetto', required : get_option('tracing').enabled()\n> +    and get_option('android').enabled()\n> +    and get_option('android_platform') == 'cros')\n> +liblttng = cc.find_library('lttng-ust', required : get_option('tracing').enabled()\n> +    and not libperfetto.found())\n>  \n>  # Pipeline handlers\n>  #\n> @@ -176,6 +180,7 @@ py_mod.find_installation('python3', modules: py_modules)\n>  summary({\n>              'Enabled pipelines': pipelines,\n>              'Enabled IPA modules': ipa_modules,\n> +            'Perfetto support': perfetto_enabled,\n>              'Tracing support': tracing_enabled,\n>              'Android support': android_enabled,\n>              'GStreamer support': gst_enabled,\n> diff --git a/src/android/cros/camera3_hal.cpp b/src/android/cros/camera3_hal.cpp\n> index fb863b5f..2fbd7f14 100644\n> --- a/src/android/cros/camera3_hal.cpp\n> +++ b/src/android/cros/camera3_hal.cpp\n> @@ -7,10 +7,15 @@\n>  \n>  #include <cros-camera/cros_camera_hal.h>\n>  \n> +#include \"libcamera/internal/tracepoints.h\"\n>  #include \"../camera_hal_manager.h\"\n>  \n>  static void set_up([[maybe_unused]] cros::CameraMojoChannelManagerToken *token)\n>  {\n> +\tperfetto::TracingInitArgs args;\n> +\targs.backends |= perfetto::kSystemBackend;\n> +\tperfetto::Tracing::Initialize(args);\n> +\tperfetto::TrackEvent::Register();\n>  }\n>  \n>  static void tear_down()\n> diff --git a/src/android/cros/meson.build b/src/android/cros/meson.build\n> index 35995dd8..68f2bd9e 100644\n> --- a/src/android/cros/meson.build\n> +++ b/src/android/cros/meson.build\n> @@ -9,5 +9,6 @@ android_hal_sources += files([\n>  ])\n>  \n>  android_deps += dependency('libcros_camera')\n> +android_deps += dependency('perfetto')\n>  \n>  android_cpp_args += ['-DOS_CHROMEOS']\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 26912ca1..39a55a17 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -71,11 +71,22 @@ if libgnutls.found()\n>      config_h.set('HAVE_GNUTLS', 1)\n>  endif\n>  \n> -if liblttng.found()\n> +if libperfetto.found()\n> +    perfetto_enabled = true\n> +    tracing_enabled = false\n> +    config_h.set('HAVE_PERFETTO', 1)\n> +    libcamera_sources += [\n> +        'pipeline_perfetto.cpp',\n> +        'request_perfetto.cpp',\n> +        'tracepoints.cpp',\n> +    ]\n> +elif liblttng.found()\n> +    perfetto_enabled = false\n>      tracing_enabled = true\n>      config_h.set('HAVE_TRACING', 1)\n>      libcamera_sources += files(['tracepoints.cpp'])\n>  else\n> +    perfetto_enabled = false\n>      tracing_enabled = false\n>  endif\n>  \n> @@ -125,6 +136,7 @@ libcamera_deps = [\n>      libdl,\n>      libgnutls,\n>      liblttng,\n> +    libperfetto,\n>      libudev,\n>  ]\n>  \n> diff --git a/src/libcamera/pipeline_perfetto.cpp b/src/libcamera/pipeline_perfetto.cpp\n> new file mode 100644\n> index 00000000..07b82ffd\n> --- /dev/null\n> +++ b/src/libcamera/pipeline_perfetto.cpp\n\nIs it not possible for the definitions to go in the .perfetto file? Or\nis there some other reason that makes it strongly discouraged?\n\nIf it's required to be in a separate .cpp file, I'd at least want it\nunder src/libcamera/perfetto/ or src/libcamera/tracepoints/ or something\nalong those lines, and not in the top level src/libcamera/.\n\nThat or a code generator, so that we don't have to duplicate efforts of\ntracepoint definitions in the first place, or risk tracepoints not being\ndefined for one but not the other.\n\n\nThanks,\n\nPaul\n\n> @@ -0,0 +1,24 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2022, Google Inc.\n> + *\n> + * pipeline.tp - Tracepoints for pipelines\n> + */\n> +\n> +#include \"libcamera/internal/tracepoints.h\"\n> +\n> +void LIBCAMERA_TRACE_EVENT_ipa_call_begin(const char *pipe, const char *func)\n> +{\n> +\t// TODO: Consider TRACE_EVENT_BEGIN\n> +\tTRACE_EVENT(\"libcamera\", \"ipa_call_begin\",\n> +\t\t    \"pipeline_name\", pipe,\n> +\t\t    \"function_name\", func);\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_ipa_call_end(const char *pipe, const char *func)\n> +{\n> +\t// TODO: Consider TRACE_EVENT_END\n> +\tTRACE_EVENT(\"libcamera\", \"ipa_call_end\",\n> +\t\t    \"pipeline_name\", pipe,\n> +\t\t    \"function_name\", func);\n> +}\n> diff --git a/src/libcamera/request_perfetto.cpp b/src/libcamera/request_perfetto.cpp\n> new file mode 100644\n> index 00000000..2cfff28e\n> --- /dev/null\n> +++ b/src/libcamera/request_perfetto.cpp\n> @@ -0,0 +1,73 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2022, Google Inc.\n> + *\n> + * request.tp - Tracepoints for the request object\n> + */\n> +\n> +#include <libcamera/framebuffer.h>\n> +\n> +#include \"libcamera/internal/request.h\"\n> +#include \"libcamera/internal/tracepoints.h\"\n> +\n> +void LIBCAMERA_TRACE_EVENT_request(libcamera::Request *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request\",\n> +\t\t    \"request_ptr\", reinterpret_cast<uintptr_t>(req),\n> +\t\t    \"cookie\", req->cookie(),\n> +\t\t    \"status\", req->status()); // TODO\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_construct(libcamera::Request *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_construct\",\n> +\t\t    \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_destroy(libcamera::Request *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_destroy\",\n> +\t\t    \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_reuse(libcamera::Request *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_reuse\",\n> +\t\t    \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_queue(libcamera::Request *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_queue\",\n> +\t\t    \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_device_queue(libcamera::Request *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_device_queue\",\n> +\t\t    \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_complete(libcamera::Request::Private *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_complete\",\n> +\t\t    \"request_private_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_cancel(libcamera::Request::Private *req)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_cancel\",\n> +\t\t    \"request_private_ptr\", reinterpret_cast<uintptr_t>(req));\n> +}\n> +\n> +void LIBCAMERA_TRACE_EVENT_request_complete_buffer(\n> +\tlibcamera::Request::Private *req,\n> +\tlibcamera::FrameBuffer *buf)\n> +{\n> +\tTRACE_EVENT(\"libcamera\", \"request_complete_buffer\",\n> +\t\t    \"request_private_ptr\", reinterpret_cast<uintptr_t>(req),\n> +\t\t    \"cookie\", req->_o<libcamera::Request>()->cookie(),\n> +\t\t    \"status\", req->_o<libcamera::Request>()->status(), // TODO\n> +\t\t    \"buffer_ptr\", reinterpret_cast<uintptr_t>(buf),\n> +\t\t    \"buffer_status\", buf->metadata().status); // TODO\n> +}\n> diff --git a/src/libcamera/tracepoints.cpp b/src/libcamera/tracepoints.cpp\n> index 0173b75a..a07ea531 100644\n> --- a/src/libcamera/tracepoints.cpp\n> +++ b/src/libcamera/tracepoints.cpp\n> @@ -4,7 +4,18 @@\n>   *\n>   * tracepoints.cpp - Tracepoints with lttng\n>   */\n> +\n> +#if HAVE_PERFETTO\n> +\n> +#include \"libcamera/internal/tracepoints.h\"\n> +\n> +PERFETTO_TRACK_EVENT_STATIC_STORAGE();\n> +\n> +#else\n> +\n>  #define TRACEPOINT_CREATE_PROBES\n>  #define TRACEPOINT_DEFINE\n>  \n>  #include \"libcamera/internal/tracepoints.h\"\n> +\n> +#endif /* HAVE_PERFETTO */\n> -- \n> 2.37.1.359.gd136c6c3e2-goog\n>","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 936AAC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Dec 2022 06:49:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E873063354;\n\tWed, 14 Dec 2022 07:49:01 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 965A861507\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Dec 2022 07:49:00 +0100 (CET)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 043144A7;\n\tWed, 14 Dec 2022 07:48:58 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1671000541;\n\tbh=HH5PtM+iJ0PViN0hI7Yuezz8VUF7BiFaxXlHswmnMsE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=V49c7XcqGWws57G08Ue13BHgAlRbrhFrXdUrwo/ZVNzAWFnVeEOibqZWnJvKHU6Rq\n\tNEaNgIXno2W2Zbj7MkROGZiceLgJiKQ6lJiJ5IGyx05RCbBI/3apWmeKhozwKp0klw\n\tYuYpM5wjY9cUaS88podnB7WXNbAkeUwJ7n0P9bmz5ki/B6oLRZsDivnICh5LIRrMKq\n\tjf+32u0WhwS6v0TlE0XVy+8L/pC91XUMbgG3povkRsrGtDEU0QrnWgSmz7lG+/pSS8\n\tDOmsmRHGQe1gtIxBxwmBotvZ1zVbzh5CTKZrSYpJb5GW9KRnujo8DfFor6Blmi15Nh\n\tKL87nrpkCNeqQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1671000540;\n\tbh=HH5PtM+iJ0PViN0hI7Yuezz8VUF7BiFaxXlHswmnMsE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rlJyJrlL0xTf01MvBYOlfXvVJ93QflCcfLxDJVJC/u0GpFzRP8elqdAEmHHW+dd1o\n\t8758pumitXucc9QqeGkG7K0VZ5L6tNCBY0+/4n+nsHDPQr2nxKzeQDDS81G9jt9y1o\n\tBxF70n/Vp9GfeifS1NkfyBTOMftMd7Wadflg/HWc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"rlJyJrlL\"; dkim-atps=neutral","Date":"Wed, 14 Dec 2022 15:48:53 +0900","To":"Harvey Yang <chenghaoyang@chromium.org>","Message-ID":"<Y5lx1cSjoGBQOhBf@pyrite.rasen.tech>","References":"<20220722120028.3155712-1-chenghaoyang@google.com>\n\t<20220722120028.3155712-2-chenghaoyang@google.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20220722120028.3155712-2-chenghaoyang@google.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] Use tracing with perfetto in\n\tChromeOS","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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Harvey Yang <chenghaoyang@google.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26113,"web_url":"https://patchwork.libcamera.org/comment/26113/","msgid":"<CAEB1ahuPury4BaNyHb7O8aXkX5MGHB7Ty80yiZVt=uUenmPx-Q@mail.gmail.com>","date":"2022-12-20T07:06:43","subject":"Re: [libcamera-devel] [PATCH v2 1/1] Use tracing with perfetto in\n\tChromeOS","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"content":"Thanks Paul! And sorry for the delay.\n\nPlease check the v3 patch, which should contain most of the fixes according\nto your\ncomments.\n\nOn Wed, Dec 14, 2022 at 2:49 PM Paul Elder <paul.elder@ideasonboard.com>\nwrote:\n\n> Hi Harvey,\n>\n> Sorry for the delay.\n>\n> On Fri, Jul 22, 2022 at 12:00:28PM +0000, Harvey Yang via libcamera-devel\n> wrote:\n> > As ChromeOS is using perfetto (project named as CrOSetto). When ChromeOS\n> > uses libcamera, it should use perfetto to collect traces instead of\n> > lttng.\n> >\n> > Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>\n> > ---\n> >  Documentation/guides/tracing.rst              | 114 ++++++++++++++----\n> >  include/libcamera/internal/tracepoints.h.in   |  37 +++++-\n> >  .../internal/tracepoints/meson.build          |  25 ++--\n> >  .../internal/tracepoints/pipeline.perfetto    |  10 ++\n> >  .../internal/tracepoints/request.perfetto     |  30 +++++\n> >  meson.build                                   |   7 +-\n> >  src/android/cros/camera3_hal.cpp              |   5 +\n> >  src/android/cros/meson.build                  |   1 +\n> >  src/libcamera/meson.build                     |  14 ++-\n> >  src/libcamera/pipeline_perfetto.cpp           |  24 ++++\n> >  src/libcamera/request_perfetto.cpp            |  73 +++++++++++\n> >  src/libcamera/tracepoints.cpp                 |  11 ++\n> >  12 files changed, 312 insertions(+), 39 deletions(-)\n> >  create mode 100644\n> include/libcamera/internal/tracepoints/pipeline.perfetto\n> >  create mode 100644\n> include/libcamera/internal/tracepoints/request.perfetto\n> >  create mode 100644 src/libcamera/pipeline_perfetto.cpp\n> >  create mode 100644 src/libcamera/request_perfetto.cpp\n> >\n> > diff --git a/Documentation/guides/tracing.rst\n> b/Documentation/guides/tracing.rst\n> > index ae960d85..53d6232e 100644\n> > --- a/Documentation/guides/tracing.rst\n> > +++ b/Documentation/guides/tracing.rst\n> > @@ -16,33 +16,50 @@ at periodic points in time. This can be done with\n> other tools such as\n> >  callgrind, perf, gprof, etc., without modification to the application,\n> >  and is out of scope for this guide.\n> >\n> > +Library: Perfetto vs lttng-ust\n> > +---------\n>\n> The underline needs to be extended. (also in the other instances below)\n>\n>\nDone. Please check if I missed anything.\n\n\n> > +\n> > +To integrate with CrOS tracing infrastructure, which uses perfetto (or\n> called\n> > +CrOSetto in CrOS), we implement the tracepoint macros (will be\n> described below)\n> > +with two different libraries: CrOS with perfetto, and the rest with\n> lttng-ust.\n> > +\n> >  Compiling\n> >  ---------\n> >\n> > -To compile libcamera with tracing support, it must be enabled through\n> the\n> > -meson ``tracing`` option. It depends on the lttng-ust library\n> (available in the\n> > -``liblttng-ust-dev`` package for Debian-based distributions).\n> > -By default the tracing option in meson is set to ``auto``, so if\n> > -liblttng is detected, it will be enabled by default. Conversely, if the\n> option\n> > -is set to disabled, then libcamera will be compiled without tracing\n> support.\n> > +To compile libcamera with perfetto support in CrOS, it must be enabled\n> through\n>\n> I'd rather the wording specify \"tracing\" generically first, then\n> elaborate between perfetto and lttng.\n>\n>\nRight, updated. Please check.\n\n\n> > +the meson ``tracing`` option. In CrOS, it depends on the perfetto\n> library,\n> > +which is by default available in CrOS; In the rest, it depends on the\n> lttng-ust\n> > +library (available in the ``liblttng-ust-dev`` package for Debian-based\n> > +distributions).\n> > +By default the tracing option in meson is set to ``auto``, so if the\n> library is\n> > +detected, it will be enabled by default. Conversely, if the option is\n> set to\n> > +disabled, then libcamera will be compiled without tracing support.\n>\n> I'm wondering, does it make sense to allow both to be compiled in at the\n> same time? I guess we wouldn't use the same binary on CrOS and on\n> non-CrOS, and we wouldn't use perfetto on non-CrOS. So I guess the only\n> use case would be if lttng would ever be used on CrOS. Is that ever a\n> use case?\n>\n>\nI don't think so. CrOS Camera already supports perfetto, and it's the\nperformance\ntracing tool being used across the OS and the VMs. So I believe we don't\nhave\nthe use case to compile them both.\n\n\n> >\n> >  Defining tracepoints\n> >  --------------------\n> >\n> >  libcamera already contains a set of tracepoints. To define additional\n> > -tracepoints, create a file\n> > -``include/libcamera/internal/tracepoints/{file}.tp``, where ``file`` is\n> a\n> > -reasonable name related to the category of tracepoints that you wish to\n> > -define. For example, the tracepoints file for the Request object is\n> called\n> > -``request.tp``. An entry for this file must be added in\n> > -``include/libcamera/internal/tracepoints/meson.build``.\n> > -\n> > -In this tracepoints file, define your tracepoints `as mandated by lttng\n> > +tracepoints, create two files ``{file}.tp`` and ``{file}.perfetto``,\n> for lttng\n> > +and perfetto respectively, under\n> ``include/libcamera/internal/tracepoints/``,\n> > +and the perfetto implementation file\n> ``src/libcamera/{file}_perfetto.cpp``,\n> > +where ``file`` is a reasonable name related to the category of\n> tracepoints that\n> > +you wish to define. For example, the tracepoints files for the Request\n> object is\n> > +called ``request.tp`` and ``request.perfetto``. Entries for the files\n> must be\n> > +added in ``include/libcamera/internal/tracepoints/meson.build``.\n> > +\n> > +In the perfetto tracepoints files, declare the tracepoint functions in\n> > +``{file}.perfetto``, and define them in ``{file}_perfetto.cpp``, `as\n> mandated\n> > +by perfetto <https://perfetto.dev/docs/instrumentation/track-events>`_.\n> > +Currently the only enabled perfetto::Category is ``libcamera``. If you\n> intend to\n> > +use another category, remember to define it in\n>\n> I'm wondering if category here in perfetto means something different\n> than lttng's? lttng only has the top-level category then the trace name\n> (afaik), so the top-level category is \"libcamera\" and after that we end\n> up using an underscore-separated prefix.\n>\n> Does perfetto allow another level of catetories? I don't seem to see\n> any, in which case I think we should just remove this section, as all\n> the tracepoints that this section refers to are internal to libcamera,\n> so they'd all use the \"libcamera\" category.\n>\n>\nSo perfetto would allow multiple categories. Currently yes, all tracepoints\nbelong to the same category \"libcamera\". But I just wanted to mention\nhere that it's possible for developers to add other categories to filter\ntracepoints in the future.\n\nDo you think that's worth mentioning here?\n\n\n> > +``include/libcamera/internal/tracepoints.h.in``, and enable it when\n> collecting\n> > +traces.\n>\n> Do you think it's feasible to have just one definition and we can use it\n> to generate the other? I'd say use lttng's (because it's more specific,\n> like how it specifies the types of the fields) and then use that to\n> generate perfetto's.\n>\n> Or is it better to just make sure that each tracepoint is defined twice?\n> I'm not fond of the duplicate work though, so tbh I'd rather one\n> definition that generates the other, if that's feasible. (Is it time for\n> me to write yet another code generator?)\n>\n>\nSorry, I'm not sure what's in your picture, and I don't really understand\nhow lttng works: is it to have only one set of macro definitions\n(LIBCAMERA_TRACEPOINT, LIBCAMERA_TRACEPOINT_IPA_BEGIN,\nLIBCAMERA_TRACEPOINT_IPA_END)? Into the macro `tracepoint`?\n\nCould you give a simple POC that covers one macro? Thanks!\n\n\n> > +\n> > +In the lttng tracepoints file, define your tracepoints `as mandated by\n> lttng\n> >  <https://lttng.org/man/3/lttng-ust>`_. The header boilerplate must\n> *not* be\n> >  included (as it will conflict with the rest of our infrastructure), and\n> >  only the tracepoint definitions (with the ``TRACEPOINT_*`` macros)\n> should be\n> >  included.\n> > -\n> >  All tracepoint providers shall be ``libcamera``. According to lttng, the\n> >  tracepoint provider should be per-project; this is the rationale for\n> this\n> >  decision. To group tracepoint events, we recommend using\n> > @@ -68,9 +85,9 @@ Then to use the tracepoint:\n> >\n> >  ``LIBCAMERA_TRACEPOINT({tracepoint_event}, args...)``\n> >\n> > -This macro must be used, as opposed to lttng's macros directly, because\n> > -lttng is an optional dependency of libcamera, so the code must compile\n> and run\n> > -even when lttng is not present or when tracing is disabled.\n> > +This macro must be used, as opposed to perfetto's/lttng's macros\n> directly,\n>\n> s$perfetto's/lttng's$perfetto's or lttng's$\n>\n>\nDone.\n\n\n> > +because tracing support is optional of libcamera, so the code must\n> compile and\n> > +run even when perfetto/lttng is not present or when tracing is disabled.\n>\n> s$perfetto/lttng is$perfetto or lttng are/\n>\n>\nDone.\n\n\n> >\n> >  The tracepoint provider name, as declared in the tracepoint definition,\n> is not\n> >  included in the parameters of the tracepoint.\n> > @@ -86,7 +103,7 @@ and when the pipeline handler receives the\n> corresponding response from the IPA,\n> >  respectively. These are the tracepoints that our sample analysis script\n> >  (see \"Analyzing a trace\") scans for when computing statistics on IPA\n> call time.\n> >\n> > -Using tracepoints (from an application)\n> > +Using lttng tracepoints (from an application)\n>\n> I think this section applies regardless of if we're using lttng or\n> perfetto.\n>\n>\nRight, updated. I also added a link to perfetto's doc. Please check :)\n\n\n> >  ---------------------------------------\n> >\n> >  As applications are not part of libcamera, but rather users of\n> libcamera,\n> > @@ -94,13 +111,66 @@ applications should seek their own tracing\n> mechanisms. For ease of tracing\n> >  the application alongside tracing libcamera, it is recommended to also\n> >  `use lttng <\n> https://lttng.org/docs/#doc-tracing-your-own-user-application>`_.\n> >\n> > -Using tracepoints (from closed-source IPA)\n> > +Using lttng tracepoints (from closed-source IPA)\n>\n> Same here.\n>\n>\nDone.\n\n\n> >  ------------------------------------------\n> >\n> >  Similar to applications, closed-source IPAs can simply use lttng on\n> their own,\n> >  or any other tracing mechanism if desired.\n> >\n> > -Collecting a trace\n> > +Collecting a perfetto trace\n> > +------------------\n> > +\n> > +A trace can be collected with the following steps:\n> > +\n> > +1. Start `traced` if it hasn't been started.\n> > +.. code-block:: bash\n> > +\n> > +   start traced\n> > +\n> > +2. Start a consumer that includes “track_event” data source in the trace\n> > +   config, and “libcamera” category.\n> > +.. code-block:: bash\n> > +\n> > +   perfetto -c - --txt -o /tmp/perfetto-trace \\\n> > +   <<EOF\n> > +\n> > +   buffers: {\n> > +       size_kb: 63488\n> > +       fill_policy: DISCARD\n> > +   }\n> > +   buffers: {\n> > +       size_kb: 2048\n> > +       fill_policy: DISCARD\n> > +   }\n> > +   data_sources: {\n> > +        config {\n> > +            name: \"track_event\"\n> > +            track_event_config {\n> > +                enabled_categories: \"libcamera\"\n> > +            }\n> > +        }\n> > +   }\n> > +   duration_ms: 10000\n> > +\n> > +   EOF\n>\n> Does this have to be fed through stdin or is there an option for\n> feeding it as a file?\n>\n>\nBoth stdin or a file work, `perfetto --help` shows:\n```--config         -c      : /path/to/trace/config/file or - for stdin```\n\nDo you think I should put this instead of instructing developers to use\nstdin?\n\n\n> > +\n> > +3. Execute the libcamera behavior you intend to trace during the set\n> duration\n> > +   (10000 ms) in the above example.\n> > +\n> > +4. After the consumer (cmd `perfetto`) is done, you can find the trace\n> result\n> > +   in ``/tmp/perfetto-trace``.\n> > +\n> > +Analyzing a perfetto trace\n> > +-----------------\n> > +\n> > +Follow the `guide <https://perfetto.dev/docs/visualization/perfetto-ui>`_\n> to\n> > +visualize the trace.\n> > +\n> > +In other words, upload the trace to `Perfetto UI <\n> https://ui.perfetto.dev/>`_,\n> > +where you can check the timeline of tracepoints on each process/thread.\n> You can\n> > +also run SQL queries to do analysis.\n> > +\n> > +Collecting a lttng trace\n>\n> s/a/an/ (yeah, english sucks)\n>\n>\nAh right. Thanks!\n\n\n> >  ------------------\n> >\n> >  A trace can be collected fairly simply from lttng:\n> > @@ -123,7 +193,7 @@ viewed by: ``lttng view -t $PATH_TO_TRACE``, where\n> ``$PATH_TO_TRACE`` is the\n> >  path that was printed when the session was created. This is the same\n> path that\n> >  is used when analyzing traces programatically, as described in the next\n> section.\n> >\n> > -Analyzing a trace\n> > +Analyzing a lttng trace\n>\n> Same here.\n>\n>\nDone.\n\n\n> >  -----------------\n> >\n> >  As mentioned above, while an lttng tracing session exists and the trace\n> is not\n> > diff --git a/include/libcamera/internal/tracepoints.h.in\n> b/include/libcamera/internal/tracepoints.h.in\n> > index d0fc1365..d91fadd7 100644\n> > --- a/include/libcamera/internal/tracepoints.h.in\n> > +++ b/include/libcamera/internal/tracepoints.h.in\n> > @@ -9,7 +9,24 @@\n> >  #ifndef __LIBCAMERA_INTERNAL_TRACEPOINTS_H__\n> >  #define __LIBCAMERA_INTERNAL_TRACEPOINTS_H__\n> >\n> > -#if HAVE_TRACING\n> > +#if HAVE_PERFETTO\n> > +\n> > +#include <perfetto/perfetto.h>\n> > +\n> > +PERFETTO_DEFINE_CATEGORIES(\n> > +     perfetto::Category(\"libcamera\")\n> > +             .SetDescription(\"Events from libcamera\"));\n> > +\n> > +#define LIBCAMERA_TRACEPOINT(t_name, ...) \\\n> > +LIBCAMERA_TRACE_EVENT_##t_name(__VA_ARGS__)\n> > +\n> > +#define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func) \\\n> > +LIBCAMERA_TRACE_EVENT_ipa_call_begin(#pipe, #func)\n> > +\n> > +#define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func) \\\n> > +LIBCAMERA_TRACE_EVENT_ipa_call_end(#pipe, #func)\n> > +\n> > +#elif HAVE_TRACING /* !HAVE_PERFETTO */\n> >  #define LIBCAMERA_TRACEPOINT(...) tracepoint(libcamera, __VA_ARGS__)\n> >\n> >  #define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func) \\\n> > @@ -18,7 +35,7 @@ tracepoint(libcamera, ipa_call_begin, #pipe, #func)\n> >  #define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func) \\\n> >  tracepoint(libcamera, ipa_call_end, #pipe, #func)\n> >\n> > -#else\n> > +#else /* HAVE_PERFETTO */\n>\n> Should this be /* !HAVE_PERFETTO && !HAVE_TRACING */ ?\n>\n>\nRight, updated.\n\n\n> Also, probably we should rename TRACING to LTTNG everywhere. perfetto is\n> tracing too, so it sounds kind of weird to say \"!HAVE_TRACING but\n> HAVE_PERFETTO\", at least imo.\n>\n>\nYes, I've also considered that. Updated.\n\n\n> >\n> >  namespace {\n> >\n> > @@ -34,12 +51,15 @@ inline void unused([[maybe_unused]] Args&& ...args)\n> >  #define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func)\n> >  #define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func)\n> >\n> > -#endif /* HAVE_TRACING */\n> > +#endif /* HAVE_PERFETTO */\n> >\n> >  #endif /* __LIBCAMERA_INTERNAL_TRACEPOINTS_H__ */\n> >\n> > +#if HAVE_PERFETTO\n> > +\n> > +#include <perfetto/perfetto.h>\n> >\n> > -#if HAVE_TRACING\n> > +#elif HAVE_TRACING\n> >\n> >  #undef TRACEPOINT_PROVIDER\n> >  #define TRACEPOINT_PROVIDER libcamera\n> > @@ -52,10 +72,15 @@ inline void unused([[maybe_unused]] Args&& ...args)\n> >\n> >  #include <lttng/tracepoint.h>\n> >\n> > -{{source}}\n>\n> This won't work, as we need the header guard on the next line.\n>\n>\nUpdated. Please check again.\n\n\n> >\n> >  #endif /* INCLUDE_LIBCAMERA_INTERNAL_TRACEPOINTS_TP_H */\n> >\n> >  #include <lttng/tracepoint-event.h>\n> >\n> > -#endif /* HAVE_TRACING */\n> > +#endif /* HAVE_PERFETTO */\n> > +\n> > +#if HAVE_PERFETTO || HAVE_TRACING\n> > +\n> > +{{source}}\n> > +\n> > +#endif /* HAVE_PERFETTO || HAVE_TRACING */\n>\n> So this needs to be shuffled around.\n>\n>\nUpdated. Please check again.\n\n\n> > diff --git a/include/libcamera/internal/tracepoints/meson.build\n> b/include/libcamera/internal/tracepoints/meson.build\n> > index d9b2fca5..ff5aece6 100644\n> > --- a/include/libcamera/internal/tracepoints/meson.build\n> > +++ b/include/libcamera/internal/tracepoints/meson.build\n> > @@ -1,12 +1,19 @@\n> >  # SPDX-License-Identifier: CC0-1.0\n> >\n> > -# enum files must go first\n> > -tracepoint_files = files([\n> > -    'buffer_enums.tp',\n> > -    'request_enums.tp',\n> > -])\n> > +if get_option('android').enabled() and get_option('android_platform')\n> == 'cros'\n> > +  tracepoint_files = files([\n> > +      'pipeline.perfetto',\n> > +      'request.perfetto',\n> > +  ])\n> > +else\n> > +  # enum files must go first\n> > +  tracepoint_files = files([\n> > +      'buffer_enums.tp',\n> > +      'request_enums.tp',\n> > +  ])\n> >\n> > -tracepoint_files += files([\n> > -    'pipeline.tp',\n> > -    'request.tp',\n> > -])\n> > +  tracepoint_files += files([\n> > +      'pipeline.tp',\n> > +      'request.tp',\n> > +  ])\n> > +endif\n> > diff --git a/include/libcamera/internal/tracepoints/pipeline.perfetto\n> b/include/libcamera/internal/tracepoints/pipeline.perfetto\n> > new file mode 100644\n> > index 00000000..5f45295e\n> > --- /dev/null\n> > +++ b/include/libcamera/internal/tracepoints/pipeline.perfetto\n> > @@ -0,0 +1,10 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2022, Google Inc.\n> > + *\n> > + * pipeline.tp - Tracepoints for pipelines\n> > + */\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_ipa_call_begin(const char *pipe, const char\n> *func);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_ipa_call_end(const char *pipe, const char\n> *func);\n> > diff --git a/include/libcamera/internal/tracepoints/request.perfetto\n> b/include/libcamera/internal/tracepoints/request.perfetto\n> > new file mode 100644\n> > index 00000000..fd6a42a4\n> > --- /dev/null\n> > +++ b/include/libcamera/internal/tracepoints/request.perfetto\n> > @@ -0,0 +1,30 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2022, Google Inc.\n> > + *\n> > + * request.tp - Tracepoints for the request object\n> > + */\n> > +\n> > +#include <libcamera/internal/request.h>\n> > +\n> > +#include <libcamera/framebuffer.h>\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request(libcamera::Request *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_construct(libcamera::Request *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_destroy(libcamera::Request *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_reuse(libcamera::Request *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_queue(libcamera::Request *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_device_queue(libcamera::Request\n> *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_complete(libcamera::Request::Private\n> *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_cancel(libcamera::Request::Private\n> *req);\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_complete_buffer(\n> > +             libcamera::Request::Private *req,\n> > +             libcamera::FrameBuffer * buf);\n> > diff --git a/meson.build b/meson.build\n> > index 29d8542d..434540e1 100644\n> > --- a/meson.build\n> > +++ b/meson.build\n> > @@ -125,7 +125,11 @@ libcamera_includes = include_directories('include')\n> >  py_modules = []\n> >\n> >  # Libraries used by multiple components\n> > -liblttng = cc.find_library('lttng-ust', required :\n> get_option('tracing'))\n> > +libperfetto = dependency('perfetto', required :\n> get_option('tracing').enabled()\n> > +    and get_option('android').enabled()\n> > +    and get_option('android_platform') == 'cros')\n> > +liblttng = cc.find_library('lttng-ust', required :\n> get_option('tracing').enabled()\n> > +    and not libperfetto.found())\n> >\n> >  # Pipeline handlers\n> >  #\n> > @@ -176,6 +180,7 @@ py_mod.find_installation('python3', modules:\n> py_modules)\n> >  summary({\n> >              'Enabled pipelines': pipelines,\n> >              'Enabled IPA modules': ipa_modules,\n> > +            'Perfetto support': perfetto_enabled,\n> >              'Tracing support': tracing_enabled,\n> >              'Android support': android_enabled,\n> >              'GStreamer support': gst_enabled,\n> > diff --git a/src/android/cros/camera3_hal.cpp\n> b/src/android/cros/camera3_hal.cpp\n> > index fb863b5f..2fbd7f14 100644\n> > --- a/src/android/cros/camera3_hal.cpp\n> > +++ b/src/android/cros/camera3_hal.cpp\n> > @@ -7,10 +7,15 @@\n> >\n> >  #include <cros-camera/cros_camera_hal.h>\n> >\n> > +#include \"libcamera/internal/tracepoints.h\"\n> >  #include \"../camera_hal_manager.h\"\n> >\n> >  static void set_up([[maybe_unused]] cros::CameraMojoChannelManagerToken\n> *token)\n> >  {\n> > +     perfetto::TracingInitArgs args;\n> > +     args.backends |= perfetto::kSystemBackend;\n> > +     perfetto::Tracing::Initialize(args);\n> > +     perfetto::TrackEvent::Register();\n> >  }\n> >\n> >  static void tear_down()\n> > diff --git a/src/android/cros/meson.build b/src/android/cros/meson.build\n> > index 35995dd8..68f2bd9e 100644\n> > --- a/src/android/cros/meson.build\n> > +++ b/src/android/cros/meson.build\n> > @@ -9,5 +9,6 @@ android_hal_sources += files([\n> >  ])\n> >\n> >  android_deps += dependency('libcros_camera')\n> > +android_deps += dependency('perfetto')\n> >\n> >  android_cpp_args += ['-DOS_CHROMEOS']\n> > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> > index 26912ca1..39a55a17 100644\n> > --- a/src/libcamera/meson.build\n> > +++ b/src/libcamera/meson.build\n> > @@ -71,11 +71,22 @@ if libgnutls.found()\n> >      config_h.set('HAVE_GNUTLS', 1)\n> >  endif\n> >\n> > -if liblttng.found()\n> > +if libperfetto.found()\n> > +    perfetto_enabled = true\n> > +    tracing_enabled = false\n> > +    config_h.set('HAVE_PERFETTO', 1)\n> > +    libcamera_sources += [\n> > +        'pipeline_perfetto.cpp',\n> > +        'request_perfetto.cpp',\n> > +        'tracepoints.cpp',\n> > +    ]\n> > +elif liblttng.found()\n> > +    perfetto_enabled = false\n> >      tracing_enabled = true\n> >      config_h.set('HAVE_TRACING', 1)\n> >      libcamera_sources += files(['tracepoints.cpp'])\n> >  else\n> > +    perfetto_enabled = false\n> >      tracing_enabled = false\n> >  endif\n> >\n> > @@ -125,6 +136,7 @@ libcamera_deps = [\n> >      libdl,\n> >      libgnutls,\n> >      liblttng,\n> > +    libperfetto,\n> >      libudev,\n> >  ]\n> >\n> > diff --git a/src/libcamera/pipeline_perfetto.cpp\n> b/src/libcamera/pipeline_perfetto.cpp\n> > new file mode 100644\n> > index 00000000..07b82ffd\n> > --- /dev/null\n> > +++ b/src/libcamera/pipeline_perfetto.cpp\n>\n> Is it not possible for the definitions to go in the .perfetto file? Or\n> is there some other reason that makes it strongly discouraged?\n>\n>\nSo when I put them into the .perfetto file, which will be put in the\ngenerated tracepoints.h with `{{source}}`, even with the header\nguard INCLUDE_LIBCAMERA_INTERNAL_TRACEPOINTS_TP_H,\nit still won't compile:\n```\nld.lld: error: duplicate symbol:\nLIBCAMERA_TRACE_EVENT_request(libcamera::Request*)\n>>> defined at tracepoints.h:105\n(include/libcamera/internal/tracepoints.h:105)\n>>>\n src/libcamera/libcamera.so.0.0.2.p/pipeline_handler.cpp.o:(LIBCAMERA_TRACE_EVENT_request(libcamera::Request*))\n>>> defined at tracepoints.h:105\n(include/libcamera/internal/tracepoints.h:105)\n>>>\n src/libcamera/libcamera.so.0.0.2.p/request.cpp.o:(.text._Z29LIBCAMERA_TRACE_EVENT_requestPN9libcamera7RequestE+0x0)\n```\n\nI wonder if it's because of the header guard with another condition:\n`|| defined(TRACEPOINT_HEADER_MULTI_READ)`\n\nWDYT?\n\n\n> If it's required to be in a separate .cpp file, I'd at least want it\n> under src/libcamera/perfetto/ or src/libcamera/tracepoints/ or something\n> along those lines, and not in the top level src/libcamera/.\n>\n>\nPut them under `src/libcamera/perfetto` now.\n\n\n> That or a code generator, so that we don't have to duplicate efforts of\n> tracepoint definitions in the first place, or risk tracepoints not being\n> defined for one but not the other.\n>\n>\nI'm not sure how to add a code generator that handles some complicated\nmacros (like LIBCAMERA_TRACE_EVENT_request_complete_buffer)\nwithout great effort. Let me know if you have a great idea. Thanks!\n\n\n>\n> Thanks,\n>\n> Paul\n>\n> > @@ -0,0 +1,24 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2022, Google Inc.\n> > + *\n> > + * pipeline.tp - Tracepoints for pipelines\n> > + */\n> > +\n> > +#include \"libcamera/internal/tracepoints.h\"\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_ipa_call_begin(const char *pipe, const char\n> *func)\n> > +{\n> > +     // TODO: Consider TRACE_EVENT_BEGIN\n> > +     TRACE_EVENT(\"libcamera\", \"ipa_call_begin\",\n> > +                 \"pipeline_name\", pipe,\n> > +                 \"function_name\", func);\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_ipa_call_end(const char *pipe, const char\n> *func)\n> > +{\n> > +     // TODO: Consider TRACE_EVENT_END\n> > +     TRACE_EVENT(\"libcamera\", \"ipa_call_end\",\n> > +                 \"pipeline_name\", pipe,\n> > +                 \"function_name\", func);\n> > +}\n> > diff --git a/src/libcamera/request_perfetto.cpp\n> b/src/libcamera/request_perfetto.cpp\n> > new file mode 100644\n> > index 00000000..2cfff28e\n> > --- /dev/null\n> > +++ b/src/libcamera/request_perfetto.cpp\n> > @@ -0,0 +1,73 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2022, Google Inc.\n> > + *\n> > + * request.tp - Tracepoints for the request object\n> > + */\n> > +\n> > +#include <libcamera/framebuffer.h>\n> > +\n> > +#include \"libcamera/internal/request.h\"\n> > +#include \"libcamera/internal/tracepoints.h\"\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request(libcamera::Request *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request\",\n> > +                 \"request_ptr\", reinterpret_cast<uintptr_t>(req),\n> > +                 \"cookie\", req->cookie(),\n> > +                 \"status\", req->status()); // TODO\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_construct(libcamera::Request *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_construct\",\n> > +                 \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_destroy(libcamera::Request *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_destroy\",\n> > +                 \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_reuse(libcamera::Request *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_reuse\",\n> > +                 \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_queue(libcamera::Request *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_queue\",\n> > +                 \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_device_queue(libcamera::Request *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_device_queue\",\n> > +                 \"request_ptr\", reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_complete(libcamera::Request::Private\n> *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_complete\",\n> > +                 \"request_private_ptr\",\n> reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_cancel(libcamera::Request::Private\n> *req)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_cancel\",\n> > +                 \"request_private_ptr\",\n> reinterpret_cast<uintptr_t>(req));\n> > +}\n> > +\n> > +void LIBCAMERA_TRACE_EVENT_request_complete_buffer(\n> > +     libcamera::Request::Private *req,\n> > +     libcamera::FrameBuffer *buf)\n> > +{\n> > +     TRACE_EVENT(\"libcamera\", \"request_complete_buffer\",\n> > +                 \"request_private_ptr\",\n> reinterpret_cast<uintptr_t>(req),\n> > +                 \"cookie\", req->_o<libcamera::Request>()->cookie(),\n> > +                 \"status\", req->_o<libcamera::Request>()->status(), //\n> TODO\n> > +                 \"buffer_ptr\", reinterpret_cast<uintptr_t>(buf),\n> > +                 \"buffer_status\", buf->metadata().status); // TODO\n> > +}\n> > diff --git a/src/libcamera/tracepoints.cpp\n> b/src/libcamera/tracepoints.cpp\n> > index 0173b75a..a07ea531 100644\n> > --- a/src/libcamera/tracepoints.cpp\n> > +++ b/src/libcamera/tracepoints.cpp\n> > @@ -4,7 +4,18 @@\n> >   *\n> >   * tracepoints.cpp - Tracepoints with lttng\n> >   */\n> > +\n> > +#if HAVE_PERFETTO\n> > +\n> > +#include \"libcamera/internal/tracepoints.h\"\n> > +\n> > +PERFETTO_TRACK_EVENT_STATIC_STORAGE();\n> > +\n> > +#else\n> > +\n> >  #define TRACEPOINT_CREATE_PROBES\n> >  #define TRACEPOINT_DEFINE\n> >\n> >  #include \"libcamera/internal/tracepoints.h\"\n> > +\n> > +#endif /* HAVE_PERFETTO */\n> > --\n> > 2.37.1.359.gd136c6c3e2-goog\n> >\n>","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 F369FC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Dec 2022 07:06:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD401633A2;\n\tTue, 20 Dec 2022 08:06:57 +0100 (CET)","from mail-vk1-xa2e.google.com (mail-vk1-xa2e.google.com\n\t[IPv6:2607:f8b0:4864:20::a2e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D991161F15\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Dec 2022 08:06:55 +0100 (CET)","by mail-vk1-xa2e.google.com with SMTP id t191so5367188vkb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Dec 2022 23:06:55 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1671520017;\n\tbh=ZPqR8Kj7/0ippj1Mqn8nFXN1fgU8NuKmG5dzzOpwJ1g=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=eidxdTRiwIfqLbPFcLIkxVhFVz1x5nagEHjtrh0lzGhyhfWBeYA0AuiwNHrjFoqpH\n\tAHF/ab52IGgLAI2F9Aoj1NyvfCVI4A/avNrLvtZhQi6CHTEU9F67k775v86D+Dm0zL\n\tDUR4QgyleQT2el5GUGE7CQKSTlJDwowPZvRq37zeZYZ3tEn+8q4UCdGFOyho2TXDkq\n\tg+AMXtmQHNDTCf1R4gqth05pQ3sIzSr5G2I8Ed6Iv8gsFZOQASQg2sLy8zlrqQDHDU\n\tJ8jCnfJnSZs+IpaQUNIkDUwckHL4Ui5R2ibgGLv/bcznruAaW+Ly8bxLmOzT7LxI32\n\toQLfvFVDDTJBg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=bx9tfsh63AZ+t2CU2HMfDQhSE0+GTF5QROW9HWHYvqU=;\n\tb=CzQNHXf/QycbBkq9BvPwe6cqaXAPVobBna9KcW/Z9u4Y32uBzle+TCLe5dOt8abOKj\n\tiXRoTjRj/4B/ZR11JK53fFj/Prjrn4WPKbMHtO2KBIU1o/d0DiRwJeP6Yr4FZnmZJ7mV\n\twWwzL0qnse5xt0TjiaDIKXTNsvZGI3gqbaUiA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"CzQNHXf/\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=bx9tfsh63AZ+t2CU2HMfDQhSE0+GTF5QROW9HWHYvqU=;\n\tb=21Kx1eWeOrDbPeoIMKTLBXurC11b0NFzRQKuraH9EeMZRZMOB/vgQhd+/MTek0wtN5\n\tCLppkhtv7C38Jl8ZdZVTBCjaB2HWPkJk6OjNiUIMnYJb9ZFALMKY632hN5N0/jCkYYHU\n\tF2xaGL9jQygL3XcKlnwoBE0LMpawO1pwJNAM8/79+qwcePnJZxJCizdG/IlMU89g0jDU\n\t6wmyydViQeZ+BpxnxUV9KbEPC+XqnpHZ5xbZlbmvitR7hnR2T66X/5/nH8pofkG7evcm\n\tcR3KohR0rGc2fn6iHnyqQTI3kub3F1Dg+R72VKLPECZVPqP5Dvfk466Fow0hT9SXYB0g\n\tUDYg==","X-Gm-Message-State":"ANoB5pmCL1y4VIn2nMtb5y1qeEnOj7yPil48H61USSG3tFIRGMZCvbll\n\thhKxZTztYxR2AA1RBdaTqFI77RNvkA4gnZCBdwDi7Q==","X-Google-Smtp-Source":"AA0mqf7cQM0IEzcNMIWg7l/dqh3kU7bsvTCCB4eR6a1H1rNtjqbnUBathi/ZAciMRFQwR6IOD2VVMLLXNKHmnNTvW9I=","X-Received":"by 2002:a1f:2d8b:0:b0:3b8:615e:f0a with SMTP id\n\tt133-20020a1f2d8b000000b003b8615e0f0amr52284367vkt.34.1671520014519;\n\tMon, 19 Dec 2022 23:06:54 -0800 (PST)","MIME-Version":"1.0","References":"<20220722120028.3155712-1-chenghaoyang@google.com>\n\t<20220722120028.3155712-2-chenghaoyang@google.com>\n\t<Y5lx1cSjoGBQOhBf@pyrite.rasen.tech>","In-Reply-To":"<Y5lx1cSjoGBQOhBf@pyrite.rasen.tech>","Date":"Tue, 20 Dec 2022 15:06:43 +0800","Message-ID":"<CAEB1ahuPury4BaNyHb7O8aXkX5MGHB7Ty80yiZVt=uUenmPx-Q@mail.gmail.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000b36a8405f03d147f\"","Subject":"Re: [libcamera-devel] [PATCH v2 1/1] Use tracing with perfetto in\n\tChromeOS","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>","From":"Cheng-Hao Yang via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Cheng-Hao Yang <chenghaoyang@chromium.org>","Cc":"Harvey Yang <chenghaoyang@google.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]