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