-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
121 lines (107 loc) · 3.01 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# See https://taskfile.dev for more information
version: '3'
vars:
FLAMEGRAPH: '{{default "~/flamegraph" .FLAMEGRAPH_HOME}}'
tasks:
build:program:
cmds:
# Make the destination directory
- mkdir -p bin
# Compile the program
- g++ {{if eq .DEBUG "true"}} -g{{end}} -I {{.INCLUDE}} src/main.cpp -o ./bin/main
vars:
# Headers
INCLUDE: /usr/include/eigen3
desc: Build the program
label: 'build:program (Debug: {{eq .DEBUG "true"}}, include: {{.INCLUDE}})'
silent: true
sources:
- src/main.cpp
generates:
- ./bin/main
build:proxy:
cmds:
# Generate Makefiles
- cmake -B lib {{if eq .DEBUG "true"}} -DDEBUG=ON{{end}} .
# Build
- cmake --build lib
desc: Build the proxy
label: 'build:proxy (Debug: {{eq .DEBUG "true"}})'
silent: true
sources:
- CMakeLists.txt
- src/proxy.cpp
generates:
- lib/*
symbols:program:
cmds:
- nm -C ./bin/main | grep "Eigen::internal::general_matrix_matrix_product<.*>::run\(.*\)$"
deps:
- build:program
desc: Lists the relevant (filtered) symbols from the program
silent: true
symbols:proxy:
cmds:
- nm -C lib/libproxy.so | grep qbdipreload_on_run
deps:
- build:proxy
desc: Lists the relevant (filtered) symbols from the proxy
silent: true
profile:no-proxy:
cmds:
# Run the program
- perf record --call-graph fp --freq max --output ./no-proxy.data ./bin/main
# Generate a perf script, collapse, and convert to a flamegraph
- perf script --input ./no-proxy.data | {{.FLAMEGRAPH}}/stackcollapse-perf.pl | {{.FLAMEGRAPH}}/flamegraph.pl > flamegraph-no-proxy.svg
deps:
- build:program
- build:proxy
desc: Profile the program without the proxy
silent: true
sources:
- ./bin/main
generates:
- ./no-proxy.data
- ./flamegraph-no-proxy.svg
profile:proxy:
cmds:
# Run the program
- perf record --call-graph fp --freq max --output ./proxy.data env LD_BIND_NOW=1 LD_PRELOAD=./lib/libproxy.so ./bin/main
# Generate a perf script, collapse, and convert to a flamegraph
- perf script --input ./proxy.data | {{.FLAMEGRAPH}}/stackcollapse-perf.pl | {{.FLAMEGRAPH}}/flamegraph.pl > flamegraph-proxy.svg
deps:
- build:program
- build:proxy
desc: Profile the program with the proxy
silent: true
sources:
- ./bin/main
- ./lib/libproxy.so
generates:
- ./proxy.data
- ./flamegraph-proxy.svg
clean:
cmds:
# Delete the directories
- cmd: rm bin lib -r
ignore_error: true
desc: Clean everything
silent: true
run:no-proxy:
cmds:
- ./bin/main
deps:
- build:program
desc: Run the program without the proxy
silent: true
run:proxy:
cmds:
- ./bin/main
deps:
- build:program
- build:proxy
desc: Run the program with the proxy
env:
LD_BIND_NOW: 1
LD_PRELOAD: ./lib/libproxy.so
silent: true