Remove quadratic iteration over attrs for piped perf.data.

Instead, deduplicate with a set.

PiperOrigin-RevId: 171351324
1 file changed
tree: 46bde384cbcde917e5697247737825b2e63a5ff1
  1. compat/
  2. quipper/
  3. testdata/
  4. third_party/
  5. .gitignore
  6. .gitmodules
  7. .travis.yml
  8. AUTHORS
  9. builder.cc
  10. builder.h
  11. chrome_huge_pages_mapping_deducer.cc
  12. chrome_huge_pages_mapping_deducer.h
  13. chrome_huge_pages_mapping_deducer_test.cc
  14. CONTRIBUTING
  15. CONTRIBUTORS
  16. intervalmap.h
  17. intervalmap_test.cc
  18. LICENSE
  19. Makefile
  20. path_matching.h
  21. perf_data_converter.cc
  22. perf_data_converter.h
  23. perf_data_converter_test.cc
  24. perf_data_handler.cc
  25. perf_data_handler.h
  26. perf_data_handler_test.cc
  27. perf_to_profile.cc
  28. profile.proto
  29. README.md
README.md

Introduction

The perf_to_profile binary can be used to turn a perf.data file, which is generated by the linux profiler, perf, into a profile.proto file which can be visualized using the tool pprof.

For details on pprof, see https://github.com/google/pprof

THIS IS NOT AN OFFICIAL GOOGLE PRODUCT

Prerequisites:

Compilation:

To install all dependences and build the binary, run the following commands. These were tested on Debian GNU/Linux 8 (jessie):

sudo apt-get -y install autoconf automake g++ git libelf-dev libssl-dev libtool make pkg-config
git clone --recursive https://github.com/google/perf_data_converter.git
cd perf_data_converter
make perf_to_profile

If you already have protocol buffers and googletest installed on your system, you can compile using your local packages with the following commands:

sudo apt-get -y install autoconf automake g++ git libelf-dev libssl-dev libtool make pkg-config
git clone https://github.com/google/perf_data_converter.git
cd perf_data_converter
make perf_to_profile

Place the perf_to_profile binary in a place accessible from your path (eg /usr/local/bin).

Running tests:

There are a small number of tests that verify the basic functionality. To run these, after successful compilation, run:

make check

Usage:

Profile a command using perf, for example:

perf record /bin/ls

The example command will generate a profile named perf.data, you should convert this into a profile.proto then visualize it using pprof:

perf_to_profile perf.data profile.pb
pprof -web profile.pb

Recent versions of pprof will automatically invoke perf_to_profile:

pprof -web perf.data