forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add a profiling script and Dockerfile.
This works on my kernel. If your kernel is older/newer, you may need a different alpine base image that matches your kernel more closely.
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM alpine:3.14.0 | ||
|
||
RUN ["apk", "add", "--no-cache", \ | ||
"gcc", \ | ||
"linux-headers", \ | ||
"msgpack-c-dev", \ | ||
"musl-dev", \ | ||
"libsodium-dev", \ | ||
"libvpx-dev", \ | ||
"opus-dev", \ | ||
"perf"] | ||
|
||
WORKDIR /work | ||
COPY other/docker/perf/entrypoint.sh / | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
|
||
TEST=conference_test | ||
OUTPUT="/work/c-toxcore/test.perf" | ||
|
||
gcc -pthread -g \ | ||
-o "/work/$TEST" -O3 -fno-omit-frame-pointer \ | ||
$(find /work/c-toxcore/tox* -name "*.c") \ | ||
/work/c-toxcore/auto_tests/auto_test_support.c \ | ||
/work/c-toxcore/testing/misc_tools.c \ | ||
"/work/c-toxcore/auto_tests/$TEST.c" \ | ||
-DMIN_LOGGER_LEVEL=LOGGER_LEVEL_TRACE \ | ||
$(pkg-config --cflags --libs libsodium msgpack opus vpx) | ||
|
||
time perf record -g --call-graph dwarf --freq=999 "/work/$TEST" /work/c-toxcore/auto_tests/ | ||
perf report | head -n50 | ||
perf script -F +pid > "$OUTPUT" | ||
chown 1000:100 "$OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
|
||
docker build -t toxchat/c-toxcore:perf -f other/docker/perf/Dockerfile . | ||
docker run --privileged --rm -it \ | ||
-v "$PWD:/work/c-toxcore" \ | ||
toxchat/c-toxcore:perf |