mirror of
https://github.com/Pithikos/C-Thread-Pool
synced 2024-11-21 21:21:23 +03:00
Nicer output
This commit is contained in:
parent
2fb7472b1f
commit
9668644fcf
@ -31,9 +31,9 @@ function test_thread_free { #threads
|
||||
# This is the same with test_many_thread_allocs but multiplied
|
||||
function test_thread_free_multi { #threads #times
|
||||
echo "Testing multiple threads creation and destruction in pool(threads=$1 times=$2)"
|
||||
echo "(this might take a while)"
|
||||
gcc src/no_work.c ../thpool.c -pthread -o test
|
||||
for ((i = 1; i <= $2; i++)); do
|
||||
python -c "import sys; sys.stdout.write('$i/$2\r')"
|
||||
output=$(valgrind --leak-check=full --track-origins=yes ./test "$1" 2>&1 > /dev/null)
|
||||
heap_usage=$(echo "$output" | grep "total heap usage")
|
||||
allocs=$(extract_num "[0-9]* allocs" "$heap_usage")
|
||||
@ -44,8 +44,9 @@ function test_thread_free_multi { #threads #times
|
||||
if (( "$allocs" != "$frees" )); then
|
||||
err "Allocated $allocs times but freed only $frees" "$output"
|
||||
fi
|
||||
echo "Allocs: $allocs Frees: $frees"
|
||||
#echo "Allocs: $allocs Frees: $frees"
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user