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 package org.perfidix.benchmarktests;
28
29 import org.perfidix.annotation.AfterBenchClass;
30 import org.perfidix.annotation.AfterEachRun;
31 import org.perfidix.annotation.AfterLastRun;
32 import org.perfidix.annotation.BeforeBenchClass;
33 import org.perfidix.annotation.BeforeEachRun;
34 import org.perfidix.annotation.BeforeFirstRun;
35 import org.perfidix.annotation.Bench;
36
37
38
39
40
41
42 public final class NormalCompleteBench {
43
44
45 public final static int RUNS = 25;
46
47 private static int beforeClassC = 0;
48 private static int beforeFirstRunC = 0;
49 private static int beforeEachRunC = 0;
50 private static int benchC1 = 0;
51 private static int benchC2 = 0;
52 private static int afterEachC = 0;
53 private static int afterLastC = 0;
54 private static int afterClassC = 0;
55
56
57
58
59 @BeforeBenchClass
60 public void beforeClass() {
61 beforeClassC++;
62 }
63
64
65
66
67 @BeforeFirstRun
68 public void beforeFirstRun() {
69 beforeFirstRunC++;
70 }
71
72
73
74
75 @BeforeEachRun
76 public void beforeEachRun() {
77 beforeEachRunC++;
78 }
79
80
81
82
83 @Bench(runs = RUNS)
84 public void bench1() {
85 benchC1++;
86 }
87
88
89
90
91 @Bench
92 public void bench() {
93 benchC2++;
94 }
95
96
97
98
99 @AfterEachRun
100 public void afterEachRun() {
101 afterEachC++;
102 }
103
104
105
106
107 @AfterLastRun
108 public void afterLastRun() {
109 afterLastC++;
110 }
111
112
113
114
115 @AfterBenchClass
116 public void afterClass() {
117 afterClassC++;
118 }
119
120
121
122
123 public static void reset() {
124 beforeClassC = 0;
125 beforeEachRunC = 0;
126 beforeFirstRunC = 0;
127 benchC1 = 0;
128 benchC2 = 0;
129 afterClassC = 0;
130 afterEachC = 0;
131 afterLastC = 0;
132 }
133
134
135
136
137
138
139 public static int getBeforeClassCounter() {
140 return beforeClassC;
141 }
142
143
144
145
146
147
148 public static int getBeforeFirstRunCounter() {
149 return beforeFirstRunC;
150 }
151
152
153
154
155
156
157 public static int getBeforeEachRunCounter() {
158 return beforeEachRunC;
159 }
160
161
162
163
164
165
166 public static int getBenchCounter1() {
167 return benchC1;
168 }
169
170
171
172
173
174
175 public static int getBenchCounter2() {
176 return benchC2;
177 }
178
179
180
181
182
183
184 public static int getAfterEachRunCounter() {
185 return afterEachC;
186 }
187
188
189
190
191
192
193 public static int getAfterLastRunCounter() {
194 return afterLastC;
195 }
196
197
198
199
200
201
202 public static int getAfterClassCounter() {
203 return afterClassC;
204 }
205
206 }