View Javadoc
1   package org.apache.commons.rng.examples.jmh.simple.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 org.apache.commons.rng.examples.jmh.simple.jmh_generated.SeedArrayGenerationPerformance_jmhType;
36  import org.apache.commons.rng.examples.jmh.simple.jmh_generated.SeedArrayGenerationPerformance_SeedRandomSources_jmhType;
37  import org.apache.commons.rng.examples.jmh.simple.jmh_generated.SeedArrayGenerationPerformance_TestSizes_jmhType;
38  public final class SeedArrayGenerationPerformance_Threads1_createLongArraySeedBlocks_UnfairLock_jmhTest {
39  
40      byte p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015;
41      byte p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031;
42      byte p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047;
43      byte p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063;
44      byte p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079;
45      byte p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095;
46      byte p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111;
47      byte p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127;
48      byte p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143;
49      byte p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159;
50      byte p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175;
51      byte p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191;
52      byte p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207;
53      byte p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223;
54      byte p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239;
55      byte p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255;
56      int startRndMask;
57      BenchmarkParams benchmarkParams;
58      IterationParams iterationParams;
59      ThreadParams threadParams;
60      Blackhole blackhole;
61      Control notifyControl;
62  
63      public BenchmarkTaskResult Threads1_createLongArraySeedBlocks_UnfairLock_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable {
64          this.benchmarkParams = control.benchmarkParams;
65          this.iterationParams = control.iterationParams;
66          this.threadParams    = threadParams;
67          this.notifyControl   = control.notifyControl;
68          if (this.blackhole == null) {
69              this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
70          }
71          if (threadParams.getSubgroupIndex() == 0) {
72              RawResults res = new RawResults();
73              SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
74              SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G = _jmh_tryInit_f_testsizes2_G(control);
75              SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
76  
77              control.preSetup();
78  
79  
80              control.announceWarmupReady();
81              while (control.warmupShouldWait) {
82                  blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
83                  if (control.shouldYield) Thread.yield();
84                  res.allOps++;
85              }
86  
87              notifyControl.startMeasurement = true;
88              Threads1_createLongArraySeedBlocks_UnfairLock_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_seedrandomsources1_G, l_testsizes2_G, l_seedarraygenerationperformance0_G);
89              notifyControl.stopMeasurement = true;
90              control.announceWarmdownReady();
91              try {
92                  while (control.warmdownShouldWait) {
93                      blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
94                      if (control.shouldYield) Thread.yield();
95                      res.allOps++;
96                  }
97              } catch (Throwable e) {
98                  if (!(e instanceof InterruptedException)) throw e;
99              }
100             control.preTearDown();
101 
102             if (control.isLastIteration()) {
103                 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
104                     try {
105                         if (control.isFailing) throw new FailureAssistException();
106                         if (l_seedrandomsources1_G.readyTrial) {
107                             l_seedrandomsources1_G.readyTrial = false;
108                         }
109                     } catch (Throwable t) {
110                         control.isFailing = true;
111                         throw t;
112                     } finally {
113                         SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
114                     }
115                 } else {
116                     long l_seedrandomsources1_G_backoff = 1;
117                     while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
118                         TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
119                         l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
120                         if (control.isFailing) throw new FailureAssistException();
121                         if (Thread.interrupted()) throw new InterruptedException();
122                     }
123                 }
124                 if (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.compareAndSet(l_testsizes2_G, 0, 1)) {
125                     try {
126                         if (control.isFailing) throw new FailureAssistException();
127                         if (l_testsizes2_G.readyTrial) {
128                             l_testsizes2_G.readyTrial = false;
129                         }
130                     } catch (Throwable t) {
131                         control.isFailing = true;
132                         throw t;
133                     } finally {
134                         SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.set(l_testsizes2_G, 0);
135                     }
136                 } else {
137                     long l_testsizes2_G_backoff = 1;
138                     while (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.get(l_testsizes2_G) == 1) {
139                         TimeUnit.MILLISECONDS.sleep(l_testsizes2_G_backoff);
140                         l_testsizes2_G_backoff = Math.max(1024, l_testsizes2_G_backoff * 2);
141                         if (control.isFailing) throw new FailureAssistException();
142                         if (Thread.interrupted()) throw new InterruptedException();
143                     }
144                 }
145                 synchronized(this.getClass()) {
146                     f_seedrandomsources1_G = null;
147                 }
148                 synchronized(this.getClass()) {
149                     f_testsizes2_G = null;
150                 }
151                 synchronized(this.getClass()) {
152                     f_seedarraygenerationperformance0_G = null;
153                 }
154             }
155             res.allOps += res.measuredOps;
156             int batchSize = iterationParams.getBatchSize();
157             int opsPerInv = benchmarkParams.getOpsPerInvocation();
158             res.allOps *= opsPerInv;
159             res.allOps /= batchSize;
160             res.measuredOps *= opsPerInv;
161             res.measuredOps /= batchSize;
162             BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
163             results.add(new ThroughputResult(ResultRole.PRIMARY, "Threads1_createLongArraySeedBlocks_UnfairLock", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
164             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
165             return results;
166         } else
167             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
168     }
169 
170     public static void Threads1_createLongArraySeedBlocks_UnfairLock_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G, SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
171         long operations = 0;
172         long realTime = 0;
173         result.startTime = System.nanoTime();
174         do {
175             blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
176             operations++;
177         } while(!control.isDone);
178         result.stopTime = System.nanoTime();
179         result.realTime = realTime;
180         result.measuredOps = operations;
181     }
182 
183 
184     public BenchmarkTaskResult Threads1_createLongArraySeedBlocks_UnfairLock_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
185         this.benchmarkParams = control.benchmarkParams;
186         this.iterationParams = control.iterationParams;
187         this.threadParams    = threadParams;
188         this.notifyControl   = control.notifyControl;
189         if (this.blackhole == null) {
190             this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
191         }
192         if (threadParams.getSubgroupIndex() == 0) {
193             RawResults res = new RawResults();
194             SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
195             SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G = _jmh_tryInit_f_testsizes2_G(control);
196             SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
197 
198             control.preSetup();
199 
200 
201             control.announceWarmupReady();
202             while (control.warmupShouldWait) {
203                 blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
204                 if (control.shouldYield) Thread.yield();
205                 res.allOps++;
206             }
207 
208             notifyControl.startMeasurement = true;
209             Threads1_createLongArraySeedBlocks_UnfairLock_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_seedrandomsources1_G, l_testsizes2_G, l_seedarraygenerationperformance0_G);
210             notifyControl.stopMeasurement = true;
211             control.announceWarmdownReady();
212             try {
213                 while (control.warmdownShouldWait) {
214                     blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
215                     if (control.shouldYield) Thread.yield();
216                     res.allOps++;
217                 }
218             } catch (Throwable e) {
219                 if (!(e instanceof InterruptedException)) throw e;
220             }
221             control.preTearDown();
222 
223             if (control.isLastIteration()) {
224                 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
225                     try {
226                         if (control.isFailing) throw new FailureAssistException();
227                         if (l_seedrandomsources1_G.readyTrial) {
228                             l_seedrandomsources1_G.readyTrial = false;
229                         }
230                     } catch (Throwable t) {
231                         control.isFailing = true;
232                         throw t;
233                     } finally {
234                         SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
235                     }
236                 } else {
237                     long l_seedrandomsources1_G_backoff = 1;
238                     while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
239                         TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
240                         l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
241                         if (control.isFailing) throw new FailureAssistException();
242                         if (Thread.interrupted()) throw new InterruptedException();
243                     }
244                 }
245                 if (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.compareAndSet(l_testsizes2_G, 0, 1)) {
246                     try {
247                         if (control.isFailing) throw new FailureAssistException();
248                         if (l_testsizes2_G.readyTrial) {
249                             l_testsizes2_G.readyTrial = false;
250                         }
251                     } catch (Throwable t) {
252                         control.isFailing = true;
253                         throw t;
254                     } finally {
255                         SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.set(l_testsizes2_G, 0);
256                     }
257                 } else {
258                     long l_testsizes2_G_backoff = 1;
259                     while (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.get(l_testsizes2_G) == 1) {
260                         TimeUnit.MILLISECONDS.sleep(l_testsizes2_G_backoff);
261                         l_testsizes2_G_backoff = Math.max(1024, l_testsizes2_G_backoff * 2);
262                         if (control.isFailing) throw new FailureAssistException();
263                         if (Thread.interrupted()) throw new InterruptedException();
264                     }
265                 }
266                 synchronized(this.getClass()) {
267                     f_seedrandomsources1_G = null;
268                 }
269                 synchronized(this.getClass()) {
270                     f_testsizes2_G = null;
271                 }
272                 synchronized(this.getClass()) {
273                     f_seedarraygenerationperformance0_G = null;
274                 }
275             }
276             res.allOps += res.measuredOps;
277             int batchSize = iterationParams.getBatchSize();
278             int opsPerInv = benchmarkParams.getOpsPerInvocation();
279             res.allOps *= opsPerInv;
280             res.allOps /= batchSize;
281             res.measuredOps *= opsPerInv;
282             res.measuredOps /= batchSize;
283             BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
284             results.add(new AverageTimeResult(ResultRole.PRIMARY, "Threads1_createLongArraySeedBlocks_UnfairLock", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
285             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
286             return results;
287         } else
288             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
289     }
290 
291     public static void Threads1_createLongArraySeedBlocks_UnfairLock_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G, SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
292         long operations = 0;
293         long realTime = 0;
294         result.startTime = System.nanoTime();
295         do {
296             blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
297             operations++;
298         } while(!control.isDone);
299         result.stopTime = System.nanoTime();
300         result.realTime = realTime;
301         result.measuredOps = operations;
302     }
303 
304 
305     public BenchmarkTaskResult Threads1_createLongArraySeedBlocks_UnfairLock_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
306         this.benchmarkParams = control.benchmarkParams;
307         this.iterationParams = control.iterationParams;
308         this.threadParams    = threadParams;
309         this.notifyControl   = control.notifyControl;
310         if (this.blackhole == null) {
311             this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
312         }
313         if (threadParams.getSubgroupIndex() == 0) {
314             RawResults res = new RawResults();
315             SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
316             SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G = _jmh_tryInit_f_testsizes2_G(control);
317             SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
318 
319             control.preSetup();
320 
321 
322             control.announceWarmupReady();
323             while (control.warmupShouldWait) {
324                 blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
325                 if (control.shouldYield) Thread.yield();
326                 res.allOps++;
327             }
328 
329             notifyControl.startMeasurement = true;
330             int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond
331             int batchSize = iterationParams.getBatchSize();
332             int opsPerInv = benchmarkParams.getOpsPerInvocation();
333             SampleBuffer buffer = new SampleBuffer();
334             Threads1_createLongArraySeedBlocks_UnfairLock_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_seedrandomsources1_G, l_testsizes2_G, l_seedarraygenerationperformance0_G);
335             notifyControl.stopMeasurement = true;
336             control.announceWarmdownReady();
337             try {
338                 while (control.warmdownShouldWait) {
339                     blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
340                     if (control.shouldYield) Thread.yield();
341                     res.allOps++;
342                 }
343             } catch (Throwable e) {
344                 if (!(e instanceof InterruptedException)) throw e;
345             }
346             control.preTearDown();
347 
348             if (control.isLastIteration()) {
349                 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
350                     try {
351                         if (control.isFailing) throw new FailureAssistException();
352                         if (l_seedrandomsources1_G.readyTrial) {
353                             l_seedrandomsources1_G.readyTrial = false;
354                         }
355                     } catch (Throwable t) {
356                         control.isFailing = true;
357                         throw t;
358                     } finally {
359                         SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
360                     }
361                 } else {
362                     long l_seedrandomsources1_G_backoff = 1;
363                     while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
364                         TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
365                         l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
366                         if (control.isFailing) throw new FailureAssistException();
367                         if (Thread.interrupted()) throw new InterruptedException();
368                     }
369                 }
370                 if (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.compareAndSet(l_testsizes2_G, 0, 1)) {
371                     try {
372                         if (control.isFailing) throw new FailureAssistException();
373                         if (l_testsizes2_G.readyTrial) {
374                             l_testsizes2_G.readyTrial = false;
375                         }
376                     } catch (Throwable t) {
377                         control.isFailing = true;
378                         throw t;
379                     } finally {
380                         SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.set(l_testsizes2_G, 0);
381                     }
382                 } else {
383                     long l_testsizes2_G_backoff = 1;
384                     while (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.get(l_testsizes2_G) == 1) {
385                         TimeUnit.MILLISECONDS.sleep(l_testsizes2_G_backoff);
386                         l_testsizes2_G_backoff = Math.max(1024, l_testsizes2_G_backoff * 2);
387                         if (control.isFailing) throw new FailureAssistException();
388                         if (Thread.interrupted()) throw new InterruptedException();
389                     }
390                 }
391                 synchronized(this.getClass()) {
392                     f_seedrandomsources1_G = null;
393                 }
394                 synchronized(this.getClass()) {
395                     f_testsizes2_G = null;
396                 }
397                 synchronized(this.getClass()) {
398                     f_seedarraygenerationperformance0_G = null;
399                 }
400             }
401             res.allOps += res.measuredOps * batchSize;
402             res.allOps *= opsPerInv;
403             res.allOps /= batchSize;
404             res.measuredOps *= opsPerInv;
405             BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
406             results.add(new SampleTimeResult(ResultRole.PRIMARY, "Threads1_createLongArraySeedBlocks_UnfairLock", buffer, benchmarkParams.getTimeUnit()));
407             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
408             return results;
409         } else
410             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
411     }
412 
413     public static void Threads1_createLongArraySeedBlocks_UnfairLock_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, SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G, SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
414         long realTime = 0;
415         long operations = 0;
416         int rnd = (int)System.nanoTime();
417         int rndMask = startRndMask;
418         long time = 0;
419         int currentStride = 0;
420         do {
421             rnd = (rnd * 1664525 + 1013904223);
422             boolean sample = (rnd & rndMask) == 0;
423             if (sample) {
424                 time = System.nanoTime();
425             }
426             for (int b = 0; b < batchSize; b++) {
427                 if (control.volatileSpoiler) return;
428                 blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
429             }
430             if (sample) {
431                 buffer.add((System.nanoTime() - time) / opsPerInv);
432                 if (currentStride++ > targetSamples) {
433                     buffer.half();
434                     currentStride = 0;
435                     rndMask = (rndMask << 1) + 1;
436                 }
437             }
438             operations++;
439         } while(!control.isDone);
440         startRndMask = Math.max(startRndMask, rndMask);
441         result.realTime = realTime;
442         result.measuredOps = operations;
443     }
444 
445 
446     public BenchmarkTaskResult Threads1_createLongArraySeedBlocks_UnfairLock_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
447         this.benchmarkParams = control.benchmarkParams;
448         this.iterationParams = control.iterationParams;
449         this.threadParams    = threadParams;
450         this.notifyControl   = control.notifyControl;
451         if (this.blackhole == null) {
452             this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
453         }
454         if (threadParams.getSubgroupIndex() == 0) {
455             SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
456             SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G = _jmh_tryInit_f_testsizes2_G(control);
457             SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
458 
459             control.preSetup();
460 
461 
462             notifyControl.startMeasurement = true;
463             RawResults res = new RawResults();
464             int batchSize = iterationParams.getBatchSize();
465             Threads1_createLongArraySeedBlocks_UnfairLock_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_seedrandomsources1_G, l_testsizes2_G, l_seedarraygenerationperformance0_G);
466             control.preTearDown();
467 
468             if (control.isLastIteration()) {
469                 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
470                     try {
471                         if (control.isFailing) throw new FailureAssistException();
472                         if (l_seedrandomsources1_G.readyTrial) {
473                             l_seedrandomsources1_G.readyTrial = false;
474                         }
475                     } catch (Throwable t) {
476                         control.isFailing = true;
477                         throw t;
478                     } finally {
479                         SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
480                     }
481                 } else {
482                     long l_seedrandomsources1_G_backoff = 1;
483                     while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
484                         TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
485                         l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
486                         if (control.isFailing) throw new FailureAssistException();
487                         if (Thread.interrupted()) throw new InterruptedException();
488                     }
489                 }
490                 if (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.compareAndSet(l_testsizes2_G, 0, 1)) {
491                     try {
492                         if (control.isFailing) throw new FailureAssistException();
493                         if (l_testsizes2_G.readyTrial) {
494                             l_testsizes2_G.readyTrial = false;
495                         }
496                     } catch (Throwable t) {
497                         control.isFailing = true;
498                         throw t;
499                     } finally {
500                         SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.set(l_testsizes2_G, 0);
501                     }
502                 } else {
503                     long l_testsizes2_G_backoff = 1;
504                     while (SeedArrayGenerationPerformance_TestSizes_jmhType.tearTrialMutexUpdater.get(l_testsizes2_G) == 1) {
505                         TimeUnit.MILLISECONDS.sleep(l_testsizes2_G_backoff);
506                         l_testsizes2_G_backoff = Math.max(1024, l_testsizes2_G_backoff * 2);
507                         if (control.isFailing) throw new FailureAssistException();
508                         if (Thread.interrupted()) throw new InterruptedException();
509                     }
510                 }
511                 synchronized(this.getClass()) {
512                     f_seedrandomsources1_G = null;
513                 }
514                 synchronized(this.getClass()) {
515                     f_testsizes2_G = null;
516                 }
517                 synchronized(this.getClass()) {
518                     f_seedarraygenerationperformance0_G = null;
519                 }
520             }
521             int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
522             long totalOps = opsPerInv;
523             BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
524             results.add(new SingleShotResult(ResultRole.PRIMARY, "Threads1_createLongArraySeedBlocks_UnfairLock", res.getTime(), totalOps, benchmarkParams.getTimeUnit()));
525             this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
526             return results;
527         } else
528             throw new IllegalStateException("Harness failed to distribute threads among groups properly");
529     }
530 
531     public static void Threads1_createLongArraySeedBlocks_UnfairLock_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G, SeedArrayGenerationPerformance_TestSizes_jmhType l_testsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
532         long realTime = 0;
533         result.startTime = System.nanoTime();
534         for (int b = 0; b < batchSize; b++) {
535             if (control.volatileSpoiler) return;
536             blackhole.consume(l_seedarraygenerationperformance0_G.Threads1_createLongArraySeedBlocks_UnfairLock(l_seedrandomsources1_G, l_testsizes2_G));
537         }
538         result.stopTime = System.nanoTime();
539         result.realTime = realTime;
540     }
541 
542     
543     static volatile SeedArrayGenerationPerformance_jmhType f_seedarraygenerationperformance0_G;
544     
545     SeedArrayGenerationPerformance_jmhType _jmh_tryInit_f_seedarraygenerationperformance0_G(InfraControl control) throws Throwable {
546         SeedArrayGenerationPerformance_jmhType val = f_seedarraygenerationperformance0_G;
547         if (val != null) {
548             return val;
549         }
550         synchronized(this.getClass()) {
551             try {
552             if (control.isFailing) throw new FailureAssistException();
553             val = f_seedarraygenerationperformance0_G;
554             if (val != null) {
555                 return val;
556             }
557             val = new SeedArrayGenerationPerformance_jmhType();
558             val.readyTrial = true;
559             f_seedarraygenerationperformance0_G = val;
560             } catch (Throwable t) {
561                 control.isFailing = true;
562                 throw t;
563             }
564         }
565         return val;
566     }
567     
568     static volatile SeedArrayGenerationPerformance_SeedRandomSources_jmhType f_seedrandomsources1_G;
569     
570     SeedArrayGenerationPerformance_SeedRandomSources_jmhType _jmh_tryInit_f_seedrandomsources1_G(InfraControl control) throws Throwable {
571         SeedArrayGenerationPerformance_SeedRandomSources_jmhType val = f_seedrandomsources1_G;
572         if (val != null) {
573             return val;
574         }
575         synchronized(this.getClass()) {
576             try {
577             if (control.isFailing) throw new FailureAssistException();
578             val = f_seedrandomsources1_G;
579             if (val != null) {
580                 return val;
581             }
582             val = new SeedArrayGenerationPerformance_SeedRandomSources_jmhType();
583             Field f;
584             f = org.apache.commons.rng.examples.jmh.simple.SeedArrayGenerationPerformance.SeedRandomSources.class.getDeclaredField("randomSourceName");
585             f.setAccessible(true);
586             f.set(val, control.getParam("randomSourceName"));
587             val.setup();
588             val.readyTrial = true;
589             f_seedrandomsources1_G = val;
590             } catch (Throwable t) {
591                 control.isFailing = true;
592                 throw t;
593             }
594         }
595         return val;
596     }
597     
598     static volatile SeedArrayGenerationPerformance_TestSizes_jmhType f_testsizes2_G;
599     
600     SeedArrayGenerationPerformance_TestSizes_jmhType _jmh_tryInit_f_testsizes2_G(InfraControl control) throws Throwable {
601         SeedArrayGenerationPerformance_TestSizes_jmhType val = f_testsizes2_G;
602         if (val != null) {
603             return val;
604         }
605         synchronized(this.getClass()) {
606             try {
607             if (control.isFailing) throw new FailureAssistException();
608             val = f_testsizes2_G;
609             if (val != null) {
610                 return val;
611             }
612             val = new SeedArrayGenerationPerformance_TestSizes_jmhType();
613             Field f;
614             f = org.apache.commons.rng.examples.jmh.simple.SeedArrayGenerationPerformance.TestSizes.class.getDeclaredField("blockSize");
615             f.setAccessible(true);
616             f.set(val, Integer.valueOf(control.getParam("blockSize")));
617             f = org.apache.commons.rng.examples.jmh.simple.SeedArrayGenerationPerformance.TestSizes.class.getDeclaredField("size");
618             f.setAccessible(true);
619             f.set(val, Integer.valueOf(control.getParam("size")));
620             val.setup();
621             val.readyTrial = true;
622             f_testsizes2_G = val;
623             } catch (Throwable t) {
624                 control.isFailing = true;
625                 throw t;
626             }
627         }
628         return val;
629     }
630 
631 
632 }
633