This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.1.x by this push:
new 54323c9 Update -with-profile and add some profiling documentation
(#7601)
54323c9 is described below
commit 54323c9be13ed4405927e283813a963d722cebc4
Author: Susan Hinrichs <[email protected]>
AuthorDate: Tue Mar 30 10:20:25 2021 -0500
Update -with-profile and add some profiling documentation (#7601)
(cherry picked from commit 4f62b623b8434856093dac8aff138e9bbbe58a25)
---
configure.ac | 2 +-
doc/developer-guide/debugging/profiling.en.rst | 33 ++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 63fc801..916ebdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1993,7 +1993,7 @@ if test
"x${ac_cv_member_struct_tcp_info_tcpi_data_segs_out}" = "xyes"; then
fi
if test "x${with_profiler}" = "xyes"; then
-AC_CHECK_HEADERS([google/profiler.h \
+AC_CHECK_HEADERS([gperftools/profiler.h \
], [], [])
fi
diff --git a/doc/developer-guide/debugging/profiling.en.rst
b/doc/developer-guide/debugging/profiling.en.rst
index e2073cf..4edc9ec 100644
--- a/doc/developer-guide/debugging/profiling.en.rst
+++ b/doc/developer-guide/debugging/profiling.en.rst
@@ -22,3 +22,36 @@
Profiling
*********
+There are two main options for performance profiling: perf and gperf.
+
+perf
+====
+
+The perf top option is useful to quickly identify functions that are taking a
larger than expected
+portion of the execution time.::
+
+ sudo perf top -p `pidof traffic_server`
+
+For more details use the record subcommand to gather profiling data on the
traffic_server process. Using
+the -g option will gather call stack information. Compiling with -ggdb and
-fno-omit-frame-pointer
+will make it more likely that perf record will gather complete callstacks.::
+
+ sudo perf record -g -p `pidof traffic_server`
+
+After gathering profilng data with perf record, use perf report to display the
call stacks with their corresponding
+contribution to total execution time.::
+
+ sudo perf report
+
+gperf
+=====
+
+Gperftools also provides libraries to statistically sample the callstacks of a
process. The --with-profile=yes option for configure will
+link with the gperftools profiling library and add profile stop and profile
dump function calls at the beginning and end of the traffic_server
+main function. The profilng data will be dumped in /tmp/ts.prof.
+
+Once the profiling data file is present, you can use the pprof tool to
generate a pdf callgraph of the data to see which
+call stacks contribute most to the execution time.::
+
+ pprof --pdf /opt/trafficserver/9.0/bin/traffic_server ts.prof > prof.pdf
+