iconv.1, memusage.1, sprof.1: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-08-16 11:14:04 +02:00
parent 18ef2552b1
commit 60d3774e91
3 changed files with 30 additions and 30 deletions

View File

@ -182,19 +182,19 @@ POSIX.1-2001.
Convert text from the ISO 8859-15 character encoding to UTF-8:
.PP
.in +4n
.nf
.EX
$ \fBiconv \-f ISO\-8859\-15 \-t UTF\-8 < input.txt > output.txt\fP
.fi
.EE
.in
.PP
The next example converts from UTF-8 to ASCII, transliterating when
possible:
.PP
.in +4n
.nf
.EX
$ \fBecho abc ß α € àḃç | iconv \-f UTF\-8 \-t ASCII//TRANSLIT\fP
abc ss ? EUR abc
.fi
.EE
.in
.SH SEE ALSO
.BR locale (1),

View File

@ -210,7 +210,7 @@ a graph of the memory usage of the program can be found in the file
.IR memusage.png :
.PP
.in +4n
.nf
.EX
$ \fBmemusage --data=memusage.dat ./a.out\fP
\&...
Memory usage summary: heap total: 45200, heap peak: 6440, stack peak: 224
@ -232,7 +232,7 @@ Histogram for block sizes:
5840-5855 2 4% =================================
6432-6447 1 2% ================
$ \fBmemusagestat memusage.dat memusage.png\fP
.fi
.EE
.in
.SS Program source
.EX

View File

@ -84,7 +84,7 @@ in a shared object.
First, the code of the main program:
.PP
.in +4n
.nf
.EX
$ \fBcat prog.c\fP
#include <stdlib.h>
@ -98,7 +98,7 @@ main(int argc, char *argv[])
x2();
exit(EXIT_SUCCESS);
}
.fi
.EE
.in
.PP
The functions
@ -109,7 +109,7 @@ are defined in the following source file that is used to
construct the shared object:
.PP
.in +4n
.nf
.EX
$ \fBcat libdemo.c\fP
#include <unistd.h>
@ -147,7 +147,7 @@ x2(void)
for (j = 0; j < 1000; j++)
consumeCpu2(10000);
}
.fi
.EE
.in
.PP
Now we construct the shared object with the real name
@ -156,34 +156,34 @@ and the soname
.IR libdemo.so.1 :
.PP
.in +4n
.nf
.EX
$ \fBcc \-g \-fPIC \-shared \-Wl,\-soname,libdemo.so.1 \e\fP
\fB\-o libdemo.so.1.0.1 libdemo.c\fP
.fi
.EE
.in
.PP
Then we construct symbolic links for the library soname and
the library linker name:
.PP
.in +4n
.nf
.EX
$ \fBln \-sf libdemo.so.1.0.1 libdemo.so.1\fP
$ \fBln \-sf libdemo.so.1 libdemo.so\fP
.fi
.EE
.in
.PP
Next, we compile the main program, linking it against the shared object,
and then list the dynamic dependencies of the program:
.PP
.in +4n
.nf
.EX
$ \fBcc \-g \-o prog prog.c \-L. \-ldemo\fP
$ \fBldd prog\fP
linux\-vdso.so.1 => (0x00007fff86d66000)
libdemo.so.1 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fd4dc138000)
/lib64/ld\-linux\-x86\-64.so.2 (0x00007fd4dc51f000)
.fi
.EE
.in
.PP
In order to get profiling information for the shared object,
@ -192,9 +192,9 @@ we define the environment variable
with the soname of the library:
.PP
.in +4n
.nf
.EX
$ \fBexport LD_PROFILE=libdemo.so.1\fP
.fi
.EE
.in
.PP
We then define the environment variable
@ -203,10 +203,10 @@ with the pathname of the directory where profile output should be written,
and create that directory if it does not exist already:
.PP
.in +4n
.nf
.EX
$ \fBexport LD_PROFILE_OUTPUT=$(pwd)/prof_data\fP
$ \fBmkdir \-p $LD_PROFILE_OUTPUT\fP
.fi
.EE
.in
.PP
.B LD_PROFILE
@ -216,9 +216,9 @@ to the output file if it already exists,
so we ensure that there is no preexisting profiling data:
.PP
.in +4n
.nf
.EX
$ \fBrm \-f $LD_PROFILE_OUTPUT/$LD_PROFILE.profile\fP
.fi
.EE
.in
.PP
We then run the program to produce the profiling output,
@ -226,11 +226,11 @@ which is written to a file in the directory specified in
.BR LD_PROFILE_OUTPUT :
.PP
.in +4n
.nf
.EX
$ \fBLD_LIBRARY_PATH=. ./prog\fP
$ \fBls prof_data\fP
libdemo.so.1.profile
.fi
.EE
.in
.PP
We then use the
@ -238,7 +238,7 @@ We then use the
option to generate a flat profile with counts and ticks:
.PP
.in +4n
.nf
.EX
$ \fBsprof \-p libdemo.so.1 $LD_PROFILE_OUTPUT/libdemo.so.1.profile\fP
Flat profile:
@ -249,7 +249,7 @@ Each sample counts as 0.01 seconds.
40.00 0.10 0.04 1000 40.00 consumeCpu2
0.00 0.10 0.00 1 0.00 x1
0.00 0.10 0.00 1 0.00 x2
.fi
.EE
.in
.PP
The
@ -257,7 +257,7 @@ The
option generates a call graph:
.PP
.in +4n
.nf
.EX
$ \fBsprof \-q libdemo.so.1 $LD_PROFILE_OUTPUT/libdemo.so.1.profile\fP
index % time self children called name
@ -276,7 +276,7 @@ index % time self children called name
[3] 0.0 0.00 0.00 1 x2 [3]
0.00 0.00 1000/1000 consumeCpu2 [2]
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.fi
.EE
.in
.PP
Above and below, the "<UNKNOWN>" strings represent identifiers that
@ -288,13 +288,13 @@ The
option generates a list of call pairs and the number of their occurrences:
.PP
.in +4n
.nf
.EX
$ \fBsprof \-c libdemo.so.1 $LD_PROFILE_OUTPUT/libdemo.so.1.profile\fP
<UNKNOWN> x1 1
x1 consumeCpu1 100
<UNKNOWN> x2 1
x2 consumeCpu2 1000
.fi
.EE
.in
.SH SEE ALSO
.BR gprof (1),