Commit 1ec6f7b8 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Test program for perf counters

parent 49ec202c
......@@ -55,7 +55,7 @@ ftimings_c_example_SOURCES = \
ftimings_c_example_LDADD = libftimings-@FTIMINGS_API_VERSION@-@FC@.la
ftimings_c_example_LINK = $(FCLINK) -static
noinst_PROGRAMS = do_flops do_memory_transfer
noinst_PROGRAMS = do_flops do_memory_transfer test_perf
do_flops_SOURCES = \
examples/do_flops.c
......@@ -65,6 +65,10 @@ do_memory_transfer_SOURCES = \
examples/do_memory_transfer.c
do_memory_transfer_CPPFLAGS = -DTEST_DO_MEMORY_TRANSFER
test_perf_SOURCES = \
ftimings/perf_memory_counter.c
test_perf_CPPFLAGS = -DTEST_PERF
# other files to distribute
filesdir = $(datadir)/@PACKAGE@-@FC@/examples
files_DATA = examples/example.F90
......
......@@ -160,6 +160,7 @@ void ftimings_perf_memory_counters(int64_t *reads, int64_t *writes) {
#ifdef TEST_PERF
#include <assert.h>
#define mebi (1024L * 1024L)
#define N (512L * mebi / sizeof(int))
volatile int mem[N];
......@@ -168,7 +169,7 @@ int main() {
int i, j;
int64_t count_reads, count_writes;
ftimings_perf_memory_counters_init();
assert(ftimings_perf_memory_counters_init());
ftimings_perf_memory_counters(&count_reads, &count_writes);
printf("Read %" PRId64 " MiB (%" PRId64 " bytes),\twrote %" PRId64 " MiB (%" PRId64 " bytes) from RAM\n", count_reads / mebi, count_reads, count_writes / mebi, count_writes);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment