Git Product home page Git Product logo

google / perfetto Goto Github PK

View Code? Open in Web Editor NEW
2.3K 61.0 296.0 105.49 MB

Performance instrumentation and tracing for Android, Linux and Chrome (read-only mirror of https://android.googlesource.com/platform/external/perfetto/)

Home Page: https://www.perfetto.dev

License: Apache License 2.0

Python 10.47% C 1.76% C++ 68.51% Makefile 0.06% Shell 0.47% HTML 0.12% JavaScript 0.62% Java 0.08% CSS 0.03% TypeScript 15.35% Dockerfile 0.04% Starlark 1.57% SCSS 0.93% Meson 0.01%

perfetto's Introduction

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.

perfetto's People

Contributors

amayzner avatar android-build-merge-worker-robot avatar anindita avatar betasheet avatar carlscabgro avatar cervantesyu avatar cferris1000 avatar chromy avatar ddiproietto avatar ddrone avatar deepanjanroy avatar delphij avatar fmayer avatar hugojacob avatar ilkos avatar isabelle49 avatar lalitmaganti avatar michaschwab avatar nicomazz avatar octaviantu avatar primiano avatar rsavitski avatar rschiu avatar rslawik avatar silence-do-good avatar skyostil avatar ssiddhartha avatar stevegolton avatar vinterstum avatar zezeozue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perfetto's Issues

WebUSB Issues

I tested perfetto on linux and windows successfully on multiple machines, but not on the laptops we use for work when running windows. (A similar laptop running linux works.)

Initially no devices showed up. I enabled chrome://flags/#new-usb-backend which showed the device but then it results in the following:
image
image

Any insight? Any thoughts on how to debug this?

Edit: I uninstalled dg_ssudbus driver. Slightly different results. With the new-usb-backend in default state, I can pair the device, but it doesn't do anything after I grant permissions. With new-usb-backend enabled, it yields the same error. This is the device log with new-usb-backend in default state:

image

Allow filtering/stripping of processes by name/pid

For mostly self contained processes it's useful to have a trace of only one process and it's children.

If we want scheduler/memory traces, a lot of unnecessary info gets added to the trace. Stripping this data from the protobuf or being able to filter it in the UI would be really useful.

It'd be nice to apply filters to ftrace by process name and remove any other processes from the trace.

Add documentation for TRACE_EVENT_BEGIN/END

The App Instrumentation docs use TRACE_EVENT_BEGIN/TRACE_EVENT_END in a code block without describing what they do.

The behavior of these macros should probably be explicitly documented as they are fairly useful.

Use heapprofd in android 8/9

Hi,
I'm trying to use heapprofd in android 8/9 ,Any suggestions? Or is it feasible?

"NOTE: heapprofd requires Android 10 or higher" , I seen this in docs.

The utid for swapper in sched_slice does not reflect that there is a swapper thread per cpu

Looking at the first elements of the sched table of a perfetto trace:

> select id, ts, cpu, utid, end_state from sched limit 4
id                   ts                   cpu                  utid                 end_state            
-------------------- -------------------- -------------------- -------------------- -------------------- 
                   0       12773083087641                    2                    1 S                    
                   1       12773083121703                    0                    0 R                    
                   2       12773083132120                    2                    2 S                    
                   3       12773083156755                    2                    0 R                    

Query executed in 0.185 ms

id 1 and 3 have both utid 0, which corresponds to:

> select utid, id, type, tid, name from thread where utid=0
utid                 id                   type                 tid                  name                 
-------------------- -------------------- -------------------- -------------------- -------------------- 
                   0                    0 internal_thread                         0 swapper/2            

Query executed in 0.191 ms

However, if we look at the actual trace, those events correspond to different swappers:

$ trace_to_text systrace mytrace.pftrace mytrace.txt
[...]
$ head -15 mytrace.txt
# tracer: nop
#
# entries-in-buffer/entries-written: 30624/30624   #P:4
#
#                                      _-----=> irqs-off
#                                     / _----=> need-resched
#                                    | / _---=> hardirq/softirq
#                                    || / _--=> preempt-depth
#                                    ||| /     delay
#           TASK-PID    TGID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |        |      |   ||||       |         |
 logd.reader.per-820   (-----) [002] .... 12773.083087: sched_switch: prev_comm=logd.reader.per prev_pid=820 prev_prio=130 prev_state=R ==> next_comm=logcat next_pid=819 next_prio=120
   kworker/u16:9-18544 (-----) [000] .... 12773.083121: sched_switch: prev_comm=kworker/u16:9 prev_pid=18544 prev_prio=120 prev_state=D ==> next_comm=swapper/0 next_pid=0 next_prio=120
          logcat-819   (-----) [002] .... 12773.083132: sched_switch: prev_comm=logcat prev_pid=819 prev_prio=120 prev_state=S ==> next_comm=logd.reader.per next_pid=820 next_prio=130
 logd.reader.per-820   (-----) [002] .... 12773.083156: sched_switch: prev_comm=logd.reader.per prev_pid=820 prev_prio=130 prev_state=S ==> next_comm=swapper/2 next_pid=0 next_prio=120

The second event has next_comm=swapper/0, where as the fourth event is next_comm=swapper/2. This is because swapper (the idle thread) is special: its next_pid is always 0, but there is one per cpu. Their name is swapper/x with x the cpu number. That's why in the actual trace, the second sched_switch's next_comm is swapper/0 (running in cpu 0) and the fourth is swapper/2 (running in cpu 2).

In my opinion, perfetto should not lose this information that was present in the sched_switch ftrace event. The thread table should have an entry per swapper/X thread, and the sched (sched_slice?) table should have a utid that refers to the correct swapper thread.

Slices don't appear when combining multiple traces

I ran a trace using Perfetto-instrumented clang to compile the Linux kernel. To aggregate all the trace data I ran cat * > trace.pftrace.

When viewing traces of this type with only a few combined traces, it works fine. For example, two kernel files being compiled:
https://ui.perfetto.dev/#!/?s=f820188f1f6ffa46788f66c063fa3201e501bb3a43a4c1548754edc9ef638

When I combine all the traces, only the first slice shows in the UI. The rest of the slices are still there as seen from the query tab.
https://ui.perfetto.dev/#!/?s=bcd722184887cbe3de14bab4ef7ca8daa3ac4d62bc3cb7a88679d4922f9e

I'm not sure if the slices are just too small, there's too much data in the trace or something else entirely.

It might be worth noting that this is a multithreaded build, so some traces have overlapping slices that were recorded through separate Perfetto instances.

tools/heap_profile not able to download trace_to_text

the response it gets is:

<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Details>No such object: perfetto/trace_to_text-mac-332099f1650ec7eaa57069344b5bcf3c23a08839</Details></Error>

cc e26b01b

"Hide Panel" in Timeline section do not work after switching to another section

  1. Load trace
  2. Select any slice ( -> Slice Details Panel appeared)
  3. Go to Query(SQL) or Stats section
  4. Go back to timeline
  5. Now details panel is hidden and and 'Hide Panel' is not working, so I can't open it
  6. But: 'Open Fullscreen' button is working, and after clicking on it, it makes 'Hide Panel' button to work the same as 'Open Fullscreen'

Buttons:
Screen Shot 2020-08-11 at 14 05 59

Build hangs

I'm on Ubuntu 18.04, and following the instructions to make the UI in the quickstart.

I left a build going overnight and came back to a stuck build, with the following error:

WARNING:root:Accessing the Emscripten cache at "/home/.../.emscripten_cache/asmjs" is taking a long time, another process should be writing to it. If there are none and you suspect this process has deadlocked, try deleting the lock file "/home/.../.emscripten_cache.lock" and try again. If this occurs deterministically, consider filing a bug.

I ran:

tools/ninja -C out/debug ui

But it was stuck with no apparent progress or obvious (i.e. glance at top) resource usage for more than 20 minutes.

I aborted this ran and re-ran with -k1 -v in order to see the command line being run, and immediately got:

[1/10] python ../../gn/standalone/write_ui_dist_file_map.py --out obj/ui/gen/dist_file_map.ts --strip ui ui/assets/brand.png ui/assets/favicon.png ui/assets/logo-3d.png ui/assets/rec_atrace.png ui/assets/rec_battery_counters.png ui/assets/rec_board_voltage.png ui/assets/rec_cpu_coarse.png ui/assets/rec_cpu_fine.png ui/assets/rec_cpu_freq.png ui/assets/rec_cpu_voltage.png ui/assets/rec_cpu_wakeup.png ui/assets/rec_ftrace.png ui/assets/rec_java_heap_dump.png ui/assets/rec_lmk.png ui/assets/rec_logcat.png ui/assets/rec_long_trace.png ui/assets/rec_mem_hifreq.png ui/assets/rec_meminfo.png ui/assets/rec_native_heap_profiler.png ui/assets/rec_one_shot.png ui/assets/rec_ps_stats.png ui/assets/rec_ring_buf.png ui/assets/rec_vmstat.png ui/assets/perfetto.scss ui/assets/typefaces.scss ui/assets/sidebar.scss ui/assets/topbar.scss ui/assets/record.scss ui/assets/common.scss ui/assets/modal.scss ui/assets/details.scss ui/assets/catapult_trace_viewer.html ui/assets/catapult_trace_viewer.js ui/controller_bundle.js ui/controller_bundle.js.map ui/engine_bundle.js ui/engine_bundle.js.map ui/frontend_bundle.js ui/frontend_bundle.js.map ui/index.html ui/perfetto.css ui/assets/MaterialIcons.woff2 ui/assets/Raleway-Regular.woff2 ui/assets/Raleway-Thin.woff2 ui/assets/RobotoCondensed-Light.woff2 ui/assets/RobotoCondensed-Regular.woff2 ui/assets/RobotoMono-Regular.woff2 ui/trace_processor.wasm ui/trace_to_text.wasm
FAILED: obj/ui/gen/dist_file_map.ts 
python ../../gn/standalone/write_ui_dist_file_map.py --out obj/ui/gen/dist_file_map.ts --strip ui ui/assets/brand.png ui/assets/favicon.png ui/assets/logo-3d.png ui/assets/rec_atrace.png ui/assets/rec_battery_counters.png ui/assets/rec_board_voltage.png ui/assets/rec_cpu_coarse.png ui/assets/rec_cpu_fine.png ui/assets/rec_cpu_freq.png ui/assets/rec_cpu_voltage.png ui/assets/rec_cpu_wakeup.png ui/assets/rec_ftrace.png ui/assets/rec_java_heap_dump.png ui/assets/rec_lmk.png ui/assets/rec_logcat.png ui/assets/rec_long_trace.png ui/assets/rec_mem_hifreq.png ui/assets/rec_meminfo.png ui/assets/rec_native_heap_profiler.png ui/assets/rec_one_shot.png ui/assets/rec_ps_stats.png ui/assets/rec_ring_buf.png ui/assets/rec_vmstat.png ui/assets/perfetto.scss ui/assets/typefaces.scss ui/assets/sidebar.scss ui/assets/topbar.scss ui/assets/record.scss ui/assets/common.scss ui/assets/modal.scss ui/assets/details.scss ui/assets/catapult_trace_viewer.html ui/assets/catapult_trace_viewer.js ui/controller_bundle.js ui/controller_bundle.js.map ui/engine_bundle.js ui/engine_bundle.js.map ui/frontend_bundle.js ui/frontend_bundle.js.map ui/index.html ui/perfetto.css ui/assets/MaterialIcons.woff2 ui/assets/Raleway-Regular.woff2 ui/assets/Raleway-Thin.woff2 ui/assets/RobotoCondensed-Light.woff2 ui/assets/RobotoCondensed-Regular.woff2 ui/assets/RobotoMono-Regular.woff2 ui/trace_processor.wasm ui/trace_to_text.wasm
Traceback (most recent call last):
  File "../../gn/standalone/write_ui_dist_file_map.py", line 90, in <module>
    sys.exit(main())
  File "../../gn/standalone/write_ui_dist_file_map.py", line 71, in main
    for fname, digest in digests.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

Re-running repeatedly, I only seem to get hangs after this, with no output. (I tried 10 times or so manually).

Running strace I see the hang is stuck on a futex wait:

[pid  4719] <... wait4 resumed> 0x7f93ded4bcf4, WNOHANG, NULL) = 0
[pid  4707] <... fcntl resumed> )       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
[pid  4719] futex(0x7f93dffa9d8c, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=86943, tv_nsec=190114030}, 0xffffffff <unfinished ...>
[pid  4707] fstat(25, {st_mode=S_IFREG|0644, st_size=2858, ...}) = 0
[pid  4707] read(25, "#!/usr/bin/env python\n# Copyrigh"..., 4096) = 2858
[pid  4707] close(25)                   = 0
[pid  4707] lseek(23, 0, SEEK_SET)      = 0
[pid  4707] futex(0x7f93dffa9d8c, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid  4719] <... futex resumed> )       = 0
[pid  4707] <... futex resumed> )       = 1
[pid  4719] futex(0x7f93dffa9d90, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
[pid  4707] futex(0x7f93dffa9d90, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid  4719] <... futex resumed> )       = -1 EAGAIN (Resource temporarily unavailable)
[pid  4707] <... futex resumed> )       = 0
[pid  4719] futex(0x7f93dffa9d90, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid  4707] read(23,  <unfinished ...>
[pid  4719] <... futex resumed> )       = 0
[pid  4707] <... read resumed> "#!/usr/bin/env python\n# Copyrigh"..., 8192) = 2858
[pid  4719] wait4(4709, 0x7f93ded4bcf4, WNOHANG, NULL) = 0
[pid  4719] wait4(4708, 0x7f93ded4bcf4, WNOHANG, NULL) = 0
[pid  4707] futex(0x7f93dffa9d88, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=86943, tv_nsec=191437734}, 0xffffffff <unfinished ...>
[pid  4719] futex(0x7f93dffa9d88, FUTEX_WAKE_PRIVATE, 1) = 1
[pid  4707] <... futex resumed> )       = 0
[pid  4719] poll([{fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=15, events=POLLIN}, {fd=17, events=POLLIN}, {fd=19, events=POLLIN}, {fd=21, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}], 10, -1 <unfinished ...>
[pid  4707] futex(0x7f93dffa9d90, FUTEX_WAKE_PRIVATE, 1) = 0
[pid  4707] close(23)                   = 0
[pid  4707] write(2, "Traceback (most recent call last"..., 311 <unfinished ...>
[pid  4699] <... ppoll resumed> )       = 1 ([{fd=5, revents=POLLIN}])
[pid  4707] <... write resumed> )       = 311
[pid  4699] rt_sigpending([], 8)        = 0
[pid  4699] read(5, "Traceback (most recent call last"..., 4096) = 311
[pid  4699] ppoll([{fd=5, events=POLLIN|POLLPRI}], 1, NULL, [], 8 <unfinished ...>
[pid  4707] getpid()                    = 4707
[pid  4707] futex(0x7f93e01df000, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 0, NULL, 0xffffffff

I can see from the strace that something has just read a python backtrace from a pipe, but it doesn't get as far as propagating that stack trace to stderr. I suspect it was the trace above which I was lucky to observe?

Implement trace viewer flow events

Ingest trace events into the trace processor.

Proposal: provide indicators on slices in both the flame graph and details list for incoming and outgoing flow events. Clicking on either the incoming or outgoing indicators (at least from within the details list) would directly navigate to the incoming or outgoing slice. If there are more than one, it would present an intermediate list of links to slices to navigate to.

Rough straw man example:
image

support of pprof files in Perfetto

We are trying to use perfetto as a platform that can analyze and present most of our perf traces, for systrace, proc stats , they are easy to query and present, but for pprof files, we haven't find a way to handle it

Could you consider implementing the support of pprof files? Thanks very much

sandbox docker image error

docker image from

docker pull eu.gcr.io/perfetto-ci/sandbox@sha256:9855b3cad890963ed5a15fa801f83e91158809e429c759ebbd2f89816c73a1f5

fail to run with error

/ci/testrunner.sh: line 37: PERFETTO_TEST_GIT_REF: unbound variable

I look over the dockerfile and python code, and I didn't see any setting of global variable PERFETTO_TEST_GIT_REF

perfetto_cmd.cc:840

Failed to invoke perfetto: perfetto_cmd.cc:840 Failed to open /data/misc/perfetto-traces/profile-shell. If you get permission denied in /data/misc/perfetto-traces, the file might have been created by another user, try deleting it first. (errno: 2, No such file or directory)

Got this error when running the cmd "tools/heap_profile [process_name]".
My device is not rooted, so I cannot access /data/.

Add navigation history to browser

Proposal: to enable browsing back and forth through flow events, etc., update the browser navigation stack when view state changes significantly. This would include changing the query filter (omnibox text, time/selected tracks/view, selected categories), and selected slice. Maybe include view presentation state as well, like zoom/scroll, or track expand/collapse.

To deal with rapid movement through selections, should debounce to prevent clutter in the history.

Missing packet

While working on a GPU data source, I noticed that one packet was missing. To be precise, the missing packet is the one before the last packet emitted within the OnStop callback.

To demonstrate that, I pushed a commit on my fork. This commit modifies slightly test/client_api_example.cc as described:

  • proper packet timestamps
  • mark last packet with a test string
  • set duration to 4 seconds in client_api.cfg

With this modifications, I run a tracing session:

  • This is the output of the client. From the logs I would expect to see 4 + 1 (while stopping) packets
    [190.534] lient_api_example.cc:66 OnStart called
    [190.660] ient_api_example.cc:107 Tracing lambda called
    [191.661] ient_api_example.cc:107 Tracing lambda called
    [192.661] ient_api_example.cc:107 Tracing lambda called
    [193.662] ient_api_example.cc:107 Tracing lambda called
    [194.535] lient_api_example.cc:69 OnStop called
    [194.535] lient_api_example.cc:76 Tracing lambda called while stopping
  • This is the trace in text format (trace.pbtext.txt). Here I am highlighting the relevant part, where you could notice 3 + 1 (while stopping) packet. One packet is missing, ideally with timestamp ~21193662000000.
packet {
  trusted_uid: 1000
  timestamp: 21190660987774
  trusted_packet_sequence_id: 2
  previous_packet_dropped: true
  gpu_counter_event {
    counters {
      counter_id: 1
    }
  }
}
packet {
  trusted_uid: 1000
  timestamp: 21191661333029
  trusted_packet_sequence_id: 2
  gpu_counter_event {
    counters {
      counter_id: 1
    }
  }
}
packet {
  trusted_uid: 1000
  timestamp: 21192661807648
  trusted_packet_sequence_id: 2
  gpu_counter_event {
    counters {
      counter_id: 1
    }
  }
}
packet {
  trusted_uid: 1000
  timestamp: 21194535913903
  trusted_packet_sequence_id: 3
  previous_packet_dropped: true
  for_testing {
    str: "Last packet"
  }
}

Built UI fail

image

tools/ninja -C out/debug ui fail, error unsafe cross-compilation

coredump while resolve trace

I use gapid to start a trace on android device and capture a file named .perfetto;
I tried to resolve it in cmd :
out/android/trace_to_text text
But it seems to be error:
_[858.045] trace_to_text.cc:187 Skipping invalid packet
[858.045] utils.cc:112 PERFETTO_CHECK(preamble == 0x0a) (errno: 0, Success)
------------------ BEGINNING OF CRASH ------------------
Signal: Illegal instruction (possibly unaligned access)
Fault addr: 0000000000521F11
Backtrace:
#00 0x00007F9B9328B390
#1 perfetto::trace_to_text::ForEachPacketBlobInTrace(std::__1::basic_istream<char, std::__1::char_traits >
, std::__1::function<void (std::__1::unique_ptr<char [], std::__1::default_delete<char []> >, unsigned long)> const&)
../../tools/trace_to_text/utils.cc:112
#2 perfetto::trace_to_text::TraceToText(std::__1::basic_istream<char, std::_1::char_traits >, std::__1::basic_ostream<char, std::__1::char_traits >)
../../tools/trace_to_text/trace_to_text.cc:182
#3 perfetto::trace_to_text::(anonymous namespace)::Main(int, char**)
../../tools/trace_to_text/main.cc:178
#4 main
../../tools/trace_to_text/main.cc:196
#5 0x00007F9B92AC4830
#6 0x00000000004FA389
------------------ END OF CRASH ------------------
Illegal instruction (core dumped)

Then I try to parse it in web:
https://ui.perfetto.dev/#!/viewer
And it can‘t load the file successfully and stop here:
loading trace 93% - 246M/s

Maybe there are some errors in my trace file?
How can I check it?

ATRACE capture fails when android:process includes ":" character

I have two processes. xyz.qrs:tuv and abc.def; The xyz.qrs:tuv process is package xyz.qrs with service tuv. Specifying xyz.qrs yields no results for that process, but captures abc.def. As soon as I write "xyz.qrs:tuv", nothing is captured. What's going on here? Do I need the :tuv?

data_sources: {
    config {
        name: "linux.ftrace"
        ftrace_config {
            atrace_apps: "xyz.qrs:tuv" # fails to capture anything for all processes
            atrace_apps: "xyz.qrs" # OK
            atrace_apps: "abc.def" # OK
        }
    }
}

There is a bug: src/traced/probes/ftrace/ftrace_config_utils.cc

bool IsGoodAtracePunctuation(char c) {
return c == '_' || c == '.' || c == '*';
}

Doesn't allow ':' characters which are used in multiple android processes via android:process=":tuv" in manifest.

heap_profile for my jni libs showing only first frame of stack trace

Firstly, thanks for all the fixes this morning. I'm now able to run tools/heap_profile on my mac and it works!

Now that I can capture some profiles, I'm noticing that calling stacks are missing for functions in my app's native libraries. Do I need to build with -fno-omit-frame-pointer, or is there something else I can do to get proper caller/callee information?

Screen Shot 2020-04-28 at 10 12 38 AM

Screen Shot 2020-04-28 at 10 12 00 AM

run ./heap_profile with error

^CTraceback (most recent call last):
File "./heap_profile", line 495, in
sys.exit(main(sys.argv))
File "./heap_profile", line 342, in main
trace_to_text_binary = load_trace_to_text(platform)
File "./heap_profile", line 68, in load_trace_to_text
subprocess.check_call(['curl', '-L', '-#', '-o', local_file, url])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 185, in check_call
retcode = call(*popenargs, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 172, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1099, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
return func(*args)
KeyboardInterrupt

Support category filtering

Provide a way to show the set of categories present in a trace file, and offer filtering options against it. Dim or hide events not matching the set of enabled categories. Ignore them when searching.

docs about perfetto/ui

Hi, perfetto is very cool!!!
Recently, i am working base on perfetto/ui, but i can not find any documents about it .

I have some confusions:

1、When i load a new trace file , how trace data parsed and flow between entire app. Too much controllers and message channel.

2、Every time when i modify files and reload the browser , that cost too much time waiting to show.

Paser tracefile by UI has some problem?

Error Info :

trace_file.pftrace.zip

To assist with debugging please attach or link to the trace you were viewing.

Viewed on: https://ui.perfetto.dev

Uncaught Error: abort("trap!"). Build with -s ASSERTIONS=1 for more info.

stderr:
[094.852] oto_trace_reader.cc:254 incremental_state_cleared without trusted_packet_sequence_id
[094.852] oto_trace_reader.cc:254 incremental_state_cleared without trusted_packet_sequence_id
[094.852] oto_trace_reader.cc:282 TracePacketDefaults packet without trusted_packet_sequence_id
[094.852] wasm_bridge.cc:73 Fatal failure while parsing the trace: ClockSnapshot packet is specifying a sequence-scoped clock id (64) but the TracePacket sequence_id is zero (errno: 0, No error information)
trap!

UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36

Tracefiel has attaced.

track_event coredump

branch: master
commit: f447425

I find that I use trace_processor_shell to parse a trace.file and it will coredump like this :

(gdb) c
Continuing.
[117.115] ack_event_parser.cc:644 PERFETTO_CHECK(event_name.data()) (errno: 0, Success)
[Thread 0x7ffff7ff4740 (LWP 19420) exited]
Thread 1 "trace_processor" received signal SIGILL, Illegal instruction.
0x000000000071e85b in perfetto::trace_processor::TrackEventParser::EventImporter::ParseMetadataEvent (this=0x7fffffff50e0)
at ../../src/trace_processor/importers/proto/track_event_parser.cc:644
644 PERFETTO_DCHECK(event_name.data());
(gdb) c
Continuing.
_------------------ BEGINNING OF CRASH ------------------
Signal: Illegal instruction (possibly unaligned access)
Fault addr: 000000000071E85B
Backtrace:
#00 0x00007FFFF79C5390
#1 perfetto::trace_processor::TrackEventParser::EventImporter::ParseMetadataEvent()
../../src/trace_processor/importers/proto/track_event_parser.cc:644
#2 perfetto::trace_processor::TrackEventParser::EventImporter::Import()
../../src/trace_processor/importers/proto/track_event_parser.cc:178
#3 perfetto::trace_processor::TrackEventParser::ParseTrackEvent(long, perfetto::trace_processor::TrackEventData*, protozero::ConstBytes)
../../src/trace_processor/importers/proto/track_event_parser.cc:1570
#4 perfetto::trace_processor::TrackEventModule::ParsePacket(perfetto::protos::pbzero::TracePacket_Decoder const&, perfetto::trace_processor::TimestampedTracePiece const&, unsigned int)
../../src/trace_processor/importers/proto/track_event_module.cc:76
#5 perfetto::trace_processor::ProtoTraceParser::ParseTracePacketImpl(long, perfetto::trace_processor::TimestampedTracePiece, perfetto::trace_processor::TracePacketData const*, perfetto::protos::pbzero::TracePacket_Decoder const&)
../../src/trace_processor/importers/proto/proto_trace_parser.cc:115
#6 perfetto::trace_processor::ProtoTraceParser::ParseTracePacket(long, perfetto::trace_processor::TimestampedTracePiece)
../../src/trace_processor/importers/proto/proto_trace_parser.cc:96
#7 perfetto::trace_processor::TraceSorter::SortAndExtractEventsBeyondWindow(long)
../../src/trace_processor/trace_sorter.cc:140
#8 perfetto::trace_processor::TraceSorter::ExtractEventsForced()
../../src/trace_processor/trace_sorter.h:158
#9 perfetto::trace_processor::TraceProcessorStorageImpl::NotifyEndOfFile()
../../src/trace_processor/trace_processor_storage_impl.cc:0
#0A perfetto::trace_processor::TraceProcessorImpl::NotifyEndOfFile()
../../src/trace_processor/trace_processor_impl.cc:570
#0B perfetto::trace_processor::ReadTrace(perfetto::trace_processor::TraceProcessor*, char const*, std::_1::function<void (unsigned long)> const&)
../../src/trace_processor/read_trace.cc:122
#0C perfetto::trace_processor::(anonymous namespace)::TraceProcessorMain(int, char**)
../../src/trace_processor/trace_processor_shell.cc:951
#0D main
../../src/trace_processor/trace_processor_shell.cc:1109
#0E 0x00007FFFF71FE830
#0F 0x00000000005A3D29
------------------ END OF CRASH ------------------

and I use an old version can parse it(Jan 30 commit: 15c8c3e).

Then I use trace_to_text parseit, I find the error trace message like this:
packet {
trusted_uid: 10301
timestamp: 704682336306572
trusted_packet_sequence_id: 5
track_event {
category_iids: 1
debug_annotations {
name_iid: 1
string_value: "XXXXXXXXXXXXX"
}
legacy_event {
name_iid: 1
phase: 77
}
}
interned_data {
event_categories {
iid: 1
name: "cat"
}
event_names {
iid: 1
name: "process_name"
}
debug_annotation_names {
iid: 1
name: "name"
}
}
previous_packet_dropped: true
}

I read the code and I think the problem generate while you update perfetto:
NullTermStringView event_name = storage->GetString(name_id);
PERFETTO_DCHECK(event_name.data());
In LookupInternedMessage func, interned_data_ map can't find FieldId. Maybe InternedFieldMap initialization has problem.(because my trace packet has name : process_name but can't find it.)

Is it a bug? Or how can I fix it?

Slice with same start time is not shown

Hi, I have a protobuf file test.pb.zip, in which there are six slice type TrackEvent, but when opening in Trace Viewer, some slices are not shown.

not_shown

We can still see five depth stacks. And after some zoom in, the slice with name 'third' is visible.

shown

But the slice with name 'fifth' is always invisible. The data in the slice table:

data

It seems slice with same start time will be 'group by' after this change, so it's not shown. Is this a bug, or just same start time is not supported?

How to show "trace_tracing_mark_write" function in perfetto

Grabbing with systrace trace.html File, you can see trace_tracing_mark_write defines the string, while Perfetto can only see "running". How to see trace_tracing_mark_write define string(e.g.trace_tracing_mark_write('E', current, name, 0)) in Perfetto?

Add a current filter results view for slices

Proposal: in the details pane area, show a list of slices matching the combined filter of omnibox text/selected time range/selected tracks/selected categories. Slices in the list can be displayed such that they indicate their associated track with coloring, and for thread slices, they show their call graph affinity with indentation.

This list can be interactive, highlighting the currently selected slice, and offering an alternative way to select a slice by clicking on it.

The text that matches within a given slice can be highlighted as well, to indicate how it matches the current query.

I have a working implementation of this here (restricted to chrome slices): https://github.com/kcoop/perfetto/tree/kencoope/log-slice-sketch

I've attached links to some short video clips showing it working (apologies for using dropbox :-) - couldn't get google drive to work for some reason this morning, and for some reason dropbox won't show previews of the .movs, so you have to download them).

https://www.dropbox.com/s/uooxum1g5kdcc18/Search%20selection.mov?dl=0
https://www.dropbox.com/s/faq9pndlv25ibxf/Search%20Selection%20combined%20with%20time%20and%20thread.mov?dl=0
https://www.dropbox.com/s/0q7db1g9dsrp2wx/Selection%20by%20time%20and%20thread.mov?dl=0
https://www.dropbox.com/s/mwug4pdtnczjoxi/Bidirectional%20selection%20sync.mov?dl=0

Regarding showing details for the selection, when a slice is selected, a details view of the slice would be shown. Some possibilities:

  • The list view could be split to the right with a smaller details pane, showing the details there.
  • The selected slice could expand down like a tree list item, showing the details below.
  • The details could present as a popup.
    The first option seems the best balance of screen real estate usage/context maintenance.

Provide perfetto UI as a customizable component

We had been planning on using catapult trace viewer as a component in a trace event viewing web app. As it’s getting long in the tooth, we’re now evaluating perfetto.

We have our own input files that need to be preprocessed, and/or fetched from a specific server, so we can’t just use the standalone app. It would be great if we could host perfetto as a component, and possibly customize some of its behavior.

Can perfetto be used on Arm64 Debian system?

Hi there,

I tried to follow up instructions in the page [1] to enable perfetto on my Arm64 SBC with Debian system:

$ git clone https://android.googlesource.com/platform/external/perfetto/ && cd perfetto
$ tools/install-build-deps
$ tools/build_all_configs.py

But it reports error as below:

root@linaro-developer:~/perfetto# tools/build_all_configs.py

Building linux_ubsan         [is_clang=true,is_debug=false,is_ubsan=true]
/root/perfetto/tools/gn gen /root/perfetto/out/linux_ubsan '--args=is_clang=true is_debug=false is_ubsan=true' --check
/root/perfetto/tools/run-buildtools-binary.sh: line 41: /root/perfetto/buildtools/linux64/gn: cannot execute binary file: Exec format error

So the installed binary "gn" is for x86 version and it cannot execute on Arm64 platform:

root@linaro-developer:~/perfetto# file /root/perfetto/buildtools/linux64/gn                                           
/root/perfetto/buildtools/linux64/gn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2
.0, BuildID[xxHash]=95bb0d10452442f8, stripped                                                                        

Could you help confirm I am using correct steps to enable perfetto on Arm64? Or am I missing anything for this?

Thank you for the guidance,
Leo

[1] https://android.googlesource.com/platform/external/perfetto/

[documentation] "duration_ms" is not working with trigger_mode: STOP_TRACING

Using 'duration_ms' config param will lead to immediate termination of trace session. But it's mentioned in:

  1. https://github.com/google/perfetto/blob/master/docs/concepts/config.md
  2. compiled HTML version https://perfetto.dev/docs/concepts/config

So far it looks like that when stop trigger is used, duration is calculated as:
trigger_config.trigger_timeout_ms + trigger_config.triggers.stop_delay_ms

Please update the documentation, I've spent several hours to make stop trigger behave as intended ‼️

tools/heap_profile fails on ADT-3 with permission error trying to remove profile

Profiling active. Press Ctrl+C to terminate.
You may disconnect your device.

rm: /data/misc/perfetto-traces/profile-4abc119d-c8d4-402a-b8a8-b13262c1a260: Permission denied
Traceback (most recent call last):
  File "tools/heap_profile", line 479, in <module>
    sys.exit(main(sys.argv))
  File "tools/heap_profile", line 422, in main
    ['adb', 'shell', 'rm', PROFILE_DEVICE_PATH], stdout=NULL)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['adb', 'shell', 'rm', '/data/misc/perfetto-traces/profile-4abc119d-c8d4-402a-b8a8-b13262c1a260']' returned non-zero exit status 1.

tools/heap_profile does not work with python3

Traceback (most recent call last):
  File "tools/heap_profile", line 436, in <module>
    sys.exit(main(sys.argv))
  File "tools/heap_profile", line 300, in main
    trace_to_text_binary = load_trace_to_text(platform)
  File "tools/heap_profile", line 66, in load_trace_to_text
    urllib.urlretrieve(url, local_file)
AttributeError: module 'urllib' has no attribute 'urlretrieve'

Support protobuf extensions

We should support protobuf extensions, so folks can define their own DataSource messages and TrackEvent arguments without having to check them in to Perfetto directly.

ATrace CPU time is not shown

New perfetto trace viewer is awesome!
But It's lacking 'cpu time', 'self cpu time' metrics comparing with obsolete catapult viewer.
Is it by design?

tracing sdk documentation outdated

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:

#include <perfetto.h>

#include <unistd.h>

PERFETTO_DEFINE_CATEGORIES(
    perfetto::Category("hello").SetDescription("my first cat"));

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();
}

via

clang++ -I /tmp/perfetto/sdk -L /tmp/perfetto/sdk/ -lperfetto main.cpp

I see the following failures:

main.cpp:6:15: error: no member named 'Category' in namespace 'perfetto'
    perfetto::Category("hello").SetDescription("my first cat"));
    ~~~~~~~~~~^
/tmp/perfetto/sdk/perfetto.h:6917:40: note: expanded from macro 'PERFETTO_DEFINE_CATEGORIES'
  PERFETTO_INTERNAL_DECLARE_CATEGORIES(__VA_ARGS__);           \
                                       ^~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6691:7: note: expanded from macro 'PERFETTO_INTERNAL_DECLARE_CATEGORIES'
      __VA_ARGS__};                                                           \
      ^~~~~~~~~~~
main.cpp:5:1: error: invalid application of 'sizeof' to an incomplete type '::perfetto::internal::TrackEventCategory const[]'
PERFETTO_DEFINE_CATEGORIES(
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6917:3: note: expanded from macro 'PERFETTO_DEFINE_CATEGORIES'
  PERFETTO_INTERNAL_DECLARE_CATEGORIES(__VA_ARGS__);           \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6693:13: note: expanded from macro 'PERFETTO_INTERNAL_DECLARE_CATEGORIES'
      sizeof(kCategories) / sizeof(kCategories[0]);                           \
            ^~~~~~~~~~~~~
main.cpp:5:1: error: variable length array declaration not allowed at file scope
PERFETTO_DEFINE_CATEGORIES(
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6917:3: note: expanded from macro 'PERFETTO_DEFINE_CATEGORIES'
  PERFETTO_INTERNAL_DECLARE_CATEGORIES(__VA_ARGS__);           \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6695:31: note: expanded from macro 'PERFETTO_INTERNAL_DECLARE_CATEGORIES'
  extern std::atomic<uint8_t> g_category_state_storage[kCategoryCount];       \
                              ^                        ~~~~~~~~~~~~~~
main.cpp:5:1: error: static_assert expression is not an integral constant expression
PERFETTO_DEFINE_CATEGORIES(
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6917:3: note: expanded from macro 'PERFETTO_DEFINE_CATEGORIES'
  PERFETTO_INTERNAL_DECLARE_CATEGORIES(__VA_ARGS__);           \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6714:44: note: expanded from macro 'PERFETTO_INTERNAL_DECLARE_CATEGORIES'
  static_assert(kConstExprCategoryRegistry.ValidateCategories(),              \
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:11:3: error: no matching function for call to 'Validate'
  TRACE_EVENT("hello", "do_sleep");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6946:3: note: expanded from macro 'TRACE_EVENT'
  PERFETTO_INTERNAL_SCOPED_TRACK_EVENT(category, name, ##__VA_ARGS__)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6779:27: note: expanded from macro 'PERFETTO_INTERNAL_SCOPED_TRACK_EVENT'
      ~EventFinalizer() { TRACE_EVENT_END(category); }                        \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6939:3: note: expanded from macro 'TRACE_EVENT_END'
  PERFETTO_INTERNAL_TRACK_EVENT(       \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6745:7: note: expanded from macro 'PERFETTO_INTERNAL_TRACK_EVENT'
      PERFETTO_GET_CATEGORY_INDEX(category)>([&](uint32_t instances) {        \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6737:3: note: expanded from macro 'PERFETTO_GET_CATEGORY_INDEX'
  ::perfetto::internal::TrackEventCategoryRegistry::Validate<                \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6401:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'CategoryIndex'
  static constexpr size_t Validate() {
                          ^
main.cpp:11:3: error: no matching function for call to 'Validate'
  TRACE_EVENT("hello", "do_sleep");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6946:3: note: expanded from macro 'TRACE_EVENT'
  PERFETTO_INTERNAL_SCOPED_TRACK_EVENT(category, name, ##__VA_ARGS__)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6779:27: note: expanded from macro 'PERFETTO_INTERNAL_SCOPED_TRACK_EVENT'
      ~EventFinalizer() { TRACE_EVENT_END(category); }                        \
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6939:3: note: expanded from macro 'TRACE_EVENT_END'
  PERFETTO_INTERNAL_TRACK_EVENT(       \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6759:9: note: expanded from macro 'PERFETTO_INTERNAL_TRACK_EVENT'
        PERFETTO_GET_CATEGORY_INDEX(category)>(instances, name,               \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6737:3: note: expanded from macro 'PERFETTO_GET_CATEGORY_INDEX'
  ::perfetto::internal::TrackEventCategoryRegistry::Validate<                \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6401:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'CategoryIndex'
  static constexpr size_t Validate() {
                          ^
main.cpp:11:3: error: no matching function for call to 'Validate'
  TRACE_EVENT("hello", "do_sleep");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6946:3: note: expanded from macro 'TRACE_EVENT'
  PERFETTO_INTERNAL_SCOPED_TRACK_EVENT(category, name, ##__VA_ARGS__)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6783:7: note: expanded from macro 'PERFETTO_INTERNAL_SCOPED_TRACK_EVENT'
      TRACE_EVENT_BEGIN(category, name, ##__VA_ARGS__);                       \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6933:3: note: expanded from macro 'TRACE_EVENT_BEGIN'
  PERFETTO_INTERNAL_TRACK_EVENT(               \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6745:7: note: expanded from macro 'PERFETTO_INTERNAL_TRACK_EVENT'
      PERFETTO_GET_CATEGORY_INDEX(category)>([&](uint32_t instances) {        \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6737:3: note: expanded from macro 'PERFETTO_GET_CATEGORY_INDEX'
  ::perfetto::internal::TrackEventCategoryRegistry::Validate<                \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6401:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'CategoryIndex'
  static constexpr size_t Validate() {
                          ^
main.cpp:11:3: error: no matching function for call to 'Validate'
  TRACE_EVENT("hello", "do_sleep");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6946:3: note: expanded from macro 'TRACE_EVENT'
  PERFETTO_INTERNAL_SCOPED_TRACK_EVENT(category, name, ##__VA_ARGS__)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6783:7: note: expanded from macro 'PERFETTO_INTERNAL_SCOPED_TRACK_EVENT'
      TRACE_EVENT_BEGIN(category, name, ##__VA_ARGS__);                       \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6933:3: note: expanded from macro 'TRACE_EVENT_BEGIN'
  PERFETTO_INTERNAL_TRACK_EVENT(               \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6759:9: note: expanded from macro 'PERFETTO_INTERNAL_TRACK_EVENT'
        PERFETTO_GET_CATEGORY_INDEX(category)>(instances, name,               \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6737:3: note: expanded from macro 'PERFETTO_GET_CATEGORY_INDEX'
  ::perfetto::internal::TrackEventCategoryRegistry::Validate<                \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/perfetto/sdk/perfetto.h:6401:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'CategoryIndex'
  static constexpr size_t Validate() {
                          ^
8 errors generated.

Issue of systrace parsing

Hi, I've observed a issue about systrace parsing, which displays different between perfetto web ui and systrace.
In perfetto UI: each animator, deliverInput ...takes a track, while in systrace animators are cascaded, I think the systrace style is more friendly to users. I uploaded systrace html here:
https://drive.google.com/open?id=13k7x2agWGb9T05e-VyRu_gIszaOAa_fo
and images:
https://drive.google.com/open?id=1DWGmX4ZkTeWmBVzbGHCdDAGuCauJ43rs
https://drive.google.com/open?id=1Cif-HsDpd26GBIxdIWViYWnvvWAiKoJH

Could you help take a look at this?

Not able to capture a complete device trace

I tried to record trace with this setting

adb shell perfetto \
  -c - --txt \
  -o /data/misc/perfetto-traces/trace \
<<EOF

buffers: {
    size_kb: 8960
    fill_policy: DISCARD
}
buffers: {
    size_kb: 1280
    fill_policy: DISCARD
}
duration_ms: 10000

EOF

However, I only get a trace file that's 542 bytes and it shows nothing in the Perfetto UI

perfetto_cmd.cc:604      Connected to the Perfetto traced service, starting tracing for 10000 ms
perfetto_cmd.cc:677      Wrote 542 bytes into /data/misc/perfetto-traces/trace

However, if I run

adb shell perfetto --config :test --out /data/misc/perfetto-traces/trace

I am able to get a complete trace

perfetto_cmd.cc:604      Connected to the Perfetto traced service, starting tracing for 2000 ms
perfetto_cmd.cc:677      Wrote 3026379 bytes into /data/misc/perfetto-traces/trace

Devices tried are

  1. Nokia 7 Plus Android 10
  2. Samsung S9 Android 10

Using perfetto from android app

Hi,
I'm trying to integrate perfetto in an app so that I can capture system trace from the app only, just like system tracing in developer options.
Looked into the source code of Traceur and found things like persist.traced.enable. However, no success yet.
Could you please tell if it's feasible or not? If yes, please suggest the best way to do it.

Content of multiple record sessions via Start Recording gets accumulated

When I collect multiple record sessions via Start Recording (WebUSB) the trace gets accumulated. Say I collect 10 seconds, then wait a minute and collect another 10 seconds (with possibly different settings), then the trace covers 80 seconds. And trace_to_text shows that it contains the content of both sessions. I only see this when using the socket connection (AdbSocketConsumerPort), not when using AdbConsumerPort or when collecting via command line. Is this known behavior or a bug (well or both?). This is with a custom device, but nothing customized in this area.

Was discussed on discord:
https://discord.com/channels/629013440635207702/629013441096450058/725016433481744504

The issue appears to be that we reuse the traceProtoWriter (a protobuf.Writer) in adb_socket_controller.ts, AdbSocketConsumerPort class.

Question of how to modify UI correctly?

Hi, I want to add more info, such collect histories, in UI page。
I met two poblems:

  1. Sometimes, I changed fronted ts file, then compiled and run it. But web UI didn't show ‘New version, Reload', I'm not sure it's the cause of 'new version check' OR 'compiler not recognize correctly my changed files'. How can I make it correct ?

  2. Added scss files not worked. I add new scss files in assets, also changed BUILD.gn
    scss_root = "src/assets/perfetto.scss" scss_srcs = [ "src/assets/typefaces.scss", "src/assets/sidebar.scss", "src/assets/topbar.scss", "src/assets/record.scss", "src/assets/common.scss", "src/assets/modal.scss", "src/assets/details.scss", "src/assets/extra.scss", "src/assets/history.scss", ]
    I checked the out files , 'history.scss' content was not included.

I want to know where I was wrong.

Thank you for your reply

producer_name_filter example is invalid in the documentation

On this page: https://perfetto.dev/docs/concepts/config

data_sources {
  config {
    name: "track_event"

    # Enable the data source only on Chrome and Chrome canary.
    producer_name_filter: "com.android.chrome"
    producer_name_filter: "com.google.chrome.canary"
  }
}

should be changed to

data_sources {
  config {
    name: "track_event"

    # Enable the data source only on Chrome and Chrome canary.
  }
  producer_name_filter: "com.android.chrome"
  producer_name_filter: "com.google.chrome.canary"
}

Perfetto UI: Chrome async events not shown

In catapult's trace viewer, Chrome trace async events (such as blink user timing measurements created with performance.measure()) are shown in a dedicated "Ungrouped Measure" category in the process, alongside threads.

These measurements don't seem to be shown in any way in Perfetto UI, and they also aren't discoverable through search.

When falling back to the catapult ui in the Perfetto sidebar, these events don't show either. Re-loading the trace from its original JSON in catapult does show the events, however.

Is this intentional? Is there any way I can help surfacing these events?

Provide registration for custom analysis panes

Some background: we're building a tool to help us with post mortem log analysis, and we've been looking to use a customized catapult trace viewer as a component in our own page for log-oriented usage. Catapult has a fairly flexible and component driven architecture that we can work with - we hope to be able to do the same with Perfetto, as trace viewer is being sunsetted.

For our scenario, we're working to view our logs + crash stacks with a visual tool. This will help us visualize logs by process/thread/time, navigate thread flow, and superimpose crashes & exceptions near where they occurred. Also in general, we want to be able to browse the visual story of code execution, as kind of a living architectural document. So this is less about performance monitoring (though that will still be helpful), and more about sleuthing out problems.

A key feature of this is the ability to select a collection of events, whether they’re duration or instant, and view them like a super rich log file: in chronological order, with indentation/flyovers/coloring providing context when necessary. This in contrast with the analytics pane provided by trace viewer, where duration based events immediately aggregate for performance analysis.

We expect to write this pane ourselves (and would be happy to contribute back if desired), but need hooks to be able to register it.

Building UI fails

The build for the UI does not complete successfully on Fedora 32. (Also F30...) Tried different branches 4.2. Tried master. Same result. I followed the instruction in the ui/README, and even tried to follow along with the CI build server. (Will be testing ubuntu 18 as well...)

(This was the 2nd run... lost the error on the terminal the first time, but it is the same.)

[1/47] link wasm/trace_processor.js
FAILED: wasm/trace_processor.js 
/home/fosterb/projects/webapps/perfetto/buildtools/emsdk/emscripten/em++ --em-config "EMSCRIPTEN_ROOT='/home/fosterb/projects/webapps/perfetto/buildtools/emsdk/emscripten';LLVM_ROOT='/home/fosterb/projects/webapps/perfetto/buildtools/emsdk/llvm';BINARYEN_ROOT='/home/fosterb/projects/webapps/perfetto/buildtools/emsdk/llvm/binaryen';EMSCRIPTEN_NATIVE_OPTIMIZER='/home/fosterb/projects/webapps/perfetto/buildtools/emsdk/llvm/optimizer';NODE_JS='/home/fosterb/projects/webapps/perfetto/buildtools/nodejs/bin/node';COMPILER_ENGINE=NODE_JS;JS_ENGINES=[NODE_JS];" -fuse-ld=lld -s WASM=1 -s DISABLE_EXCEPTION_CATCHING=1 -s NO_DYNAMIC_EXECUTION=1 -s TOTAL_MEMORY=33554432 -s ALLOW_MEMORY_GROWTH=1 -s RESERVED_FUNCTION_POINTERS=32 -s BINARYEN_METHOD=\'native-wasm\' -s BINARYEN_TRAP_MODE=\'clamp\' -s EXPORT_FUNCTION_TABLES=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=\[\'ccall\',\ \'cwrap\',\ \'addFunction\',\ \'FS\'\] -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s MODULARIZE=1 -s EXPORT_NAME=trace_processor_wasm -O3 -Wl,--gc-sections -Wl,--icf=all -Wl,-O1 -pie -Wl,-rpath=\$ORIGIN/. -Wl,-rpath-link=.  wasm/obj/src/trace_processor/dynamic/lib.describe_slice_generator.o wasm/obj/src/trace_processor/dynamic/lib.experimental_counter_dur_generator.o wasm/obj/src/trace_processor/dynamic/lib.experimental_flamegraph_generator.o ..............  -lpthread -lrt -o wasm/trace_processor.js
/home/fosterb/projects/webapps/perfetto/buildtools/emsdk/llvm/llvm-ar: /lib64/libtinfo.so.5: no version information available (required by /home/fosterb/projects/webapps/perfetto/buildtools/emsdk/llvm/llvm-ar)
error: asm2wasm seeing an invalid argument type at index 5 (this will not validate) in call from $__ZN8perfetto4base11PagedMemory8AllocateEji to $___mmap (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
error: asm2wasm seeing an invalid argument type at index 1 (this will not validate) in call from $_unixRead to $_lseek (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
error: asm2wasm seeing an invalid argument type at index 1 (this will not validate) in call from $_unixWrite to $_lseek (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
error: asm2wasm seeing an invalid argument type at index 1 (this will not validate) in call from $_unixFileControl to $_lseek (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
error: asm2wasm seeing an invalid argument type at index 1 (this will not validate) in call from $_unixShmMap to $_lseek (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
[wasm-validator error in function $__ZN8perfetto4base11PagedMemory8AllocateEji] 1 != 2: call param types must match, on 
[i32] (call $___mmap
 [i32] (i32.const 0)
 [i32] (i32.sub
  [i32] (get_local $1)
  [i32] (i32.const -8192)
 )
 [i32] (i32.const 3)
 [i32] (i32.const 34)
 [i32] (i32.const -1)
 [i32] (i32.const 0)
)
(on argument 5)
[wasm-validator error in function $_unixRead] 1 != 2: call param types must match, on 
[i64] (call $_lseek
 [i32] (i32.load
  [i32] (get_local $9)
 )
 [i32] (get_local $7)
 [i32] (i32.const 0)
)
(on argument 1)
[wasm-validator error in function $_unixRead] 2 != 1: binary child types must be equal, on 
[i32] (i32.lt_s
 [i64] (call $_lseek
  [i32] (i32.load
   [i32] (get_local $9)
  )
  [i32] (get_local $7)
  [i32] (i32.const 0)
 )
 [i32] (i32.const 0)
)
[wasm-validator error in function $_unixRead] 2 != 1: i32 op, on 
[i32] (i32.lt_s
 [i64] (call $_lseek
  [i32] (i32.load
   [i32] (get_local $9)
  )
  [i32] (get_local $7)
  [i32] (i32.const 0)
 )
 [i32] (i32.const 0)
)```

... etc ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.