feat: keep profiling data from test runs
Brian Tiger Chow committed
Jan 10, 2015 at 00:34 UTC
093c87ef45f9f6206db4cc557a015cf51d956f21
7 files changed
+40
-3
test/3nodetest/Makefile
+3
@@ -10,6 +10,9 @@ setup: docker_ipfs_image data/filetiny data/filerand
10
save_logs:
11
sh bin/save_logs.sh
12
13
+save_profiling_data:
14
+ sh bin/save_profiling_data.sh
15
+
16
data/filetiny: Makefile
17
cp Makefile ./data/filetiny # simple
18
test/3nodetest/bin/save_profiling_data.sh
new
+18
@@ -0,0 +1,18 @@
1
+#!/bin/sh
2
+
3
+for container in 3nodetest_bootstrap_1 3nodetest_client_1 3nodetest_server_1; do
4
+ # ipfs binary is required by `go tool pprof`
5
+ docker cp $container:/go/bin/ipfs build/profiling_data_$container
6
+done
7
+
8
+# since the nodes are executed with the --debug flag, profiling data is written
9
+# to the the working dir. by default, the working dir is /go.
10
+
11
+for container in 3nodetest_bootstrap_1 3nodetest_client_1 3nodetest_server_1; do
12
+ docker cp $container:/go/ipfs.cpuprof build/profiling_data_$container
13
+done
14
+
15
+# TODO get memprof from client (client daemon isn't terminated, so memprof isn't retrieved)
16
+for container in 3nodetest_bootstrap_1 3nodetest_server_1; do
17
+ docker cp $container:/go/ipfs.memprof build/profiling_data_$container
18
+done
test/3nodetest/build/.gitignore
+1
@@ -1,2 +1,3 @@
1
.built_img
2
*.log
3
+profiling_data*
test/3nodetest/client/run.sh
+6
-2
@@ -1,11 +1,15 @@
1
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
2
ipfs bootstrap # list bootstrap nodes for debugging
3
4
-
4
echo "3nodetest> starting client daemon"
6
-ipfs daemon &
5
+
6
+ipfs daemon --debug &
7
sleep 3
8
9
+# switch dirs so ipfs client profiling data doesn't overwrite the ipfs daemon
10
+# profiling data
11
+cd /tmp
12
+
13
while [ ! -f /data/idtiny ]
14
do
15
echo "3nodetest> waiting for server to add the file..."
test/3nodetest/fig.yml
+1
@@ -6,6 +6,7 @@ data:
6
7
bootstrap:
8
build: ./bootstrap
9
+ command: daemon --debug --init
10
expose:
11
- "4011"
12
- "4012/udp"
test/3nodetest/run-test-on-img.sh
+4
@@ -27,6 +27,10 @@ fig up --no-color | tee build/fig.log
27
echo "make save_logs"
28
make save_logs
29
30
+# save the ipfs logs for inspection
31
+echo "make save_profiling_data"
32
+make save_profiling_data
33
+
34
# fig up won't report the error using an error code, so we grep the
35
# fig.log file to find out whether the call succeeded
36
echo 'tail build/fig.log | grep "exited with code 0"'
test/3nodetest/server/run.sh
+7
-1
@@ -5,10 +5,16 @@ ipfs bootstrap # list bootstrap nodes for debugging
5
# wait for daemon to start/bootstrap
6
# alternatively use ipfs swarm connect
7
echo "3nodetest> starting server daemon"
8
-ipfs daemon &
8
+
9
+# run daemon in debug mode to collect profiling data
10
+ipfs daemon --debug &
11
sleep 3
12
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
13
14
+# change dir before running add commands so ipfs client profiling data doesn't
15
+# overwrite the daemon profiling data
16
+cd /tmp
17
+
18
# must mount this volume from data container
19
ipfs add -q /data/filetiny > tmptiny
20
mv tmptiny /data/idtiny