1 package io.netty.util.concurrent.jmh_generated;
2
3 import java.util.List;
4 import java.util.concurrent.atomic.AtomicInteger;
5 import java.util.Collection;
6 import java.util.ArrayList;
7 import java.util.concurrent.TimeUnit;
8 import org.openjdk.jmh.annotations.CompilerControl;
9 import org.openjdk.jmh.runner.InfraControl;
10 import org.openjdk.jmh.infra.ThreadParams;
11 import org.openjdk.jmh.results.BenchmarkTaskResult;
12 import org.openjdk.jmh.results.Result;
13 import org.openjdk.jmh.results.ThroughputResult;
14 import org.openjdk.jmh.results.AverageTimeResult;
15 import org.openjdk.jmh.results.SampleTimeResult;
16 import org.openjdk.jmh.results.SingleShotResult;
17 import org.openjdk.jmh.util.SampleBuffer;
18 import org.openjdk.jmh.annotations.Mode;
19 import org.openjdk.jmh.annotations.Fork;
20 import org.openjdk.jmh.annotations.Measurement;
21 import org.openjdk.jmh.annotations.Threads;
22 import org.openjdk.jmh.annotations.Warmup;
23 import org.openjdk.jmh.annotations.BenchmarkMode;
24 import org.openjdk.jmh.results.RawResults;
25 import org.openjdk.jmh.results.ResultRole;
26 import java.lang.reflect.Field;
27 import org.openjdk.jmh.infra.BenchmarkParams;
28 import org.openjdk.jmh.infra.IterationParams;
29 import org.openjdk.jmh.infra.Blackhole;
30 import org.openjdk.jmh.infra.Control;
31 import org.openjdk.jmh.results.ScalarResult;
32 import org.openjdk.jmh.results.AggregationPolicy;
33 import org.openjdk.jmh.runner.FailureAssistException;
34
35 import io.netty.util.concurrent.jmh_generated.ScheduleFutureTaskBenchmark_jmhType;
36 import io.netty.util.concurrent.jmh_generated.ScheduleFutureTaskBenchmark_ThreadState_jmhType;
37 public final class ScheduleFutureTaskBenchmark_scheduleLotsOutsideLoop_jmhTest {
38
39 byte p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015;
40 byte p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031;
41 byte p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047;
42 byte p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063;
43 byte p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079;
44 byte p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095;
45 byte p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111;
46 byte p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127;
47 byte p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143;
48 byte p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159;
49 byte p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175;
50 byte p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191;
51 byte p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207;
52 byte p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223;
53 byte p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239;
54 byte p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255;
55 int startRndMask;
56 BenchmarkParams benchmarkParams;
57 IterationParams iterationParams;
58 ThreadParams threadParams;
59 Blackhole blackhole;
60 Control notifyControl;
61
62 public BenchmarkTaskResult scheduleLotsOutsideLoop_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable {
63 this.benchmarkParams = control.benchmarkParams;
64 this.iterationParams = control.iterationParams;
65 this.threadParams = threadParams;
66 this.notifyControl = control.notifyControl;
67 if (this.blackhole == null) {
68 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
69 }
70 if (threadParams.getSubgroupIndex() == 0) {
71 RawResults res = new RawResults();
72 ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G = _jmh_tryInit_f_schedulefuturetaskbenchmark0_G(control);
73 ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
74
75 control.preSetup();
76
77
78 control.announceWarmupReady();
79 while (control.warmupShouldWait) {
80 l_threadstate1_0.clear();
81 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
82 res.allOps++;
83 }
84
85 notifyControl.startMeasurement = true;
86 scheduleLotsOutsideLoop_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_threadstate1_0, l_schedulefuturetaskbenchmark0_G);
87 notifyControl.stopMeasurement = true;
88 control.announceWarmdownReady();
89 try {
90 while (control.warmdownShouldWait) {
91 l_threadstate1_0.clear();
92 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
93 res.allOps++;
94 }
95 } catch (Throwable e) {
96 if (!(e instanceof InterruptedException)) throw e;
97 }
98 control.preTearDown();
99
100 if (control.isLastIteration()) {
101 l_threadstate1_0.shutdown();
102 synchronized(this.getClass()) {
103 f_schedulefuturetaskbenchmark0_G = null;
104 }
105 f_threadstate1_0 = null;
106 }
107 res.allOps += res.measuredOps;
108 int batchSize = iterationParams.getBatchSize();
109 int opsPerInv = benchmarkParams.getOpsPerInvocation();
110 res.allOps *= opsPerInv;
111 res.allOps /= batchSize;
112 res.measuredOps *= opsPerInv;
113 res.measuredOps /= batchSize;
114 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
115 results.add(new ThroughputResult(ResultRole.PRIMARY, "scheduleLotsOutsideLoop", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
116 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
117 return results;
118 } else
119 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
120 }
121
122 public static void scheduleLotsOutsideLoop_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G) throws Throwable {
123 long operations = 0;
124 long realTime = 0;
125 result.startTime = System.nanoTime();
126 do {
127 l_threadstate1_0.clear();
128 long rt = System.nanoTime();
129 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
130 realTime += (System.nanoTime() - rt);
131 operations++;
132 } while(!control.isDone);
133 result.stopTime = System.nanoTime();
134 result.realTime = realTime;
135 result.measuredOps = operations;
136 }
137
138
139 public BenchmarkTaskResult scheduleLotsOutsideLoop_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
140 this.benchmarkParams = control.benchmarkParams;
141 this.iterationParams = control.iterationParams;
142 this.threadParams = threadParams;
143 this.notifyControl = control.notifyControl;
144 if (this.blackhole == null) {
145 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
146 }
147 if (threadParams.getSubgroupIndex() == 0) {
148 RawResults res = new RawResults();
149 ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G = _jmh_tryInit_f_schedulefuturetaskbenchmark0_G(control);
150 ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
151
152 control.preSetup();
153
154
155 control.announceWarmupReady();
156 while (control.warmupShouldWait) {
157 l_threadstate1_0.clear();
158 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
159 res.allOps++;
160 }
161
162 notifyControl.startMeasurement = true;
163 scheduleLotsOutsideLoop_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_threadstate1_0, l_schedulefuturetaskbenchmark0_G);
164 notifyControl.stopMeasurement = true;
165 control.announceWarmdownReady();
166 try {
167 while (control.warmdownShouldWait) {
168 l_threadstate1_0.clear();
169 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
170 res.allOps++;
171 }
172 } catch (Throwable e) {
173 if (!(e instanceof InterruptedException)) throw e;
174 }
175 control.preTearDown();
176
177 if (control.isLastIteration()) {
178 l_threadstate1_0.shutdown();
179 synchronized(this.getClass()) {
180 f_schedulefuturetaskbenchmark0_G = null;
181 }
182 f_threadstate1_0 = null;
183 }
184 res.allOps += res.measuredOps;
185 int batchSize = iterationParams.getBatchSize();
186 int opsPerInv = benchmarkParams.getOpsPerInvocation();
187 res.allOps *= opsPerInv;
188 res.allOps /= batchSize;
189 res.measuredOps *= opsPerInv;
190 res.measuredOps /= batchSize;
191 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
192 results.add(new AverageTimeResult(ResultRole.PRIMARY, "scheduleLotsOutsideLoop", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
193 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
194 return results;
195 } else
196 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
197 }
198
199 public static void scheduleLotsOutsideLoop_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G) throws Throwable {
200 long operations = 0;
201 long realTime = 0;
202 result.startTime = System.nanoTime();
203 do {
204 l_threadstate1_0.clear();
205 long rt = System.nanoTime();
206 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
207 realTime += (System.nanoTime() - rt);
208 operations++;
209 } while(!control.isDone);
210 result.stopTime = System.nanoTime();
211 result.realTime = realTime;
212 result.measuredOps = operations;
213 }
214
215
216 public BenchmarkTaskResult scheduleLotsOutsideLoop_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
217 this.benchmarkParams = control.benchmarkParams;
218 this.iterationParams = control.iterationParams;
219 this.threadParams = threadParams;
220 this.notifyControl = control.notifyControl;
221 if (this.blackhole == null) {
222 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
223 }
224 if (threadParams.getSubgroupIndex() == 0) {
225 RawResults res = new RawResults();
226 ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G = _jmh_tryInit_f_schedulefuturetaskbenchmark0_G(control);
227 ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
228
229 control.preSetup();
230
231
232 control.announceWarmupReady();
233 while (control.warmupShouldWait) {
234 l_threadstate1_0.clear();
235 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
236 res.allOps++;
237 }
238
239 notifyControl.startMeasurement = true;
240 int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20);
241 int batchSize = iterationParams.getBatchSize();
242 int opsPerInv = benchmarkParams.getOpsPerInvocation();
243 SampleBuffer buffer = new SampleBuffer();
244 scheduleLotsOutsideLoop_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_threadstate1_0, l_schedulefuturetaskbenchmark0_G);
245 notifyControl.stopMeasurement = true;
246 control.announceWarmdownReady();
247 try {
248 while (control.warmdownShouldWait) {
249 l_threadstate1_0.clear();
250 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
251 res.allOps++;
252 }
253 } catch (Throwable e) {
254 if (!(e instanceof InterruptedException)) throw e;
255 }
256 control.preTearDown();
257
258 if (control.isLastIteration()) {
259 l_threadstate1_0.shutdown();
260 synchronized(this.getClass()) {
261 f_schedulefuturetaskbenchmark0_G = null;
262 }
263 f_threadstate1_0 = null;
264 }
265 res.allOps += res.measuredOps * batchSize;
266 res.allOps *= opsPerInv;
267 res.allOps /= batchSize;
268 res.measuredOps *= opsPerInv;
269 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
270 results.add(new SampleTimeResult(ResultRole.PRIMARY, "scheduleLotsOutsideLoop", buffer, benchmarkParams.getTimeUnit()));
271 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
272 return results;
273 } else
274 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
275 }
276
277 public static void scheduleLotsOutsideLoop_sample_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SampleBuffer buffer, int targetSamples, long opsPerInv, int batchSize, ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G) throws Throwable {
278 long realTime = 0;
279 long operations = 0;
280 int rnd = (int)System.nanoTime();
281 int rndMask = startRndMask;
282 long time = 0;
283 int currentStride = 0;
284 do {
285 l_threadstate1_0.clear();
286 long rt = System.nanoTime();
287 rnd = (rnd * 1664525 + 1013904223);
288 boolean sample = (rnd & rndMask) == 0;
289 if (sample) {
290 time = System.nanoTime();
291 }
292 for (int b = 0; b < batchSize; b++) {
293 if (control.volatileSpoiler) return;
294 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
295 }
296 if (sample) {
297 buffer.add((System.nanoTime() - time) / opsPerInv);
298 if (currentStride++ > targetSamples) {
299 buffer.half();
300 currentStride = 0;
301 rndMask = (rndMask << 1) + 1;
302 }
303 }
304 realTime += (System.nanoTime() - rt);
305 operations++;
306 } while(!control.isDone);
307 startRndMask = Math.max(startRndMask, rndMask);
308 result.realTime = realTime;
309 result.measuredOps = operations;
310 }
311
312
313 public BenchmarkTaskResult scheduleLotsOutsideLoop_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
314 this.benchmarkParams = control.benchmarkParams;
315 this.iterationParams = control.iterationParams;
316 this.threadParams = threadParams;
317 this.notifyControl = control.notifyControl;
318 if (this.blackhole == null) {
319 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
320 }
321 if (threadParams.getSubgroupIndex() == 0) {
322 ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G = _jmh_tryInit_f_schedulefuturetaskbenchmark0_G(control);
323 ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
324
325 control.preSetup();
326
327
328 notifyControl.startMeasurement = true;
329 RawResults res = new RawResults();
330 int batchSize = iterationParams.getBatchSize();
331 scheduleLotsOutsideLoop_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_threadstate1_0, l_schedulefuturetaskbenchmark0_G);
332 control.preTearDown();
333
334 if (control.isLastIteration()) {
335 l_threadstate1_0.shutdown();
336 synchronized(this.getClass()) {
337 f_schedulefuturetaskbenchmark0_G = null;
338 }
339 f_threadstate1_0 = null;
340 }
341 int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
342 long totalOps = opsPerInv;
343 BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
344 results.add(new SingleShotResult(ResultRole.PRIMARY, "scheduleLotsOutsideLoop", res.getTime(), totalOps, benchmarkParams.getTimeUnit()));
345 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
346 return results;
347 } else
348 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
349 }
350
351 public static void scheduleLotsOutsideLoop_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, ScheduleFutureTaskBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduleFutureTaskBenchmark_jmhType l_schedulefuturetaskbenchmark0_G) throws Throwable {
352 long realTime = 0;
353 result.startTime = System.nanoTime();
354 for (int b = 0; b < batchSize; b++) {
355 if (control.volatileSpoiler) return;
356 l_threadstate1_0.clear();
357 long rt = System.nanoTime();
358 blackhole.consume(l_schedulefuturetaskbenchmark0_G.scheduleLotsOutsideLoop(l_threadstate1_0));
359 realTime += (System.nanoTime() - rt);
360 }
361 result.stopTime = System.nanoTime();
362 result.realTime = realTime;
363 }
364
365
366 static volatile ScheduleFutureTaskBenchmark_jmhType f_schedulefuturetaskbenchmark0_G;
367
368 ScheduleFutureTaskBenchmark_jmhType _jmh_tryInit_f_schedulefuturetaskbenchmark0_G(InfraControl control) throws Throwable {
369 ScheduleFutureTaskBenchmark_jmhType val = f_schedulefuturetaskbenchmark0_G;
370 if (val != null) {
371 return val;
372 }
373 synchronized(this.getClass()) {
374 try {
375 if (control.isFailing) throw new FailureAssistException();
376 val = f_schedulefuturetaskbenchmark0_G;
377 if (val != null) {
378 return val;
379 }
380 val = new ScheduleFutureTaskBenchmark_jmhType();
381 val.readyTrial = true;
382 f_schedulefuturetaskbenchmark0_G = val;
383 } catch (Throwable t) {
384 control.isFailing = true;
385 throw t;
386 }
387 }
388 return val;
389 }
390
391 ScheduleFutureTaskBenchmark_ThreadState_jmhType f_threadstate1_0;
392
393 ScheduleFutureTaskBenchmark_ThreadState_jmhType _jmh_tryInit_f_threadstate1_0(InfraControl control) throws Throwable {
394 if (control.isFailing) throw new FailureAssistException();
395 ScheduleFutureTaskBenchmark_ThreadState_jmhType val = f_threadstate1_0;
396 if (val == null) {
397 val = new ScheduleFutureTaskBenchmark_ThreadState_jmhType();
398 Field f;
399 f = io.netty.util.concurrent.ScheduleFutureTaskBenchmark.ThreadState.class.getDeclaredField("num");
400 f.setAccessible(true);
401 f.set(val, Integer.valueOf(control.getParam("num")));
402 val.reset();
403 f_threadstate1_0 = val;
404 }
405 return val;
406 }
407
408
409 }
410