-
Notifications
You must be signed in to change notification settings - Fork 281
/
Makefile
36 lines (26 loc) · 1.01 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
SCRIPTS := $(filter-out _%.py, $(wildcard *.py))
PERF := $(patsubst %.py, %.perf, $(SCRIPTS))
TIME := $(patsubst %.py, %.time, $(SCRIPTS))
MEMIT := $(patsubst %.py, %.memit, $(SCRIPTS))
KERNPROF := $(patsubst %.py, %.kernprof, $(SCRIPTS))
all: $(PERF) $(TIME) $(MEMIT) $(KERNPROF)
perf: $(PERF)
time: $(TIME)
memit: $(MEMIT)
kernprof: $(KERNPROF)
%.kernprof: %.py
@echo "lineprof-izing $<"
kernprof.py -l -v $< > $@ 2>&1
%.memit: %.py
@echo "%memit-izing $<"
python -m memory_profiler $< > $@ 2>&1
%.time: %.py
@echo "Timing $<"
time -v python $< > $@ 2>&1
%.perf: %.py
@echo "Perfiling $<"
#perf stat -B -e cache-references,cache-misses,cycles,instructions,branches,faults,migrations python $< > $@ 2>&1
#perf stat -B -r 3 python $< > $@ 2>&1
perf stat -e cycles,stalled-cycles-frontend,stalled-cycles-backend,instructions,cache-references,cache-misses,branches,branch-misses,task-clock,faults,minor-faults,cs,migrations -r 3 python $< > $@ 2>&1
clean:
rm -rf $(PERF) $(TIME) $(MEMIT) $(KERNPROF)