[libcamera-devel] [PATCH 0/1] Use tracing with perfetto in ChromeOS

Cheng-Hao Yang chenghaoyang at chromium.org
Tue Nov 1 04:06:20 CET 2022


Hi folks,
I'd like to request for another round of review of this patch. It'd really
help a lot for performance tracing in CrOS.
If we could adopt it outside of ChromeOS and Android, it'd be better :)

On Fri, Jul 22, 2022 at 9:04 PM Cheng-Hao Yang <chenghaoyang at chromium.org>
wrote:

> Uploaded PATCH v2. Descriptions and instructions are added in the
> document: tracing.rst. Please check :)
> I don't know how to split up the patch elegantly though...
>
> > It would be nice if we could avoid maintaining different tracing
> frameworks. My main issue with perfetto is that it's not packaged by
> distributions, making it hard to use outside of Chrome OS and Android.
> Yeah, that's an issue... The source of truth is in aosp, and it was meant
> to support Android/Chromium in the first place IIUC...
>
>
Actually perfetto provides the sdk to be included for traces providers,
like [1]. Would that help?
A server (traced) is still needed in the system to connect traces providers
and collectors though...

[1]:
https://android.googlesource.com/platform/external/perfetto/+/refs/heads/releases/v30.x/sdk/


> BR,
> Harvey
>
> On Wed, Jul 20, 2022 at 6:38 PM Laurent Pinchart <
> laurent.pinchart at ideasonboard.com> wrote:
>
>> On Wed, Jul 20, 2022 at 04:57:22PM +0800, Cheng-Hao Yang wrote:
>> > Hi Laurent,
>> >
>> > > Do you know if there's an easy way to try perfetto on a non-Chrome OS
>> > (and non-Android) device ?
>> > I haven't tried it myself, but on the Perfetto Docs, there are
>> instructions
>> > to capture a trace on Linux [1]. I'm not sure what kind of traces you'd
>> get
>> > though :)
>> >
>> > Do you mean that we might consider using perfetto in libcamera, not
>> only on
>> > ChromeOS devices?
>>
>> It would be nice if we could avoid maintaining different tracing
>> frameworks. My main issue with perfetto is that it's not packaged by
>> distributions, making it hard to use outside of Chrome OS and Android.
>>
>> > With a trace result (like I attached in the last message) though, we can
>> > see the visualized result on any devices with a browser, FYI.
>> >
>> > [1]: https://perfetto.dev/docs/quickstart/linux-tracing
>> >
>> > On Wed, Jul 20, 2022 at 4:49 PM Laurent Pinchart wrote:
>> > > On Tue, Jul 19, 2022 at 05:20:56PM +0800, Cheng-Hao Yang via
>> libcamera-devel wrote:
>> > > > Hi Kieran,
>> > > >
>> > > > Thanks for looking into this! I'll add more
>> description/instructions in the
>> > > > README, including adding new tracing points and how to check the
>> tracing
>> > > > result.
>> > >
>> > > Thank you.
>> > >
>> > > > In the meantime, you can try https://ui.perfetto.dev with the
>> attached
>> > > > tracing result I recorded. In the "Show timeline" tab, you can see
>> that
>> > > > there are quite some traces with Category "libcamera "in
>> CameraModuleThr 9
>> > > > & CameraDeviceOps 11. Those might be helpful when we need to debug
>> > > > something :)
>> > >
>> > > Do you know if there's an easy way to try perfetto on a non-Chrome OS
>> > > (and non-Android) device ?
>> > >
>> > > > On Mon, Jul 18, 2022 at 7:49 PM Kieran Bingham wrote:
>> > > > > Quoting Harvey Yang via libcamera-devel (2022-06-15 15:20:50)
>> > > > > > Hello everyone,
>> > > > > >
>> > > > > > This is the first draft of the patch(es) that uses tracing with
>> perfetto
>> > > > > > instead of lttng when libcamera is used in ChromeOS, which
>> already uses
>> > > > > > perfetto to collect traces in most of the applications/services.
>> > > > > >
>> > > > > > Please take a look and see if it's the right direction to go.
>> Mostly I
>> > > > > > copied and pasted the simple producer in chromiumos (also
>> written by
>> > > > > > me :) ):
>> > > > > >
>> > > > > >
>> https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/perfetto_simple_producer
>> > > > > >
>> > > > >
>> > > > > This looks interesting, and the perfetto UI viewer tool [0] looks
>> good too.
>> > > > >
>> > > > > [0] https://ui.perfetto.dev/
>> > > > >
>> > > > > Could you summarise some instructions on how to test this please?
>> > > > > A good visualisation for libcamera internals would be great. I
>> would
>> > > > > love to see this able to switch between showing what each thread /
>> > > > > component is busy processing, or have the timeline present the
>> progress
>> > > > > of Requests through the system.
>> > > > >
>> > > > > > Harvey Yang (1):
>> > > > > >   Use tracing with perfetto in ChromeOS
>> > > > > >
>> > > > > >  include/libcamera/internal/tracepoints.h.in   | 37 +++++++++--
>> > > > > >  .../internal/tracepoints/meson.build          | 25 ++++---
>> > > > > >  .../internal/tracepoints/pipeline.perfetto    | 10 +++
>> > > > > >  .../internal/tracepoints/request.perfetto     | 30 +++++++++
>> > > > > >  meson.build                                   |  1 +
>> > > > > >  src/android/cros/camera3_hal.cpp              |  5 ++
>> > > > > >  src/android/cros/meson.build                  |  1 +
>> > > > > >  src/libcamera/meson.build                     | 18 ++++-
>> > > > > >  src/libcamera/pipeline_perfetto.cpp           | 22 +++++++
>> > > > > >  src/libcamera/request_perfetto.cpp            | 65
>> +++++++++++++++++++
>> > > > > >  src/libcamera/tracepoints.cpp                 | 11 ++++
>> > > > > >  11 files changed, 209 insertions(+), 16 deletions(-)
>> > > > > >  create mode 100644
>> include/libcamera/internal/tracepoints/pipeline.perfetto
>> > > > > >  create mode 100644
>> include/libcamera/internal/tracepoints/request.perfetto
>> > > > > >  create mode 100644 src/libcamera/pipeline_perfetto.cpp
>> > > > > >  create mode 100644 src/libcamera/request_perfetto.cpp
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20221101/a953997b/attachment.htm>


More information about the libcamera-devel mailing list