1717# SPDX-License-Identifier: Apache-2.0
1818# License-Filename: LICENSE
1919
20- ulimit -c unlimited # for core dump backtrace
20+ # For core dump backtrace
21+ ulimit -c unlimited
2122
2223# Start local server
2324node tests/utils/olp_server/server.js & export SERVER_PID=$!
@@ -38,11 +39,46 @@ echo ">>> Local Server started for further performance test ... >>>"
3839
3940export cache_location=" cache"
4041
41- heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter=" *short_test_null_cache"
42- heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter=" *short_test_memory_cache"
43- heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter=" *short_test_disk_cache"
42+ echo " >>> Start performance tests ... >>>"
43+ heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter=" *short_test_null_cache" 2>> errors.txt || TEST_FAILURE=1
44+ mv heaptrack.olp-cpp-sdk-performance-tests.* .gz short_test_null_cache.gz
45+ heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter=" *short_test_memory_cache" 2>> errors.txt || TEST_FAILURE=1
46+ mv heaptrack.olp-cpp-sdk-performance-tests.* .gz short_test_memory_cache.gz
47+ heaptrack ./build/tests/performance/olp-cpp-sdk-performance-tests --gtest_filter=" *short_test_disk_cache" 2>> errors.txt || TEST_FAILURE=1
48+ mv heaptrack.olp-cpp-sdk-performance-tests.* .gz short_test_disk_cache.gz
49+ echo " >>> Finished performance tests . >>>"
4450
45- du -h $cache_location
51+ if [[ ${TEST_FAILURE} == 1 ]]; then
52+ echo " Printing error.txt ###########################################"
53+ cat errors.txt
54+ echo " End of error.txt #############################################"
55+ echo " CRASH ERROR. One of test groups contains crash. Report was not generated for that group ! "
56+ else
57+ echo " OK. Full list of tests passed. "
58+ fi
59+
60+ mkdir reports/heaptrack
61+ mkdir heaptrack
62+
63+ # Third party dependency needed for pretty graph generation below
64+ git clone --depth=1 https://github.com/brendangregg/FlameGraph
65+
66+ for archive_name in short_test_null_cache short_test_memory_cache short_test_disk_cache
67+ do
68+ heaptrack_print --print-leaks \
69+ --print-flamegraph heaptrack/flamegraph_${archive_name} .data \
70+ --file ${archive_name} .gz > reports/heaptrack/report_${archive_name} .txt
71+ # Pretty graph generation
72+ ./FlameGraph/flamegraph.pl --title=" Flame Graph: ${archive_name} " heaptrack/flamegraph_${archive_name} .data > reports/heaptrack/flamegraph_${archive_name} .svg
73+ cat reports/heaptrack/flamegraph_${archive_name} .svg >> heaptrack_report.html
74+ done
75+ cp heaptrack_report.html reports
76+ ls -la heaptrack
77+ ls -la
78+
79+ du ${cache_location}
80+ du ${cache_location} /*
81+ ls -la ${cache_location}
4682
4783# TODO:
4884# 1. print the total allocations done
@@ -51,6 +87,7 @@ du -h $cache_location
5187# 4. track the disk IO made by SDK
5288# 5. track the CPU load
5389
54- # Kill local server
55- kill -15 $SERVER_PID
56- wait $SERVER_PID # Waiter for server process to be exited correctly
90+ # Gracefully stop local server
91+ kill -15 ${SERVER_PID}
92+ # Waiter for server process to be exited correctly
93+ wait ${SERVER_PID}
0 commit comments