-
Notifications
You must be signed in to change notification settings - Fork 478
uftrace for Git
Honggyu Kim edited this page Dec 2, 2019
·
2 revisions
This document is written by Handong Choi.
$ wget https://github.com/git/git/archive/v2.23.0.tar.gz
$ tar -zxf v2.23.0.tar.gz
$ cd git-2.23.0/
(Optional) If you need to install required packages:
$ sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev \
gettext libz-dev libssl-dev install-info
Run configure
with -g -pg
options. Also, you can add some optional parameters (e.g. --prefix=/usr
) as well but it's not necessary for now.
$ autoreconf
$ CFLAGS='-pg -g' CXXFLAGS='-pg -g' ./configure
Execute make
, it's recommended to do this in several threads.
$ make -j4 all
$ ./git --version
git version 2.23.0
$ nm ./git | grep mcount
U mcount@@GLIBC_2.2.5
$ uftrace -F main -D 2 --no-event ./git -version
git version 2.23.0
# DURATION TID FUNCTION
[ 61730] | main() {
11.491 us [ 61730] | trace2_initialize_clock();
14.944 us [ 61730] | sanitize_stdfds();
5.925 us [ 61730] | restore_sigpipe_to_default();
0.186 us [ 61730] | git_resolve_executable_dir();
87.670 us [ 61730] | trace2_initialize_fl();
0.164 us [ 61730] | trace2_cmd_start_fl();
7.935 us [ 61730] | git_setup_gettext();
28.255 us [ 61730] | initialize_the_repository();
1.379 us [ 61730] | attr_start();
[ 61730] | cmd_main() {
uftrace stopped tracing with remaining functions
================================================
task: 61730
[1] cmd_main
[0] main
$ uftrace record -F main -D 2 --no-event ./git --version
git version 2.23.0
$ uftrace replay
# DURATION TID FUNCTION
[ 61743] | main() {
16.120 us [ 61743] | trace2_initialize_clock();
14.147 us [ 61743] | sanitize_stdfds();
5.992 us [ 61743] | restore_sigpipe_to_default();
0.174 us [ 61743] | git_resolve_executable_dir();
68.137 us [ 61743] | trace2_initialize_fl();
0.185 us [ 61743] | trace2_cmd_start_fl();
14.070 us [ 61743] | git_setup_gettext();
46.961 us [ 61743] | initialize_the_repository();
1.675 us [ 61743] | attr_start();
[ 61743] | cmd_main() {
uftrace stopped tracing with remaining functions
================================================
task: 61743
[1] cmd_main
[0] main
TUI:
$ uftrace tui
TOTAL TIME : FUNCTION
203.549 us : (1) git
203.549 us : (1) main
16.120 us : ├─(1) trace2_initialize_clock
: │
14.147 us : ├─(1) sanitize_stdfds
: │
5.992 us : ├─(1) restore_sigpipe_to_default
: │
0.174 us : ├─(1) git_resolve_executable_dir
: │
68.137 us : ├─(1) trace2_initialize_fl
: │
0.185 us : ├─(1) trace2_cmd_start_fl
: │
14.070 us : ├─(1) git_setup_gettext
: │
46.961 us : ├─(1) initialize_the_repository
: │
1.675 us : ├─(1) attr_start
: │
: └─(1) cmd_main
uftrace graph: session 3ab8aab308fdfb5e (/home/henry/git-2.23.0/git) 0%
Graph:
$ uftrace graph
# Function Call Graph for 'git' (session: 3ab8aab308fdfb5e)
========== FUNCTION CALL GRAPH ==========
# TOTAL TIME FUNCTION
203.549 us : (1) git
203.549 us : (1) main
16.120 us : +-(1) trace2_initialize_clock
: |
14.147 us : +-(1) sanitize_stdfds
: |
5.992 us : +-(1) restore_sigpipe_to_default
: |
0.174 us : +-(1) git_resolve_executable_dir
: |
68.137 us : +-(1) trace2_initialize_fl
: |
0.185 us : +-(1) trace2_cmd_start_fl
: |
14.070 us : +-(1) git_setup_gettext
: |
46.961 us : +-(1) initialize_the_repository
: |
1.675 us : +-(1) attr_start
: |
: +-(1) cmd_main
Chrome:
$ uftrace record -t 1ms ./git --version
git version 2.23.0
$ uftrace dump --chrome > git.json
$ trace2html git.json
git.html
Flame graph:
$ uftrace record -t 1ms ./git --version
git version 2.23.0
$ uftrace dump --flame-graph | ./flamegraph.pl >git.svg
- Home
- Tutorial
- Development
- Practical Use Cases
- GCC
- Clang/LLVM
- Node.js
- Chromium
- MySQL/InnoDB
- FFmpeg
- CPython
- POCO
- Telegram
- yara
- RustPython
- cURL
- bpftrace
- SpiderMonkey
- Apache HTTP Server
- GStreamer
- Squid
- TCPDUMP
- OpenCV
- Libav
- Wireshark
- LXC
- Git
- Radare2
- uftrace on Android
- deno
- parallel sort algorithm
- LevelDB/RocksDB (YCSB)
- Redis
- libjpeg‐turbo (JPEG)
- JM (H.264/AVC)
- HM (HEVC)
- VTM (VVC)
- CUDA
- Erlang/OTP BEAM
- uftrace on Yocto
- TTCN3