View Javadoc
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.ScheduledFutureTaskDeadlineBenchmark_jmhType;
36  import io.netty.util.concurrent.jmh_generated.ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType;
37  public final class ScheduledFutureTaskDeadlineBenchmark_requestDeadline_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 requestDeadline_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              ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G = _jmh_tryInit_f_scheduledfuturetaskdeadlinebenchmark0_G(control);
73              ScheduledFutureTaskDeadlineBenchmark_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                  blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
81                  res.allOps++;
82              }
83  
84              notifyControl.startMeasurement = true;
85              requestDeadline_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_threadstate1_0, l_scheduledfuturetaskdeadlinebenchmark0_G);
86              notifyControl.stopMeasurement = true;
87              control.announceWarmdownReady();
88              try {
89                  while (control.warmdownShouldWait) {
90                      blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
91                      res.allOps++;
92                  }
93              } catch (Throwable e) {
94                  if (!(e instanceof InterruptedException)) throw e;
95              }
96              control.preTearDown();
97  
98              if (control.isLastIteration()) {
99                  l_threadstate1_0.shutdown();
100                 synchronized(this.getClass()) {
101                     f_scheduledfuturetaskdeadlinebenchmark0_G = null;
102                 }
103                 f_threadstate1_0 = null;
104             }
105             res.allOps += res.measuredOps;
106             int batchSize = iterationParams.getBatchSize();
107             int opsPerInv = benchmarkParams.getOpsPerInvocation();
108             res.allOps *= opsPerInv;
109             res.allOps /= batchSize;
110             res.measuredOps *= opsPerInv;
111             res.measuredOps /= batchSize;
112             BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
113             results.add(new ThroughputResult(ResultRole.PRIMARY, "requestDeadline", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
114             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
115             return results;
116         } else
117             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
118     }
119 
120     public static void requestDeadline_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G) throws Throwable {
121         long operations = 0;
122         long realTime = 0;
123         result.startTime = System.nanoTime();
124         do {
125             blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
126             operations++;
127         } while(!control.isDone);
128         result.stopTime = System.nanoTime();
129         result.realTime = realTime;
130         result.measuredOps = operations;
131     }
132 
133 
134     public BenchmarkTaskResult requestDeadline_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
135         this.benchmarkParams = control.benchmarkParams;
136         this.iterationParams = control.iterationParams;
137         this.threadParams    = threadParams;
138         this.notifyControl   = control.notifyControl;
139         if (this.blackhole == null) {
140             this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
141         }
142         if (threadParams.getSubgroupIndex() == 0) {
143             RawResults res = new RawResults();
144             ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G = _jmh_tryInit_f_scheduledfuturetaskdeadlinebenchmark0_G(control);
145             ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
146 
147             control.preSetup();
148 
149 
150             control.announceWarmupReady();
151             while (control.warmupShouldWait) {
152                 blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
153                 res.allOps++;
154             }
155 
156             notifyControl.startMeasurement = true;
157             requestDeadline_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_threadstate1_0, l_scheduledfuturetaskdeadlinebenchmark0_G);
158             notifyControl.stopMeasurement = true;
159             control.announceWarmdownReady();
160             try {
161                 while (control.warmdownShouldWait) {
162                     blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
163                     res.allOps++;
164                 }
165             } catch (Throwable e) {
166                 if (!(e instanceof InterruptedException)) throw e;
167             }
168             control.preTearDown();
169 
170             if (control.isLastIteration()) {
171                 l_threadstate1_0.shutdown();
172                 synchronized(this.getClass()) {
173                     f_scheduledfuturetaskdeadlinebenchmark0_G = null;
174                 }
175                 f_threadstate1_0 = null;
176             }
177             res.allOps += res.measuredOps;
178             int batchSize = iterationParams.getBatchSize();
179             int opsPerInv = benchmarkParams.getOpsPerInvocation();
180             res.allOps *= opsPerInv;
181             res.allOps /= batchSize;
182             res.measuredOps *= opsPerInv;
183             res.measuredOps /= batchSize;
184             BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
185             results.add(new AverageTimeResult(ResultRole.PRIMARY, "requestDeadline", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
186             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
187             return results;
188         } else
189             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
190     }
191 
192     public static void requestDeadline_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G) throws Throwable {
193         long operations = 0;
194         long realTime = 0;
195         result.startTime = System.nanoTime();
196         do {
197             blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
198             operations++;
199         } while(!control.isDone);
200         result.stopTime = System.nanoTime();
201         result.realTime = realTime;
202         result.measuredOps = operations;
203     }
204 
205 
206     public BenchmarkTaskResult requestDeadline_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
207         this.benchmarkParams = control.benchmarkParams;
208         this.iterationParams = control.iterationParams;
209         this.threadParams    = threadParams;
210         this.notifyControl   = control.notifyControl;
211         if (this.blackhole == null) {
212             this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
213         }
214         if (threadParams.getSubgroupIndex() == 0) {
215             RawResults res = new RawResults();
216             ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G = _jmh_tryInit_f_scheduledfuturetaskdeadlinebenchmark0_G(control);
217             ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
218 
219             control.preSetup();
220 
221 
222             control.announceWarmupReady();
223             while (control.warmupShouldWait) {
224                 blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
225                 res.allOps++;
226             }
227 
228             notifyControl.startMeasurement = true;
229             int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond
230             int batchSize = iterationParams.getBatchSize();
231             int opsPerInv = benchmarkParams.getOpsPerInvocation();
232             SampleBuffer buffer = new SampleBuffer();
233             requestDeadline_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_threadstate1_0, l_scheduledfuturetaskdeadlinebenchmark0_G);
234             notifyControl.stopMeasurement = true;
235             control.announceWarmdownReady();
236             try {
237                 while (control.warmdownShouldWait) {
238                     blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
239                     res.allOps++;
240                 }
241             } catch (Throwable e) {
242                 if (!(e instanceof InterruptedException)) throw e;
243             }
244             control.preTearDown();
245 
246             if (control.isLastIteration()) {
247                 l_threadstate1_0.shutdown();
248                 synchronized(this.getClass()) {
249                     f_scheduledfuturetaskdeadlinebenchmark0_G = null;
250                 }
251                 f_threadstate1_0 = null;
252             }
253             res.allOps += res.measuredOps * batchSize;
254             res.allOps *= opsPerInv;
255             res.allOps /= batchSize;
256             res.measuredOps *= opsPerInv;
257             BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
258             results.add(new SampleTimeResult(ResultRole.PRIMARY, "requestDeadline", buffer, benchmarkParams.getTimeUnit()));
259             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
260             return results;
261         } else
262             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
263     }
264 
265     public static void requestDeadline_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, ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G) throws Throwable {
266         long realTime = 0;
267         long operations = 0;
268         int rnd = (int)System.nanoTime();
269         int rndMask = startRndMask;
270         long time = 0;
271         int currentStride = 0;
272         do {
273             rnd = (rnd * 1664525 + 1013904223);
274             boolean sample = (rnd & rndMask) == 0;
275             if (sample) {
276                 time = System.nanoTime();
277             }
278             for (int b = 0; b < batchSize; b++) {
279                 if (control.volatileSpoiler) return;
280                 blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
281             }
282             if (sample) {
283                 buffer.add((System.nanoTime() - time) / opsPerInv);
284                 if (currentStride++ > targetSamples) {
285                     buffer.half();
286                     currentStride = 0;
287                     rndMask = (rndMask << 1) + 1;
288                 }
289             }
290             operations++;
291         } while(!control.isDone);
292         startRndMask = Math.max(startRndMask, rndMask);
293         result.realTime = realTime;
294         result.measuredOps = operations;
295     }
296 
297 
298     public BenchmarkTaskResult requestDeadline_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
299         this.benchmarkParams = control.benchmarkParams;
300         this.iterationParams = control.iterationParams;
301         this.threadParams    = threadParams;
302         this.notifyControl   = control.notifyControl;
303         if (this.blackhole == null) {
304             this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
305         }
306         if (threadParams.getSubgroupIndex() == 0) {
307             ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G = _jmh_tryInit_f_scheduledfuturetaskdeadlinebenchmark0_G(control);
308             ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0 = _jmh_tryInit_f_threadstate1_0(control);
309 
310             control.preSetup();
311 
312 
313             notifyControl.startMeasurement = true;
314             RawResults res = new RawResults();
315             int batchSize = iterationParams.getBatchSize();
316             requestDeadline_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_threadstate1_0, l_scheduledfuturetaskdeadlinebenchmark0_G);
317             control.preTearDown();
318 
319             if (control.isLastIteration()) {
320                 l_threadstate1_0.shutdown();
321                 synchronized(this.getClass()) {
322                     f_scheduledfuturetaskdeadlinebenchmark0_G = null;
323                 }
324                 f_threadstate1_0 = null;
325             }
326             int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
327             long totalOps = opsPerInv;
328             BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
329             results.add(new SingleShotResult(ResultRole.PRIMARY, "requestDeadline", res.getTime(), totalOps, benchmarkParams.getTimeUnit()));
330             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
331             return results;
332         } else
333             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
334     }
335 
336     public static void requestDeadline_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType l_threadstate1_0, ScheduledFutureTaskDeadlineBenchmark_jmhType l_scheduledfuturetaskdeadlinebenchmark0_G) throws Throwable {
337         long realTime = 0;
338         result.startTime = System.nanoTime();
339         for (int b = 0; b < batchSize; b++) {
340             if (control.volatileSpoiler) return;
341             blackhole.consume(l_scheduledfuturetaskdeadlinebenchmark0_G.requestDeadline(l_threadstate1_0));
342         }
343         result.stopTime = System.nanoTime();
344         result.realTime = realTime;
345     }
346 
347     
348     static volatile ScheduledFutureTaskDeadlineBenchmark_jmhType f_scheduledfuturetaskdeadlinebenchmark0_G;
349     
350     ScheduledFutureTaskDeadlineBenchmark_jmhType _jmh_tryInit_f_scheduledfuturetaskdeadlinebenchmark0_G(InfraControl control) throws Throwable {
351         ScheduledFutureTaskDeadlineBenchmark_jmhType val = f_scheduledfuturetaskdeadlinebenchmark0_G;
352         if (val != null) {
353             return val;
354         }
355         synchronized(this.getClass()) {
356             try {
357             if (control.isFailing) throw new FailureAssistException();
358             val = f_scheduledfuturetaskdeadlinebenchmark0_G;
359             if (val != null) {
360                 return val;
361             }
362             val = new ScheduledFutureTaskDeadlineBenchmark_jmhType();
363             val.readyTrial = true;
364             f_scheduledfuturetaskdeadlinebenchmark0_G = val;
365             } catch (Throwable t) {
366                 control.isFailing = true;
367                 throw t;
368             }
369         }
370         return val;
371     }
372     
373     ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType f_threadstate1_0;
374     
375     ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType _jmh_tryInit_f_threadstate1_0(InfraControl control) throws Throwable {
376         if (control.isFailing) throw new FailureAssistException();
377         ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType val = f_threadstate1_0;
378         if (val == null) {
379             val = new ScheduledFutureTaskDeadlineBenchmark_ThreadState_jmhType();
380             val.reset();
381             f_threadstate1_0 = val;
382         }
383         return val;
384     }
385 
386 
387 }
388