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