1+ #! /bin/bash -e
2+ #
3+ # Copyright (C) 2019 HERE Europe B.V.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+ #
17+ # SPDX-License-Identifier: Apache-2.0
18+ # License-Filename: LICENSE
19+
20+ ulimit -c unlimited # for core dump backtrace
21+
22+ # Start local server
23+ node tests/utils/olp_server/server.js & export SERVER_PID=$!
24+
25+ # Node can start server in 1 second, but not faster.
26+ # Add waiter for server to be started. No other way to solve that.
27+ # Curl returns code 1 - means server still down. Curl returns 0 when server is up
28+ RC=1
29+ while [[ ${RC} -ne 0 ]];
30+ do
31+ set +e
32+ curl -s http://localhost:3000
33+ RC=$?
34+ sleep 0.15
35+ set -e
36+ done
37+ echo " >>> Local Server started for further performance test ... >>>"
38+
39+ export cache_location=" cache"
40+
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"
44+
45+ du -h $cache_location
46+
47+ # TODO:
48+ # 1. print the total allocations done
49+ # 2. generate nice looking graphs using heaptrack_print and flamegraph.pl
50+ # 3. use watch command on cache directory, like: watch "du | cut -d'.' -f1 >> cache.csv" and plot a disk size graph
51+ # 4. track the disk IO made by SDK
52+ # 5. track the CPU load
53+
54+ # Kill local server
55+ kill -15 $SERVER_PID
56+ wait $SERVER_PID # Waiter for server process to be exited correctly
0 commit comments