2014-06-10 14:38:26 +00:00
|
|
|
.\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
|
|
|
.\" %%%LICENSE_START(VERBATIM)
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" %%%LICENSE_END
|
|
|
|
.\"
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1, _syscall.2, accept.2, add_key.2, adjtimex.2, bind.2, bpf.2, capget.2, chown.2, chroot.2, clock_getres.2, clone.2, connect.2, copy_file_range.2, epoll_ctl.2, epoll_wait.2, eventfd.2, fanotify_init.2, fanotify_mark.2, fcntl.2, fsync.2, futex.2, getcpu.2, getdents.2, getgid.2, getgroups.2, getpid.2, gettid.2, gettimeofday.2, getuid.2, getxattr.2, inotify_add_watch.2, inotify_init.2, ioctl_fat.2, ioctl_ns.2, ioctl_userfaultfd.2, ioprio_set.2, kcmp.2, kexec_load.2, keyctl.2, listxattr.2, lseek.2, madvise.2, memfd_create.2, migrate_pages.2, mount.2, mprotect.2, mremap.2, msgctl.2, msgop.2, nfsservctl.2, open_by_handle_at.2, perf_event_open.2, pipe.2, pivot_root.2, pkey_alloc.2, poll.2, posix_fadvise.2, prctl.2, readahead.2, readdir.2, readlink.2, reboot.2, recvmmsg.2, removexattr.2, rename.2, request_key.2, s390_guarded_storage.2, s390_runtime_instr.2, s390_sthyi.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, seccomp.2, select.2, select_tut.2, semctl.2, sendmmsg.2, set_thread_area.2, setgid.2, setns.2, setuid.2, setxattr.2, shmctl.2, sigaction.2, signalfd.2, sigsuspend.2, socket.2, socketpair.2, spu_run.2, stat.2, statx.2, subpage_prot.2, syscalls.2, sysctl.2, tee.2, timer_create.2, timerfd_create.2, truncate.2, uname.2, unshare.2, userfaultfd.2, ustat.2, vmsplice.2, write.2, CPU_SET.3, __ppc_get_timebase.3, alloca.3, argz_add.3, asprintf.3, backtrace.3, basename.3, bsd_signal.3, bstring.3, bswap.3, bzero.3, cacos.3, cacosh.3, catan.3, catanh.3, catgets.3, clock_getcpuclockid.3, cmsg.3, confstr.3, ctermid.3, ctime.3, des_crypt.3, dl_iterate_phdr.3, dlinfo.3, dlsym.3, duplocale.3, end.3, endian.3, errno.3, exec.3, exit.3, ferror.3, fgetws.3, fmemopen.3, fnmatch.3, fopencookie.3, fputws.3, frexp.3, ftw.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrouplist.3, getifaddrs.3, getline.3, getlogin.3, getmntent.3, getnameinfo.3, getopt.3, getpass.3, getprotoent_r.3, getpwnam.3, getservent_r.3, getsubopt.3, glob.3, gnu_get_libc_version.3, hsearch.3, if_nameindex.3, index.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isatty.3, iswblank.3, iswspace.3, lockf.3, makecontext.3, mallinfo.3, malloc.3, malloc_hook.3, malloc_info.3, mallopt.3, matherr.3, mbrtowc.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mcheck.3, memchr.3, mq_getattr.3, mq_notify.3, newlocale.3, nl_langinfo.3, offsetof.3, perror.3, posix_spawn.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_mutexattr_setrobust.3, pthread_rwlockattr_setkind_np.3, pthread_setaffinity_np.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, putenv.3, qsort.3, rand.3, random.3, readdir.3, regex.3, resolver.3, rpmatch.3, rtime.3, scanf.3, sem_wait.3, setaliasent.3, setbuf.3, stpcpy.3, stpncpy.3, strcat.3, strchr.3, strcmp.3, strcpy.3, strdup.3, strerror.3, strfromd.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strsep.3, strstr.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, system.3, termios.3, trunc.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscat.3, wcscpy.3, wcslen.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wcsstr.3, wcstok.3, wcstombs.3, wcwidth.3, wprintf.3, xcrypt.3, console_codes.4, dsp56k.4, full.4, initrd.4, lirc.4, loop.4, st.4, tty.4, vcs.4, charmap.5, core.5, host.conf.5, locale.5, proc.5, repertoiremap.5, resolv.conf.5, termcap.5, tmpfs.5, tzfile.5, aio.7, capabilities.7, cgroup_namespaces.7, cgroups.7, charsets.7, complex.7, epoll.7, fanotify.7, feature_test_macros.7, inotify.7, ip.7, locale.7, man-pages.7, man.7, namespaces.7, pid_namespaces.7, pkeys.7, pthreads.7, rtld-audit.7, sched.7, signal.7, sock_diag.7, socket.7, tcp.7, udp.7, unicode.7, user_namespaces.7, utf-8.7, zdump.8, zic.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 14:11:03 +00:00
|
|
|
.TH SPROF 1 2019-03-06 "Linux" "Linux User Manual"
|
2014-06-10 14:38:26 +00:00
|
|
|
.SH NAME
|
|
|
|
sprof \- read and display shared object profiling data
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
2014-08-30 13:45:00 +00:00
|
|
|
.BR sprof " [\fIoption\fP]... \fIshared-object-path\fP \
|
|
|
|
[\fIprofile-data-path\fP]"
|
2014-06-10 14:38:26 +00:00
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
|
|
|
.B sprof
|
|
|
|
command displays a profiling summary for the
|
2015-07-10 18:37:59 +00:00
|
|
|
shared object (shared library) specified as its first command-line argument.
|
2014-06-10 14:38:26 +00:00
|
|
|
The profiling summary is created using previously generated
|
|
|
|
profiling data in the (optional) second command-line argument.
|
|
|
|
If the profiling data pathname is omitted, then
|
|
|
|
.B sprof
|
|
|
|
will attempt to deduce it using the soname of the shared object,
|
|
|
|
looking for a file with the name
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.I <soname>.profile
|
2014-06-10 14:38:26 +00:00
|
|
|
in the current directory.
|
|
|
|
.SH OPTIONS
|
|
|
|
The following command-line options specify the profile output
|
|
|
|
to be produced:
|
|
|
|
.TP
|
|
|
|
.BR \-c ", " \-\-call\-pairs
|
|
|
|
Print a list of pairs of call paths for the interfaces exported
|
|
|
|
by the shared object,
|
|
|
|
along with the number of times each path is used.
|
|
|
|
.TP
|
|
|
|
.BR \-p ", " \-\-flat\-profile
|
|
|
|
Generate a flat profile of all of the functions in the monitored object,
|
|
|
|
with counts and ticks.
|
|
|
|
.TP
|
|
|
|
.BR \-q ", " \-\-graph
|
|
|
|
Generate a call graph.
|
|
|
|
.PP
|
|
|
|
If none of the above options is specified,
|
|
|
|
then the default behavior is to display a flat profile and a call graph.
|
|
|
|
.PP
|
|
|
|
The following additional command-line options are available:
|
|
|
|
.TP
|
|
|
|
.BR \-? ", " \-\-help
|
|
|
|
Display a summary of command-line options and arguments and exit.
|
|
|
|
.TP
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.B \-\-usage
|
2014-06-10 14:38:26 +00:00
|
|
|
Display a short usage message and exit.
|
|
|
|
.TP
|
|
|
|
.BR \-V ", " \-\-version
|
|
|
|
Display the program version and exit.
|
|
|
|
.SH CONFORMING TO
|
|
|
|
The
|
|
|
|
.B sprof
|
|
|
|
command is a GNU extension, not present in POSIX.1.
|
|
|
|
.SH EXAMPLE
|
|
|
|
The following example demonstrates the use of
|
|
|
|
.BR sprof .
|
|
|
|
The example consists of a main program that calls two functions
|
2015-07-10 18:37:59 +00:00
|
|
|
in a shared object.
|
2014-06-10 14:38:26 +00:00
|
|
|
First, the code of the main program:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBcat prog.c\fP
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
void x1(void);
|
|
|
|
void x2(void);
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
x1();
|
|
|
|
x2();
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
The functions
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.IR x1 ()
|
2014-06-10 14:38:26 +00:00
|
|
|
and
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.IR x2 ()
|
2014-06-10 14:38:26 +00:00
|
|
|
are defined in the following source file that is used to
|
2015-07-10 18:37:59 +00:00
|
|
|
construct the shared object:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBcat libdemo.c\fP
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
void
|
|
|
|
consumeCpu1(int lim)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < lim; j++)
|
|
|
|
getppid();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
x1(void) {
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < 100; j++)
|
|
|
|
consumeCpu1(200000);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
consumeCpu2(int lim)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < lim; j++)
|
|
|
|
getppid();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
x2(void)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < 1000; j++)
|
|
|
|
consumeCpu2(10000);
|
|
|
|
}
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
2015-07-10 18:37:59 +00:00
|
|
|
Now we construct the shared object with the real name
|
2014-06-10 14:38:26 +00:00
|
|
|
.IR libdemo.so.1.0.1 ,
|
|
|
|
and the soname
|
|
|
|
.IR libdemo.so.1 :
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBcc \-g \-fPIC \-shared \-Wl,\-soname,libdemo.so.1 \e\fP
|
|
|
|
\fB\-o libdemo.so.1.0.1 libdemo.c\fP
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
Then we construct symbolic links for the library soname and
|
|
|
|
the library linker name:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBln \-sf libdemo.so.1.0.1 libdemo.so.1\fP
|
|
|
|
$ \fBln \-sf libdemo.so.1 libdemo.so\fP
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
2015-07-10 18:37:59 +00:00
|
|
|
Next, we compile the main program, linking it against the shared object,
|
2014-06-10 14:38:26 +00:00
|
|
|
and then list the dynamic dependencies of the program:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \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)
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
2015-07-10 18:37:59 +00:00
|
|
|
In order to get profiling information for the shared object,
|
2014-06-10 14:38:26 +00:00
|
|
|
we define the environment variable
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.B LD_PROFILE
|
2014-06-10 14:38:26 +00:00
|
|
|
with the soname of the library:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBexport LD_PROFILE=libdemo.so.1\fP
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
We then define the environment variable
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.B LD_PROFILE_OUTPUT
|
2014-06-10 14:38:26 +00:00
|
|
|
with the pathname of the directory where profile output should be written,
|
|
|
|
and create that directory if it does not exist already:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBexport LD_PROFILE_OUTPUT=$(pwd)/prof_data\fP
|
|
|
|
$ \fBmkdir \-p $LD_PROFILE_OUTPUT\fP
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
.B LD_PROFILE
|
|
|
|
causes profiling output to be
|
|
|
|
.I appended
|
|
|
|
to the output file if it already exists,
|
|
|
|
so we ensure that there is no preexisting profiling data:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBrm \-f $LD_PROFILE_OUTPUT/$LD_PROFILE.profile\fP
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
We then run the program to produce the profiling output,
|
|
|
|
which is written to a file in the directory specified in
|
|
|
|
.BR LD_PROFILE_OUTPUT :
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBLD_LIBRARY_PATH=. ./prog\fP
|
|
|
|
$ \fBls prof_data\fP
|
|
|
|
libdemo.so.1.profile
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
We then use the
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.B sprof \-p
|
2014-06-10 14:38:26 +00:00
|
|
|
option to generate a flat profile with counts and ticks:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBsprof \-p libdemo.so.1 $LD_PROFILE_OUTPUT/libdemo.so.1.profile\fP
|
|
|
|
Flat profile:
|
|
|
|
|
|
|
|
Each sample counts as 0.01 seconds.
|
|
|
|
% cumulative self self total
|
|
|
|
time seconds seconds calls us/call us/call name
|
|
|
|
60.00 0.06 0.06 100 600.00 consumeCpu1
|
|
|
|
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
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
The
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.B sprof \-q
|
2014-06-10 14:38:26 +00:00
|
|
|
option generates a call graph:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \fBsprof \-q libdemo.so.1 $LD_PROFILE_OUTPUT/libdemo.so.1.profile\fP
|
|
|
|
|
|
|
|
index % time self children called name
|
|
|
|
|
|
|
|
0.00 0.00 100/100 x1 [1]
|
|
|
|
[0] 100.0 0.00 0.00 100 consumeCpu1 [0]
|
|
|
|
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
|
|
|
|
0.00 0.00 1/1 <UNKNOWN>
|
|
|
|
[1] 0.0 0.00 0.00 1 x1 [1]
|
|
|
|
0.00 0.00 100/100 consumeCpu1 [0]
|
|
|
|
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
|
|
|
|
0.00 0.00 1000/1000 x2 [3]
|
|
|
|
[2] 0.0 0.00 0.00 1000 consumeCpu2 [2]
|
|
|
|
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
|
|
|
|
0.00 0.00 1/1 <UNKNOWN>
|
|
|
|
[3] 0.0 0.00 0.00 1 x2 [3]
|
|
|
|
0.00 0.00 1000/1000 consumeCpu2 [2]
|
|
|
|
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.PP
|
|
|
|
Above and below, the "<UNKNOWN>" strings represent identifiers that
|
|
|
|
are outside of the profiled object (in this example, these are instances of
|
|
|
|
.IR main() ).
|
|
|
|
.PP
|
|
|
|
The
|
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1: tfix, use a one-font macro for a single argument
1) Use a single capital font macro for a genuine single argument.
The output is unchanged.
2) Remove quotation marks (") around a single argument.
The output is unchanged.
3) Change ".IR ab()" to ".IR ab ()"
A font is changed in the output.
mtk: I verified that the output is unchanged (other than fonts)
by comparing the output of:
for a in *.1; do man $a >> out.txt; done
before and after the patch.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-24 00:20:29 +00:00
|
|
|
.B sprof \-c
|
2014-06-10 14:38:26 +00:00
|
|
|
option generates a list of call pairs and the number of their occurrences:
|
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof.1, time.1, iconvconfig.8, ld.so.8, ldconfig.8, sln.8: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 00:52:54 +00:00
|
|
|
.PP
|
2014-06-10 14:38:26 +00:00
|
|
|
.in +4n
|
2017-08-16 09:14:04 +00:00
|
|
|
.EX
|
2014-06-10 14:38:26 +00:00
|
|
|
$ \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
|
2017-08-16 09:14:04 +00:00
|
|
|
.EE
|
2014-06-10 14:38:26 +00:00
|
|
|
.in
|
|
|
|
.SH SEE ALSO
|
|
|
|
.BR gprof (1),
|
|
|
|
.BR ldd (1),
|
|
|
|
.BR ld.so (8)
|