mirror of
https://github.com/ipfs/kubo.git
synced 2025-10-25 10:27:01 +08:00
feat: keep profiling data from test runs
This commit is contained in:
@ -10,6 +10,9 @@ setup: docker_ipfs_image data/filetiny data/filerand
|
|||||||
save_logs:
|
save_logs:
|
||||||
sh bin/save_logs.sh
|
sh bin/save_logs.sh
|
||||||
|
|
||||||
|
save_profiling_data:
|
||||||
|
sh bin/save_profiling_data.sh
|
||||||
|
|
||||||
data/filetiny: Makefile
|
data/filetiny: Makefile
|
||||||
cp Makefile ./data/filetiny # simple
|
cp Makefile ./data/filetiny # simple
|
||||||
|
|
||||||
|
|||||||
18
test/3nodetest/bin/save_profiling_data.sh
Normal file
18
test/3nodetest/bin/save_profiling_data.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for container in 3nodetest_bootstrap_1 3nodetest_client_1 3nodetest_server_1; do
|
||||||
|
# ipfs binary is required by `go tool pprof`
|
||||||
|
docker cp $container:/go/bin/ipfs build/profiling_data_$container
|
||||||
|
done
|
||||||
|
|
||||||
|
# since the nodes are executed with the --debug flag, profiling data is written
|
||||||
|
# to the the working dir. by default, the working dir is /go.
|
||||||
|
|
||||||
|
for container in 3nodetest_bootstrap_1 3nodetest_client_1 3nodetest_server_1; do
|
||||||
|
docker cp $container:/go/ipfs.cpuprof build/profiling_data_$container
|
||||||
|
done
|
||||||
|
|
||||||
|
# TODO get memprof from client (client daemon isn't terminated, so memprof isn't retrieved)
|
||||||
|
for container in 3nodetest_bootstrap_1 3nodetest_server_1; do
|
||||||
|
docker cp $container:/go/ipfs.memprof build/profiling_data_$container
|
||||||
|
done
|
||||||
1
test/3nodetest/build/.gitignore
vendored
1
test/3nodetest/build/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
.built_img
|
.built_img
|
||||||
*.log
|
*.log
|
||||||
|
profiling_data*
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
|
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
|
||||||
ipfs bootstrap # list bootstrap nodes for debugging
|
ipfs bootstrap # list bootstrap nodes for debugging
|
||||||
|
|
||||||
|
|
||||||
echo "3nodetest> starting client daemon"
|
echo "3nodetest> starting client daemon"
|
||||||
ipfs daemon &
|
|
||||||
|
ipfs daemon --debug &
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
# switch dirs so ipfs client profiling data doesn't overwrite the ipfs daemon
|
||||||
|
# profiling data
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
while [ ! -f /data/idtiny ]
|
while [ ! -f /data/idtiny ]
|
||||||
do
|
do
|
||||||
echo "3nodetest> waiting for server to add the file..."
|
echo "3nodetest> waiting for server to add the file..."
|
||||||
|
|||||||
@ -6,6 +6,7 @@ data:
|
|||||||
|
|
||||||
bootstrap:
|
bootstrap:
|
||||||
build: ./bootstrap
|
build: ./bootstrap
|
||||||
|
command: daemon --debug --init
|
||||||
expose:
|
expose:
|
||||||
- "4011"
|
- "4011"
|
||||||
- "4012/udp"
|
- "4012/udp"
|
||||||
|
|||||||
@ -27,6 +27,10 @@ fig up --no-color | tee build/fig.log
|
|||||||
echo "make save_logs"
|
echo "make save_logs"
|
||||||
make save_logs
|
make save_logs
|
||||||
|
|
||||||
|
# save the ipfs logs for inspection
|
||||||
|
echo "make save_profiling_data"
|
||||||
|
make save_profiling_data
|
||||||
|
|
||||||
# fig up won't report the error using an error code, so we grep the
|
# fig up won't report the error using an error code, so we grep the
|
||||||
# fig.log file to find out whether the call succeeded
|
# fig.log file to find out whether the call succeeded
|
||||||
echo 'tail build/fig.log | grep "exited with code 0"'
|
echo 'tail build/fig.log | grep "exited with code 0"'
|
||||||
|
|||||||
@ -5,10 +5,16 @@ ipfs bootstrap # list bootstrap nodes for debugging
|
|||||||
# wait for daemon to start/bootstrap
|
# wait for daemon to start/bootstrap
|
||||||
# alternatively use ipfs swarm connect
|
# alternatively use ipfs swarm connect
|
||||||
echo "3nodetest> starting server daemon"
|
echo "3nodetest> starting server daemon"
|
||||||
ipfs daemon &
|
|
||||||
|
# run daemon in debug mode to collect profiling data
|
||||||
|
ipfs daemon --debug &
|
||||||
sleep 3
|
sleep 3
|
||||||
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
|
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
|
||||||
|
|
||||||
|
# change dir before running add commands so ipfs client profiling data doesn't
|
||||||
|
# overwrite the daemon profiling data
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
# must mount this volume from data container
|
# must mount this volume from data container
|
||||||
ipfs add -q /data/filetiny > tmptiny
|
ipfs add -q /data/filetiny > tmptiny
|
||||||
mv tmptiny /data/idtiny
|
mv tmptiny /data/idtiny
|
||||||
|
|||||||
Reference in New Issue
Block a user