Moved benchmark code into tests directory.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
TESTS = $(check_PROGRAMS)
|
||||
check_PROGRAMS = graph_tests select_tests compressed_seq_tests compressed_rank_tests
|
||||
check_PROGRAMS = graph_tests select_tests compressed_seq_tests compressed_rank_tests cmph_benchmark_test
|
||||
noinst_PROGRAMS = packed_mphf_tests mphf_tests
|
||||
|
||||
INCLUDES = -I../src/
|
||||
@@ -21,3 +21,6 @@ compressed_seq_tests_LDADD = ../src/libcmph.la
|
||||
|
||||
compressed_rank_tests_SOURCES = compressed_rank_tests.c
|
||||
compressed_rank_tests_LDADD = ../src/libcmph.la
|
||||
|
||||
cmph_benchmark_test_SOURCES = cmph_benchmark_test.c
|
||||
cmph_benchmark_test_LDADD = ../src/libcmph.la
|
||||
|
||||
23
tests/cmph_benchmark_test.c
Normal file
23
tests/cmph_benchmark_test.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <unistd.h> // for sleep
|
||||
#include <limits.h>
|
||||
|
||||
#include "cmph_benchmark.h"
|
||||
|
||||
void bm_sleep(int iters) {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
void bm_increment(int iters) {
|
||||
int i, v = 0;
|
||||
for (i = 0; i < INT_MAX; ++i) {
|
||||
v += i;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
BM_REGISTER(bm_sleep, 1);
|
||||
BM_REGISTER(bm_increment, 1);
|
||||
run_benchmarks(argc, argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user