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_SeedSizes_jmhType;
38 public final class SeedArrayGenerationPerformance_Threads4_createIntArraySeed_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 Threads4_createIntArraySeed_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_SeedSizes_jmhType l_seedsizes2_G = _jmh_tryInit_f_seedsizes2_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.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
83 if (control.shouldYield) Thread.yield();
84 res.allOps++;
85 }
86
87 notifyControl.startMeasurement = true;
88 Threads4_createIntArraySeed_UnfairLock_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_seedrandomsources1_G, l_seedsizes2_G, l_seedarraygenerationperformance0_G);
89 notifyControl.stopMeasurement = true;
90 control.announceWarmdownReady();
91 try {
92 while (control.warmdownShouldWait) {
93 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_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 synchronized(this.getClass()) {
125 f_seedrandomsources1_G = null;
126 }
127 synchronized(this.getClass()) {
128 f_seedsizes2_G = null;
129 }
130 synchronized(this.getClass()) {
131 f_seedarraygenerationperformance0_G = null;
132 }
133 }
134 res.allOps += res.measuredOps;
135 int batchSize = iterationParams.getBatchSize();
136 int opsPerInv = benchmarkParams.getOpsPerInvocation();
137 res.allOps *= opsPerInv;
138 res.allOps /= batchSize;
139 res.measuredOps *= opsPerInv;
140 res.measuredOps /= batchSize;
141 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
142 results.add(new ThroughputResult(ResultRole.PRIMARY, "Threads4_createIntArraySeed_UnfairLock", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
143 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
144 return results;
145 } else
146 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
147 }
148
149 public static void Threads4_createIntArraySeed_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_SeedSizes_jmhType l_seedsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
150 long operations = 0;
151 long realTime = 0;
152 result.startTime = System.nanoTime();
153 do {
154 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
155 operations++;
156 } while(!control.isDone);
157 result.stopTime = System.nanoTime();
158 result.realTime = realTime;
159 result.measuredOps = operations;
160 }
161
162
163 public BenchmarkTaskResult Threads4_createIntArraySeed_UnfairLock_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
164 this.benchmarkParams = control.benchmarkParams;
165 this.iterationParams = control.iterationParams;
166 this.threadParams = threadParams;
167 this.notifyControl = control.notifyControl;
168 if (this.blackhole == null) {
169 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
170 }
171 if (threadParams.getSubgroupIndex() == 0) {
172 RawResults res = new RawResults();
173 SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
174 SeedArrayGenerationPerformance_SeedSizes_jmhType l_seedsizes2_G = _jmh_tryInit_f_seedsizes2_G(control);
175 SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
176
177 control.preSetup();
178
179
180 control.announceWarmupReady();
181 while (control.warmupShouldWait) {
182 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
183 if (control.shouldYield) Thread.yield();
184 res.allOps++;
185 }
186
187 notifyControl.startMeasurement = true;
188 Threads4_createIntArraySeed_UnfairLock_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_seedrandomsources1_G, l_seedsizes2_G, l_seedarraygenerationperformance0_G);
189 notifyControl.stopMeasurement = true;
190 control.announceWarmdownReady();
191 try {
192 while (control.warmdownShouldWait) {
193 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
194 if (control.shouldYield) Thread.yield();
195 res.allOps++;
196 }
197 } catch (Throwable e) {
198 if (!(e instanceof InterruptedException)) throw e;
199 }
200 control.preTearDown();
201
202 if (control.isLastIteration()) {
203 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
204 try {
205 if (control.isFailing) throw new FailureAssistException();
206 if (l_seedrandomsources1_G.readyTrial) {
207 l_seedrandomsources1_G.readyTrial = false;
208 }
209 } catch (Throwable t) {
210 control.isFailing = true;
211 throw t;
212 } finally {
213 SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
214 }
215 } else {
216 long l_seedrandomsources1_G_backoff = 1;
217 while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
218 TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
219 l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
220 if (control.isFailing) throw new FailureAssistException();
221 if (Thread.interrupted()) throw new InterruptedException();
222 }
223 }
224 synchronized(this.getClass()) {
225 f_seedrandomsources1_G = null;
226 }
227 synchronized(this.getClass()) {
228 f_seedsizes2_G = null;
229 }
230 synchronized(this.getClass()) {
231 f_seedarraygenerationperformance0_G = null;
232 }
233 }
234 res.allOps += res.measuredOps;
235 int batchSize = iterationParams.getBatchSize();
236 int opsPerInv = benchmarkParams.getOpsPerInvocation();
237 res.allOps *= opsPerInv;
238 res.allOps /= batchSize;
239 res.measuredOps *= opsPerInv;
240 res.measuredOps /= batchSize;
241 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
242 results.add(new AverageTimeResult(ResultRole.PRIMARY, "Threads4_createIntArraySeed_UnfairLock", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
243 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
244 return results;
245 } else
246 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
247 }
248
249 public static void Threads4_createIntArraySeed_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_SeedSizes_jmhType l_seedsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
250 long operations = 0;
251 long realTime = 0;
252 result.startTime = System.nanoTime();
253 do {
254 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
255 operations++;
256 } while(!control.isDone);
257 result.stopTime = System.nanoTime();
258 result.realTime = realTime;
259 result.measuredOps = operations;
260 }
261
262
263 public BenchmarkTaskResult Threads4_createIntArraySeed_UnfairLock_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
264 this.benchmarkParams = control.benchmarkParams;
265 this.iterationParams = control.iterationParams;
266 this.threadParams = threadParams;
267 this.notifyControl = control.notifyControl;
268 if (this.blackhole == null) {
269 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
270 }
271 if (threadParams.getSubgroupIndex() == 0) {
272 RawResults res = new RawResults();
273 SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
274 SeedArrayGenerationPerformance_SeedSizes_jmhType l_seedsizes2_G = _jmh_tryInit_f_seedsizes2_G(control);
275 SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
276
277 control.preSetup();
278
279
280 control.announceWarmupReady();
281 while (control.warmupShouldWait) {
282 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
283 if (control.shouldYield) Thread.yield();
284 res.allOps++;
285 }
286
287 notifyControl.startMeasurement = true;
288 int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20);
289 int batchSize = iterationParams.getBatchSize();
290 int opsPerInv = benchmarkParams.getOpsPerInvocation();
291 SampleBuffer buffer = new SampleBuffer();
292 Threads4_createIntArraySeed_UnfairLock_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_seedrandomsources1_G, l_seedsizes2_G, l_seedarraygenerationperformance0_G);
293 notifyControl.stopMeasurement = true;
294 control.announceWarmdownReady();
295 try {
296 while (control.warmdownShouldWait) {
297 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
298 if (control.shouldYield) Thread.yield();
299 res.allOps++;
300 }
301 } catch (Throwable e) {
302 if (!(e instanceof InterruptedException)) throw e;
303 }
304 control.preTearDown();
305
306 if (control.isLastIteration()) {
307 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
308 try {
309 if (control.isFailing) throw new FailureAssistException();
310 if (l_seedrandomsources1_G.readyTrial) {
311 l_seedrandomsources1_G.readyTrial = false;
312 }
313 } catch (Throwable t) {
314 control.isFailing = true;
315 throw t;
316 } finally {
317 SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
318 }
319 } else {
320 long l_seedrandomsources1_G_backoff = 1;
321 while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
322 TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
323 l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
324 if (control.isFailing) throw new FailureAssistException();
325 if (Thread.interrupted()) throw new InterruptedException();
326 }
327 }
328 synchronized(this.getClass()) {
329 f_seedrandomsources1_G = null;
330 }
331 synchronized(this.getClass()) {
332 f_seedsizes2_G = null;
333 }
334 synchronized(this.getClass()) {
335 f_seedarraygenerationperformance0_G = null;
336 }
337 }
338 res.allOps += res.measuredOps * batchSize;
339 res.allOps *= opsPerInv;
340 res.allOps /= batchSize;
341 res.measuredOps *= opsPerInv;
342 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
343 results.add(new SampleTimeResult(ResultRole.PRIMARY, "Threads4_createIntArraySeed_UnfairLock", buffer, benchmarkParams.getTimeUnit()));
344 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
345 return results;
346 } else
347 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
348 }
349
350 public static void Threads4_createIntArraySeed_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_SeedSizes_jmhType l_seedsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
351 long realTime = 0;
352 long operations = 0;
353 int rnd = (int)System.nanoTime();
354 int rndMask = startRndMask;
355 long time = 0;
356 int currentStride = 0;
357 do {
358 rnd = (rnd * 1664525 + 1013904223);
359 boolean sample = (rnd & rndMask) == 0;
360 if (sample) {
361 time = System.nanoTime();
362 }
363 for (int b = 0; b < batchSize; b++) {
364 if (control.volatileSpoiler) return;
365 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
366 }
367 if (sample) {
368 buffer.add((System.nanoTime() - time) / opsPerInv);
369 if (currentStride++ > targetSamples) {
370 buffer.half();
371 currentStride = 0;
372 rndMask = (rndMask << 1) + 1;
373 }
374 }
375 operations++;
376 } while(!control.isDone);
377 startRndMask = Math.max(startRndMask, rndMask);
378 result.realTime = realTime;
379 result.measuredOps = operations;
380 }
381
382
383 public BenchmarkTaskResult Threads4_createIntArraySeed_UnfairLock_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
384 this.benchmarkParams = control.benchmarkParams;
385 this.iterationParams = control.iterationParams;
386 this.threadParams = threadParams;
387 this.notifyControl = control.notifyControl;
388 if (this.blackhole == null) {
389 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
390 }
391 if (threadParams.getSubgroupIndex() == 0) {
392 SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G = _jmh_tryInit_f_seedarraygenerationperformance0_G(control);
393 SeedArrayGenerationPerformance_SeedSizes_jmhType l_seedsizes2_G = _jmh_tryInit_f_seedsizes2_G(control);
394 SeedArrayGenerationPerformance_SeedRandomSources_jmhType l_seedrandomsources1_G = _jmh_tryInit_f_seedrandomsources1_G(control);
395
396 control.preSetup();
397
398
399 notifyControl.startMeasurement = true;
400 RawResults res = new RawResults();
401 int batchSize = iterationParams.getBatchSize();
402 Threads4_createIntArraySeed_UnfairLock_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_seedrandomsources1_G, l_seedsizes2_G, l_seedarraygenerationperformance0_G);
403 control.preTearDown();
404
405 if (control.isLastIteration()) {
406 if (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.compareAndSet(l_seedrandomsources1_G, 0, 1)) {
407 try {
408 if (control.isFailing) throw new FailureAssistException();
409 if (l_seedrandomsources1_G.readyTrial) {
410 l_seedrandomsources1_G.readyTrial = false;
411 }
412 } catch (Throwable t) {
413 control.isFailing = true;
414 throw t;
415 } finally {
416 SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.set(l_seedrandomsources1_G, 0);
417 }
418 } else {
419 long l_seedrandomsources1_G_backoff = 1;
420 while (SeedArrayGenerationPerformance_SeedRandomSources_jmhType.tearTrialMutexUpdater.get(l_seedrandomsources1_G) == 1) {
421 TimeUnit.MILLISECONDS.sleep(l_seedrandomsources1_G_backoff);
422 l_seedrandomsources1_G_backoff = Math.max(1024, l_seedrandomsources1_G_backoff * 2);
423 if (control.isFailing) throw new FailureAssistException();
424 if (Thread.interrupted()) throw new InterruptedException();
425 }
426 }
427 synchronized(this.getClass()) {
428 f_seedrandomsources1_G = null;
429 }
430 synchronized(this.getClass()) {
431 f_seedsizes2_G = null;
432 }
433 synchronized(this.getClass()) {
434 f_seedarraygenerationperformance0_G = null;
435 }
436 }
437 int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
438 long totalOps = opsPerInv;
439 BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
440 results.add(new SingleShotResult(ResultRole.PRIMARY, "Threads4_createIntArraySeed_UnfairLock", res.getTime(), totalOps, benchmarkParams.getTimeUnit()));
441 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
442 return results;
443 } else
444 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
445 }
446
447 public static void Threads4_createIntArraySeed_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_SeedSizes_jmhType l_seedsizes2_G, SeedArrayGenerationPerformance_jmhType l_seedarraygenerationperformance0_G) throws Throwable {
448 long realTime = 0;
449 result.startTime = System.nanoTime();
450 for (int b = 0; b < batchSize; b++) {
451 if (control.volatileSpoiler) return;
452 blackhole.consume(l_seedarraygenerationperformance0_G.Threads4_createIntArraySeed_UnfairLock(l_seedrandomsources1_G, l_seedsizes2_G));
453 }
454 result.stopTime = System.nanoTime();
455 result.realTime = realTime;
456 }
457
458
459 static volatile SeedArrayGenerationPerformance_jmhType f_seedarraygenerationperformance0_G;
460
461 SeedArrayGenerationPerformance_jmhType _jmh_tryInit_f_seedarraygenerationperformance0_G(InfraControl control) throws Throwable {
462 SeedArrayGenerationPerformance_jmhType val = f_seedarraygenerationperformance0_G;
463 if (val != null) {
464 return val;
465 }
466 synchronized(this.getClass()) {
467 try {
468 if (control.isFailing) throw new FailureAssistException();
469 val = f_seedarraygenerationperformance0_G;
470 if (val != null) {
471 return val;
472 }
473 val = new SeedArrayGenerationPerformance_jmhType();
474 val.readyTrial = true;
475 f_seedarraygenerationperformance0_G = val;
476 } catch (Throwable t) {
477 control.isFailing = true;
478 throw t;
479 }
480 }
481 return val;
482 }
483
484 static volatile SeedArrayGenerationPerformance_SeedRandomSources_jmhType f_seedrandomsources1_G;
485
486 SeedArrayGenerationPerformance_SeedRandomSources_jmhType _jmh_tryInit_f_seedrandomsources1_G(InfraControl control) throws Throwable {
487 SeedArrayGenerationPerformance_SeedRandomSources_jmhType val = f_seedrandomsources1_G;
488 if (val != null) {
489 return val;
490 }
491 synchronized(this.getClass()) {
492 try {
493 if (control.isFailing) throw new FailureAssistException();
494 val = f_seedrandomsources1_G;
495 if (val != null) {
496 return val;
497 }
498 val = new SeedArrayGenerationPerformance_SeedRandomSources_jmhType();
499 Field f;
500 f = org.apache.commons.rng.examples.jmh.simple.SeedArrayGenerationPerformance.SeedRandomSources.class.getDeclaredField("randomSourceName");
501 f.setAccessible(true);
502 f.set(val, control.getParam("randomSourceName"));
503 val.setup();
504 val.readyTrial = true;
505 f_seedrandomsources1_G = val;
506 } catch (Throwable t) {
507 control.isFailing = true;
508 throw t;
509 }
510 }
511 return val;
512 }
513
514 static volatile SeedArrayGenerationPerformance_SeedSizes_jmhType f_seedsizes2_G;
515
516 SeedArrayGenerationPerformance_SeedSizes_jmhType _jmh_tryInit_f_seedsizes2_G(InfraControl control) throws Throwable {
517 SeedArrayGenerationPerformance_SeedSizes_jmhType val = f_seedsizes2_G;
518 if (val != null) {
519 return val;
520 }
521 synchronized(this.getClass()) {
522 try {
523 if (control.isFailing) throw new FailureAssistException();
524 val = f_seedsizes2_G;
525 if (val != null) {
526 return val;
527 }
528 val = new SeedArrayGenerationPerformance_SeedSizes_jmhType();
529 Field f;
530 f = org.apache.commons.rng.examples.jmh.simple.SeedArrayGenerationPerformance.SeedSizes.class.getDeclaredField("size");
531 f.setAccessible(true);
532 f.set(val, Integer.valueOf(control.getParam("size")));
533 val.readyTrial = true;
534 f_seedsizes2_G = val;
535 } catch (Throwable t) {
536 control.isFailing = true;
537 throw t;
538 }
539 }
540 return val;
541 }
542
543
544 }
545