-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tracing sdk documentation outdated #28
Comments
pulling open /tmp/perfetto/sdk/perfetto.cc, I can see a note:
so it looks like the macro PERFETTO_DEFINE_CATEGORIES(PERFETTO_CATEGORY("hello")); Now this fails with:
|
@skyostil @betasheet |
I have a feeling this might be missing a: We should probably add this to the docs :) FWIW, perfetto::Category should also work, not sure why it doesn't. We have tests that use it: The PERFETTO_CATEGORY macro is deprecated and only expands to perfetto::Category too: |
I think we really need a snippet / example source code that works. |
The issue here is that the v3.1 SDK is fairly old at this point and doesn't match the latest API described by the documentation. The code here needs two changes to match v3.1: category registration and adding the static storage macro as pointed out by @betasheet: #include <perfetto.h>
#include <unistd.h>
PERFETTO_DEFINE_CATEGORIES(
PERFETTO_CATEGORY(hello));
PERFETTO_TRACK_EVENT_STATIC_STORAGE();
void do_sleep() {
TRACE_EVENT("hello", "do_sleep");
sleep(3);
}
int main(int argv, char** argc) {
perfetto::TracingInitArgs args;
args.backends |= perfetto::kInProcessBackend;
perfetto::Tracing::Initialize(args);
perfetto::TrackEvent::Register();
do_sleep();
} I checked that this builds with: c++ -I perfetto/sdk -lpthread hello.cc perfetto/sdk/perfetto.cc Here's a repo with fully working minimal examples with v3.1: https://github.com/skyostil/perfetto-sdk-example @primiano -- let's make a new SDK release to bring everything in line. Also, should we somehow merge the above repo and https://github.com/primiano/perfetto-sdk? |
Ahh gotcha. |
@nickdesaulniers can you check if this JustWorks with v4.0 we just released? |
With v4.1 we now also have integrated the SDK samples into the repository: https://cs.android.com/android/platform/superproject/+/master:external/perfetto/examples/sdk/README.md Let me close this this issue. If you run into more problems with the SDK, please open a new issue. |
Was the updated documentation pushed? Next n00b question, when I run the produced $ ./a.out
[093.170] perfetto.cc:46436 Producer 1 connected
[093.170] perfetto.cc:37317 Producer connected
[093.170] perfetto.cc:48099 Producer 1 registered data source "track_event" does this write a trace somewhere (using in process mode)? https://perfetto.dev/docs/quickstart/linux-tracing seems to imply that another command line utility is needed? |
I think so given the updated tag.
Those log statements are only about the initialization. Tracing is not started at that point (you'd see a "Enabling tracing... " message otherwise.
Those docs apply only to system-mode and not to in-process mode. |
As a big fan of systrace on Android, I was looking to make use of perfetto to measure custom events in LLVM running on a Linux host.
I'm having a hard time from the documentation building a library+header that I can link against+include into a simple hello world binary. Once I have that figured out, I'd like to wire it up to LLVM's build system.
I'm mostly following this page: https://perfetto.dev/docs/instrumentation/tracing-sdk
It provides instructions for building against libperfetto using Cmake. While that's what we'll end up using for LLVM, for hello world I just want to know the
-I
,-l
and-L
commands (where to search for includes, what library to link against, where to search for libraries).When I try to build hello world:
via
I see the following failures:
The text was updated successfully, but these errors were encountered: