tree: ca9a6444bb35ef7db851d9c80368ab410ea2ca8c [path history] [tgz]
  1. bookkeeping.cc
  2. bookkeeping.h
  3. bookkeeping_unittest.cc
  4. bounded_queue.h
  5. bounded_queue_unittest.cc
  6. BUILD.gn
  7. client.cc
  8. client.h
  9. client_unittest.cc
  10. heapprofd_integrationtest.cc
  11. main.cc
  12. malloc_hooks.cc
  13. queue_messages.h
  14. README.md
  15. record_reader.cc
  16. record_reader.h
  17. record_reader_unittest.cc
  18. sampler.cc
  19. sampler.h
  20. sampler_unittest.cc
  21. socket_listener.cc
  22. socket_listener.h
  23. socket_listener_unittest.cc
  24. string_interner.cc
  25. string_interner.h
  26. string_interner_unittest.cc
  27. unwinding.cc
  28. unwinding.h
  29. unwinding_unittest.cc
  30. wire_protocol.cc
  31. wire_protocol.h
  32. wire_protocol_unittest.cc
src/profiling/memory/README.md

heapprofd - Android Heap Profiler

These are temporary instructions while heapprofd is under development. They are subject to frequent change and will be obsoleted once heapprofd is integrated into Perfetto.

Currently heapprofd only works with SELinux disabled and when run as root.

To start profiling the process ${PID}, run the following sequence of commands.

adb root
adb shell setenforce 0
adb shell 'heapprofd -s -r 128000' & # Start standalone with 128kB sampling.
adb shell kill -36 ${PID} # Start profiling the process.

To obtain heap dumps for all profiled processes, send SIGUSR1 to heapprofd which produces heap dumps in /data/local/tmp.

adb shell killall -USR1 heapprofd
adb pull /data/local/tmp/heap_dump.${PID}

This file can then be converted to a flamegraph using Brendan Gregg's flamegraph.pl.

flamegraph.pl heap_dump.${PID} > heap_dump.${PID}.svg