-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (69 loc) · 2.57 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# Virtual Memory Operations Benchmark
#
# Copyright 2020 Reto Achermann
# SPDX-License-Identifier: GPL-3.0
#
PLATFORM=linux
# Compiler and flags to use
CC=gcc
COMMON_CFLAGS=-O3 -Wall -Wextra -std=c11
BENCHMARK_FILES=$(wildcard src/benchmarks/*.c)
# dependencies
DEPS_SRC=$(wildcard src/*.c) $(wildcard src/platform/*.c) $(wildcard src/benchmarks/*.c)
DEPS_INC=$(wildcard src/*.h) $(wildcard src/platform/*.h) $(wildcard src/benchmarks/*.h)
DEPS_ALL=$(DEPS_SRC) $(DEPS_INC) Makefile
ifeq ($(PLATFORM),linux)
PLAT_LIBS=-lnuma -lrt -lpthread
else
PLAT_LIBS=
endif
CFLAGS=$(COMMON_CFLAGS) $(PLAT_CFLAGS)
LIBS=$(COMMON_LIBS) $(PLAT_LIBS)
# build targets
all: bin/vmops bin/vmopstrace
bin/vmops : $(DEPS_ALL)
mkdir -p bin
$(CC) $(CFLAGS) -o $@ src/main.c $(BENCHMARK_FILES) src/platform/$(PLATFORM).c $(LIBS)
bin/vmopstrace : $(DEPS_ALL)
mkdir -p bin
$(CC) $(CFLAGS) -g -fno-omit-frame-pointer -o $@ src/main.c $(BENCHMARK_FILES) src/platform/$(PLATFORM).c $(LIBS)
contrib/flamegraph :
git clone https://github.com/brendangregg/FlameGraph.git $@
profileprep :
echo 0 | sudo tee /proc/sys/kernel/kptr_restrict
echo "-1" | sudo tee /proc/sys/kernel/perf_event_paranoid > /dev/null
sudo sysctl -w vm.max_map_count=2000000000
perfdata:
mkdir -p perfdata
#profile-clean:
#rm -rf perfdata
perfdata/maponly-isolated.perf : perfdata bin/vmopstrace
make profileprep
perf record -o $@ --delay=1 -g ./bin/vmopstrace -b maponly-isolated -t 5000
perfdata/maponly-default.perf: perfdata bin/vmopstrace
make profileprep
perf record -o $@ --delay=1 -g ./bin/vmopstrace -b maponly -t 5000
perfdata/maponly-isolated-4.perf: perfdata bin/vmopstrace
make profileprep
perf record -o $@ --delay=1 -g ./bin/vmopstrace -b maponly-isolated -p 4 -t 5000
perfdata/maponly-default-4.perf: perfdata bin/vmopstrace
make profileprep
perf record -o $@ --delay=1 -g ./bin/vmopstrace -b maponly -p 4 -t 5000
perfdata/%.out : perfdata/%.perf
perf script -i $< > $@
.PRECIOUS: perfdata/%.out
perfdata/%.folded : perfdata/%.out contrib/flamegraph
./contrib/flamegraph/stackcollapse-perf.pl $< > $@
.PRECIOUS: perfdata/%.folded
perfdata/%.svg : perfdata/%.folded contrib/flamegraph
./contrib/flamegraph/flamegraph.pl --title "$@" --width 3500 $< > $@
profile-maponly-default : perfdata/maponly-default.svg Makefile
profile-maponly-isolated : perfdata/maponly-isolated.svg Makefile
profile-maponly-default-4 : perfdata/maponly-default-4.svg Makefile
profile-maponly-isolated-4 : perfdata/maponly-isolated-4.svg Makefile
clean:
rm -rf bin
rm -rf *.csv *.log *.png *.pdf
rm -rf perfdata
rm -rf scripts/barrelfish