From 15230bbb9b1f69def9b0e1b41a097638c0fda734 Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 28 Apr 2020 09:11:18 +0000 Subject: deploy: fef4d6ff2ad9f48e6dccde0f061453e6a3ac624e --- trace_profile/index.html | 220 ++++++++++++++++++++++++++++++++++++ trace_profile/ltrace.html | 231 ++++++++++++++++++++++++++++++++++++++ trace_profile/oprofile.html | 231 ++++++++++++++++++++++++++++++++++++++ trace_profile/perf.html | 265 ++++++++++++++++++++++++++++++++++++++++++++ trace_profile/strace.html | 242 ++++++++++++++++++++++++++++++++++++++++ trace_profile/time.html | 223 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1412 insertions(+) create mode 100644 trace_profile/index.html create mode 100644 trace_profile/ltrace.html create mode 100644 trace_profile/oprofile.html create mode 100644 trace_profile/perf.html create mode 100644 trace_profile/strace.html create mode 100644 trace_profile/time.html (limited to 'trace_profile') diff --git a/trace_profile/index.html b/trace_profile/index.html new file mode 100644 index 0000000..a527e6c --- /dev/null +++ b/trace_profile/index.html @@ -0,0 +1,220 @@ + + + + + + Trace and Profile - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+

Trace and Profile

+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trace_profile/ltrace.html b/trace_profile/ltrace.html new file mode 100644 index 0000000..18d547c --- /dev/null +++ b/trace_profile/ltrace.html @@ -0,0 +1,231 @@ + + + + + + ltrace - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+

ltrace(1)

+
ltrace [opts] [prg]
+  -f .......... follow child processes on fork(2)
+  -p <pid> .... attach to running process
+  -o <file> ... log output into <file>
+  -l <filter> . show who calls into lib matched by <filter>
+  -C .......... demangle
+
+

Example

+

List which program/libs call into libstdc++:

+
ltrace -l '*libstdc++*' -C -o ltrace.log ./main
+
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trace_profile/oprofile.html b/trace_profile/oprofile.html new file mode 100644 index 0000000..a394215 --- /dev/null +++ b/trace_profile/oprofile.html @@ -0,0 +1,231 @@ + + + + + + OProfile - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+

OProfile

+
operf -g -p <pid>
+  -g ...... caputre call-graph information
+
+opreport [opt] FILE
+            show time spent per binary image
+  -l ...... show time spent per symbol
+  -c ...... show callgraph information (see below)
+  -a ...... add column with time spent accumulated over child nodes
+
+ophelp      show supported hw/sw events
+
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trace_profile/perf.html b/trace_profile/perf.html new file mode 100644 index 0000000..4e3ab39 --- /dev/null +++ b/trace_profile/perf.html @@ -0,0 +1,265 @@ + + + + + + perf - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+

perf(1)

+
perf list      show supported hw/sw events
+
+perf stat
+  -p <pid> .. show stats for running process
+  -I <ms> ... show stats periodically over interval <ms>
+  -e <ev> ... filter for events
+
+perf top
+  -p <pid> .. show stats for running process
+  -F <hz> ... sampling frequency
+  -K ........ hide kernel threads
+
+perf record
+  -p <pid> ............... record stats for running process
+  -F <hz> ................ sampling frequency
+  --call-graph <method> .. [fp, dwarf, lbr] method how to caputre backtrace
+                           fp   : use frame-pointer, need to compile with
+                                  -fno-omit-frame-pointer
+                           dwarf: use .cfi debug information
+                           lbr  : use hardware last branch record facility
+  -g ..................... short-hand for --call-graph fp
+  -e <ev> ................ filter for events
+
+perf report
+  -n .................... annotate symbols with nr of samples
+  --stdio ............... report to stdio, if not presen tui mode
+  -g graph,0.5,caller ... show caller based call chains with value >0.5
+
+
Useful <ev>:
+  page-faults
+  minor-faults
+  major-faults
+  cpu-cycles`
+  task-clock
+
+

Flamegraph

+

Flamegraph with single event trace

+
perf record -g -e cpu-cycles -p <pid>
+perf script | FlameGraph/stackcollapse-perf.pl | FlameGraph/flamegraph.pl > cycles-flamegraph.svg
+
+

Flamegraph with multiple event traces

+
perf record -g -e cpu-cycles,page-faults -p <pid>
+perf script --per-event-dump
+# fold & generate as above
+
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trace_profile/strace.html b/trace_profile/strace.html new file mode 100644 index 0000000..909a9f4 --- /dev/null +++ b/trace_profile/strace.html @@ -0,0 +1,242 @@ + + + + + + strace - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+

strace(1)

+
strace [opts] [prg]
+  -f .......... follow child processes on fork(2)
+  -p <pid> .... attach to running process
+  -s <size> ... max string size, truncate of longer (default: 32)
+  -e <expr> ... expression for trace filtering
+  -o <file> ... log output into <file>
+  -c .......... dump syscall statitics at the end
+
+
<expr>:
+  trace=syscall[,syscall] .... trace only syscall listed
+  trace=file ................. trace all syscall that take a filename as arg
+  trace=process .............. trace process management related syscalls
+  trace=signal ............... trace signal related syscalls
+  signal ..................... trace signals delivered to the process
+
+

Examples

+

Trace open(2) & socket(2) syscalls for a running process + child processes:

+
strace -f -e trace=open,socket -p <pid>
+
+

Trace signals delivered to a running process:

+
strace -f -e signal -p <pid>
+
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trace_profile/time.html b/trace_profile/time.html new file mode 100644 index 0000000..34badc2 --- /dev/null +++ b/trace_profile/time.html @@ -0,0 +1,223 @@ + + + + + + time - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + +
+
+

/usr/bin/time(1)

+
# statistics of process run
+/usr/bin/time -v <cmd>
+
+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3