xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/README (revision 4f645668ed707e1f969c546666f8c8e45e6f8888)
1*4f645668SchristosWhat is gprofng?
2*4f645668Schristos
3*4f645668Schristos   Gprofng is the GNU Next Generation profiler for analyzing the performance
4*4f645668Schristos   of Linux applications.  Gprofng allows you to:
5*4f645668Schristos     - Profile C / C++ / Java / Scala applications without needing to recompile
6*4f645668Schristos     - Profile multi-threaded applications
7*4f645668Schristos     - Analyze and compare multiple experiments
8*4f645668Schristos     - Use time-based sampling and / or hardware event counters
9*4f645668Schristos
10*4f645668SchristosBuilding gprofng
11*4f645668Schristos
12*4f645668Schristos   Gprofng is distributed with binutils.  To build gprofng, you build binutils.
13*4f645668Schristos   Overview:
14*4f645668Schristos      1. Set paths
15*4f645668Schristos      2. Verify prerequisites
16*4f645668Schristos      3. Git clone
17*4f645668Schristos      4. Configure, make, and make install
18*4f645668Schristos   Details follow for each of these.
19*4f645668Schristos
20*4f645668Schristos1. Set paths
21*4f645668Schristos
22*4f645668Schristos   If you are configuring binutils for the default location, it will use:
23*4f645668Schristos       /usr/local
24*4f645668Schristos   In your shell initialization procedure, set your paths using commands
25*4f645668Schristos   similar to these:
26*4f645668Schristos      export PATH=/usr/local/bin:$PATH
27*4f645668Schristos      export MANPATH=/usr/local/share/man:$MANPATH
28*4f645668Schristos      export INFOPATH=/usr/local/share/info/:$INFOPATH
29*4f645668Schristos
30*4f645668Schristos2. Verify prerequisites
31*4f645668Schristos
32*4f645668Schristos  To build a recent version of binutils, it is useful to have a developer
33*4f645668Schristos  system with the most recent compilers, libraries, and operating system.
34*4f645668Schristos  Development systems will typically already include most of these:
35*4f645668Schristos
36*4f645668Schristos     bison  bison-devel  bzip2  elfutils-debuginfod-client-devel
37*4f645668Schristos     expat-devel  flex  gcc  gcc-c++  git-core  git-core-doc  gmp-devel
38*4f645668Schristos     help2man  libbabeltrace-devel  libipt-devel  m4  make  mpfr-devel
39*4f645668Schristos     ncurses-devel  perl-Data-Dumper  tar  texinfo  xz  zlib-devel
40*4f645668Schristos     java-17-openjdk-devel
41*4f645668Schristos
42*4f645668Schristos  CAUTION: The list of prerequisites changes depending on your operating system
43*4f645668Schristos  and changes as binutils evolves.  The list above is a snapshot of the useful
44*4f645668Schristos  packages in early 2022 for Red Hat Enterprise Linux and Oracle Linux.
45*4f645668Schristos
46*4f645668Schristos  Your system may use other packages; for example, you may be able to use a
47*4f645668Schristos  different version of Java than shown above.  If there are failures, you may
48*4f645668Schristos  need to search for other packages as described in the "Hints" section below.
49*4f645668Schristos
50*4f645668Schristos3. Git clone
51*4f645668Schristos
52*4f645668Schristos   Select a binutils repository and a branch that you would like
53*4f645668Schristos   to start from.  For example, to clone from the master at
54*4f645668Schristos   sourceware.org, you could say:
55*4f645668Schristos     git clone http://sourceware.org/git/binutils-gdb.git CloneDir
56*4f645668Schristos
57*4f645668Schristos4. Configure, make, and install
58*4f645668Schristos
59*4f645668Schristos   There are many options for configure (see: configure --help).  For example,
60*4f645668Schristos   --prefix sets the destination, as described in the "Hints" section below.
61*4f645668Schristos   If the default destination /usr/local is acceptable for your needs, then
62*4f645668Schristos   after the clone operation finishes, you can simply say:
63*4f645668Schristos
64*4f645668Schristos      mkdir build
65*4f645668Schristos      cd build
66*4f645668Schristos      ../CloneDir/configure
67*4f645668Schristos      make
68*4f645668Schristos      sudo make install
69*4f645668Schristos
70*4f645668SchristosGetting started
71*4f645668Schristos
72*4f645668Schristos  To start using gprofng, see the tutorial available by saying:
73*4f645668Schristos      info gprofng
74*4f645668Schristos
75*4f645668SchristosHTML and PDF documentation
76*4f645668Schristos
77*4f645668Schristos   You may want to generate an HTML or PDF version of the manual in addition
78*4f645668Schristos   to the above info pages.  These versions may be easier to read and easier
79*4f645668Schristos   to search.  To generate HTML:
80*4f645668Schristos
81*4f645668Schristos      cd build        # the same build directory you created above
82*4f645668Schristos      cd gprofng/doc
83*4f645668Schristos      make html
84*4f645668Schristos      sudo make install-html
85*4f645668Schristos
86*4f645668Schristos   If you would like PDF documentation, you will need the texi2dvi utility.
87*4f645668Schristos   If it is not already included in the texinfo package mentioned above, try
88*4f645668Schristos   installing package texinfo-tex.  To generate PDF:
89*4f645668Schristos
90*4f645668Schristos      cd build        # the same build directory you created above
91*4f645668Schristos      cd gprofng/doc
92*4f645668Schristos      make pdf
93*4f645668Schristos      sudo make install-pdf
94*4f645668Schristos
95*4f645668SchristosHints and tips for building binutils
96*4f645668Schristos
97*4f645668Schristos  - Use the script(1) command to write a log of your build.
98*4f645668Schristos
99*4f645668Schristos  - If you run multiple commands at once (for example: make --jobs=10) then you
100*4f645668Schristos    should also use make option:
101*4f645668Schristos          --output-sync
102*4f645668Schristos    Without --output-sync, the log would be difficult to interpret.
103*4f645668Schristos
104*4f645668Schristos  - Search the log for errors and warnings, for example:
105*4f645668Schristos        configure: WARNING: <package> is missing or unusable; some features
106*4f645668Schristos                   may be unavailable.
107*4f645668Schristos    The above message suggests that <package> may be needed on your system.
108*4f645668Schristos
109*4f645668Schristos  - Sometimes the above message is not sufficiently specific to guide you to
110*4f645668Schristos    the right package.  In the directory where the failure happens, config.log
111*4f645668Schristos    may identify a specific missing file, and your package manager may allow
112*4f645668Schristos    you to search for it. For example, if build/gprofng/config.log shows that
113*4f645668Schristos    javac is missing, and if your package manager is dnf, you could try:
114*4f645668Schristos       dnf --repo='*' whatprovides '*/javac'
115*4f645668Schristos
116*4f645668Schristos  - You can set a custom destination directory using configure --prefix.
117*4f645668Schristos    This is useful if you prefer not to change /usr/local, or if you are not
118*4f645668Schristos    allowed to do so.  If you set a custom prefix, be sure to change all three
119*4f645668Schristos    paths mentioned in the PATH section above.
120*4f645668Schristos
121