1
1
N? =100
2
+ TIME =perf stat --metric-only ./a.out 2>&1 | grep seconds | cut -d' ' -f8 | xargs echo
2
3
3
4
all : include.benchmark assert.benchmark test.benchmark suite.benchmark suite+assert.benchmark suite+assert+stl.benchmark
4
5
@make clean
@@ -8,19 +9,19 @@ ut: ut.suite+assert+stl.benchmark
8
9
9
10
% .benchmark : clean
10
11
@time -f" $* :googletest %e" $(CXX ) $(CXXFLAGS ) -I googletest/include googletest/$* .cpp googletest/lib/libgtest_main.a googletest/lib/libgtest.a -lpthread
11
- @time -f " $* :googletest %e " ./a.out
12
+ @$( TIME ) $* :googletest
12
13
@ls -l a.out | cut -d' ' -f6 | xargs echo " $* :googletest"
13
14
14
15
@time -f"$*:catch2 %e" $(CXX) $(CXXFLAGS) -I catch2/include catch2/$*.cpp
15
- @time -f" $*:catch2 %e" ./a.out
16
+ @$(TIME) $*:catch2
16
17
@ls -l a.out | cut -d' ' -f6 | xargs echo "$*:catch2"
17
18
18
19
@time -f"$*:doctest %e" $(CXX) $(CXXFLAGS) -I doctest/include doctest/$*.cpp
19
- @time -f" $*:doctest %e" ./a.out
20
+ @$(TIME) $*:doctest
20
21
@ls -l a.out | cut -d' ' -f6 | xargs echo "$*:doctest"
21
22
22
23
@time -f"$*:ut %e" $(CXX) $(CXXFLAGS) -I ut/include ut/$*.cpp
23
- @time -f" $*:ut %e" ./a.out
24
+ @$(TIME) $*:ut
24
25
@ls -l a.out | cut -d' ' -f6 | xargs echo "$*:ut"
25
26
26
27
suite.benchmark suite+assert.benchmark suite+assert+stl.benchmark :
@@ -30,25 +31,25 @@ suite.benchmark suite+assert.benchmark suite+assert+stl.benchmark:
30
31
@make clean
31
32
@for (( v= 0 ; v< $(N); ++ v)) ; do (echo ' <% n=$(N); v=' $$ v ' %>' && cat googletest/$* .erb) | erb > googletest_suite_$$ v.cpp; done
32
33
@time -f" $* :googletest %e" make suite.compile.googletest
33
- @time -f " $* :googletest %e " ./a.out
34
+ @$( TIME ) $* :googletest
34
35
@ls -l a.out | cut -d' ' -f6 | xargs echo " $* :googletest"
35
36
36
37
@make clean
37
38
@for ((v=0; v<$(N); ++v)); do (echo '<% n=$(N); v=' $$v '%>' && cat catch2/$*.erb) | erb > catch2_suite_$$v.cpp; done
38
39
@time -f"$*:catch2 %e" make suite.compile.catch2
39
- @time -f" $*:catch2 %e" ./a.out
40
+ @$(TIME) $*:catch2
40
41
@ls -l a.out | cut -d' ' -f6 | xargs echo "$*:catch2"
41
42
42
43
@make clean
43
44
@for ((v=0; v<$(N); ++v)); do (echo '<% n=$(N); v=' $$v '%>' && cat doctest/$*.erb) | erb > doctest_suite_$$v.cpp; done
44
45
@time -f"$*:doctest %e" make suite.compile.doctest
45
- @time -f" $*:doctest %e" ./a.out
46
+ @$(TIME) $*:doctest
46
47
@ls -l a.out | cut -d' ' -f6 | xargs echo "$*:doctest"
47
48
48
49
@make clean
49
50
@for ((v=0; v<$(N); ++v)); do (echo '<% n=$(N); v=' $$v '%>' && cat ut/$*.erb) | erb > ut_suite_$$v.cpp; done
50
51
@time -f"$*:ut %e" make suite.compile.ut
51
- @time -f" $*:ut %e" ./a.out
52
+ @$(TIME) $*:ut
52
53
@ls -l a.out | cut -d' ' -f6 | xargs echo "$*:ut"
53
54
54
55
suite.compile.googletest :
@@ -78,21 +79,21 @@ ut.header.%.benchmark:
78
79
@make clean
79
80
@for (( v= 0 ; v< $(N); ++ v)) ; do (echo ' <% n=$(N); v=' $$ v ' %>' && cat ut/$* .header.erb) | erb > ut_suite_$$ v.cpp; done
80
81
@time -f" $* :ut.header %e" make suite.compile.ut
81
- @time -f " $* :ut.header %e " ./a.out
82
+ @$( TIME ) $* :ut.header
82
83
@ls -l a.out | cut -d' ' -f6 | xargs echo " $* :ut.header"
83
84
84
85
ut.pch.% .benchmark :
85
86
@make clean
86
87
@for (( v= 0 ; v< $(N); ++ v)) ; do (echo ' <% n=$(N); v=' $$ v ' %>' && cat ut/$* .pch.erb) | erb > ut_suite_$$ v.cpp; done
87
88
@time -f" $* :ut.pch %e" make suite.compile.ut.pch
88
- @time -f " $* :ut.pch %e " ./a.out
89
+ @$( TIME ) $* :ut.pch
89
90
@ls -l a.out | cut -d' ' -f6 | xargs echo " $* :ut.pch"
90
91
91
92
ut.module.% .benchmark :
92
93
@make clean
93
94
@for (( v= 0 ; v< $(N); ++ v)) ; do (echo ' <% n=$(N); v=' $$ v ' %>' && cat ut/$* .module.erb) | erb > ut_suite_$$ v.cpp; done
94
95
@time -f" $* :ut.module %e" make suite.compile.ut.module
95
- @time -f " $* :ut.module %e " ./a.out
96
+ @$( TIME ) $* :ut.module
96
97
@ls -l a.out | cut -d' ' -f6 | xargs echo " $* :ut.module"
97
98
98
99
clean :
0 commit comments