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