google / perfetto

Performance instrumentation and tracing for Android, Linux and Chrome (read-only mirror of https://android.googlesource.com/platform/external/perfetto/)
https://www.perfetto.dev
Apache License 2.0
2.75k stars 344 forks source link

[question] where to modify to trace custom proc/sysfs node? #110

Closed jinwooahn closed 3 years ago

jinwooahn commented 3 years ago

Hello. I've noticed that perfetto is great project. My company released new device driver for Linux/Android and it provides proc/sysfs node(knob) for detailed status. The QA team is going to test the device for a while and check the proc/sysfs node every second. I'd like to introduce perfetto for tracing custom proc/sysfs node, and trying to find which code to modify. I guess it's similar to poll /proc/meminfo. Could you guide me or give some hints? I'd like to add new trace point and maybe I could contribute :)

primiano commented 3 years ago

The code that polls meminfo is in https://cs.android.com/android/platform/superproject/+/master:external/perfetto/src/traced/probes/sys_stats/sys_stats_data_source.cc?q=meminfo%20f:perfetto%20f:%5C.cc

For something custom I'd advise to take a look at the SDK @ https://perfetto.dev/docs/instrumentation/tracing-sdk and create a dedicated process.

jinwooahn commented 3 years ago

@primiano Thank you so much!