1 package org.apache.commons.numbers.examples.jmh.core.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.numbers.examples.jmh.core.jmh_generated.LinearCombinationPerformance_Calculator_jmhType;
36 import org.apache.commons.numbers.examples.jmh.core.jmh_generated.LinearCombinationPerformance_Factors_jmhType;
37 import org.apache.commons.numbers.examples.jmh.core.jmh_generated.LinearCombinationPerformance_jmhType;
38 public final class LinearCombinationPerformance_fourD_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 fourD_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 LinearCombinationPerformance_jmhType l_linearcombinationperformance0_G = _jmh_tryInit_f_linearcombinationperformance0_G(control);
74 LinearCombinationPerformance_Calculator_jmhType l_calculator2_G = _jmh_tryInit_f_calculator2_G(control);
75 LinearCombinationPerformance_Factors_jmhType l_factors1_G = _jmh_tryInit_f_factors1_G(control);
76
77 control.preSetup();
78
79
80 control.announceWarmupReady();
81 while (control.warmupShouldWait) {
82 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_G);
83 if (control.shouldYield) Thread.yield();
84 res.allOps++;
85 }
86
87 notifyControl.startMeasurement = true;
88 fourD_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_factors1_G, l_calculator2_G, l_linearcombinationperformance0_G);
89 notifyControl.stopMeasurement = true;
90 control.announceWarmdownReady();
91 try {
92 while (control.warmdownShouldWait) {
93 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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 (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.compareAndSet(l_factors1_G, 0, 1)) {
104 try {
105 if (control.isFailing) throw new FailureAssistException();
106 if (l_factors1_G.readyTrial) {
107 l_factors1_G.readyTrial = false;
108 }
109 } catch (Throwable t) {
110 control.isFailing = true;
111 throw t;
112 } finally {
113 LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.set(l_factors1_G, 0);
114 }
115 } else {
116 long l_factors1_G_backoff = 1;
117 while (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.get(l_factors1_G) == 1) {
118 TimeUnit.MILLISECONDS.sleep(l_factors1_G_backoff);
119 l_factors1_G_backoff = Math.max(1024, l_factors1_G_backoff * 2);
120 if (control.isFailing) throw new FailureAssistException();
121 if (Thread.interrupted()) throw new InterruptedException();
122 }
123 }
124 if (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.compareAndSet(l_calculator2_G, 0, 1)) {
125 try {
126 if (control.isFailing) throw new FailureAssistException();
127 if (l_calculator2_G.readyTrial) {
128 l_calculator2_G.readyTrial = false;
129 }
130 } catch (Throwable t) {
131 control.isFailing = true;
132 throw t;
133 } finally {
134 LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.set(l_calculator2_G, 0);
135 }
136 } else {
137 long l_calculator2_G_backoff = 1;
138 while (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.get(l_calculator2_G) == 1) {
139 TimeUnit.MILLISECONDS.sleep(l_calculator2_G_backoff);
140 l_calculator2_G_backoff = Math.max(1024, l_calculator2_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_factors1_G = null;
147 }
148 synchronized(this.getClass()) {
149 f_calculator2_G = null;
150 }
151 synchronized(this.getClass()) {
152 f_linearcombinationperformance0_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, "fourD", 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 fourD_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, LinearCombinationPerformance_Factors_jmhType l_factors1_G, LinearCombinationPerformance_Calculator_jmhType l_calculator2_G, LinearCombinationPerformance_jmhType l_linearcombinationperformance0_G) throws Throwable {
171 long operations = 0;
172 long realTime = 0;
173 result.startTime = System.nanoTime();
174 do {
175 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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 fourD_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 LinearCombinationPerformance_jmhType l_linearcombinationperformance0_G = _jmh_tryInit_f_linearcombinationperformance0_G(control);
195 LinearCombinationPerformance_Calculator_jmhType l_calculator2_G = _jmh_tryInit_f_calculator2_G(control);
196 LinearCombinationPerformance_Factors_jmhType l_factors1_G = _jmh_tryInit_f_factors1_G(control);
197
198 control.preSetup();
199
200
201 control.announceWarmupReady();
202 while (control.warmupShouldWait) {
203 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_G);
204 if (control.shouldYield) Thread.yield();
205 res.allOps++;
206 }
207
208 notifyControl.startMeasurement = true;
209 fourD_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_factors1_G, l_calculator2_G, l_linearcombinationperformance0_G);
210 notifyControl.stopMeasurement = true;
211 control.announceWarmdownReady();
212 try {
213 while (control.warmdownShouldWait) {
214 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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 (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.compareAndSet(l_factors1_G, 0, 1)) {
225 try {
226 if (control.isFailing) throw new FailureAssistException();
227 if (l_factors1_G.readyTrial) {
228 l_factors1_G.readyTrial = false;
229 }
230 } catch (Throwable t) {
231 control.isFailing = true;
232 throw t;
233 } finally {
234 LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.set(l_factors1_G, 0);
235 }
236 } else {
237 long l_factors1_G_backoff = 1;
238 while (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.get(l_factors1_G) == 1) {
239 TimeUnit.MILLISECONDS.sleep(l_factors1_G_backoff);
240 l_factors1_G_backoff = Math.max(1024, l_factors1_G_backoff * 2);
241 if (control.isFailing) throw new FailureAssistException();
242 if (Thread.interrupted()) throw new InterruptedException();
243 }
244 }
245 if (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.compareAndSet(l_calculator2_G, 0, 1)) {
246 try {
247 if (control.isFailing) throw new FailureAssistException();
248 if (l_calculator2_G.readyTrial) {
249 l_calculator2_G.readyTrial = false;
250 }
251 } catch (Throwable t) {
252 control.isFailing = true;
253 throw t;
254 } finally {
255 LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.set(l_calculator2_G, 0);
256 }
257 } else {
258 long l_calculator2_G_backoff = 1;
259 while (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.get(l_calculator2_G) == 1) {
260 TimeUnit.MILLISECONDS.sleep(l_calculator2_G_backoff);
261 l_calculator2_G_backoff = Math.max(1024, l_calculator2_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_factors1_G = null;
268 }
269 synchronized(this.getClass()) {
270 f_calculator2_G = null;
271 }
272 synchronized(this.getClass()) {
273 f_linearcombinationperformance0_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, "fourD", 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 fourD_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, LinearCombinationPerformance_Factors_jmhType l_factors1_G, LinearCombinationPerformance_Calculator_jmhType l_calculator2_G, LinearCombinationPerformance_jmhType l_linearcombinationperformance0_G) throws Throwable {
292 long operations = 0;
293 long realTime = 0;
294 result.startTime = System.nanoTime();
295 do {
296 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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 fourD_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 LinearCombinationPerformance_jmhType l_linearcombinationperformance0_G = _jmh_tryInit_f_linearcombinationperformance0_G(control);
316 LinearCombinationPerformance_Calculator_jmhType l_calculator2_G = _jmh_tryInit_f_calculator2_G(control);
317 LinearCombinationPerformance_Factors_jmhType l_factors1_G = _jmh_tryInit_f_factors1_G(control);
318
319 control.preSetup();
320
321
322 control.announceWarmupReady();
323 while (control.warmupShouldWait) {
324 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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);
331 int batchSize = iterationParams.getBatchSize();
332 int opsPerInv = benchmarkParams.getOpsPerInvocation();
333 SampleBuffer buffer = new SampleBuffer();
334 fourD_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_factors1_G, l_calculator2_G, l_linearcombinationperformance0_G);
335 notifyControl.stopMeasurement = true;
336 control.announceWarmdownReady();
337 try {
338 while (control.warmdownShouldWait) {
339 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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 (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.compareAndSet(l_factors1_G, 0, 1)) {
350 try {
351 if (control.isFailing) throw new FailureAssistException();
352 if (l_factors1_G.readyTrial) {
353 l_factors1_G.readyTrial = false;
354 }
355 } catch (Throwable t) {
356 control.isFailing = true;
357 throw t;
358 } finally {
359 LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.set(l_factors1_G, 0);
360 }
361 } else {
362 long l_factors1_G_backoff = 1;
363 while (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.get(l_factors1_G) == 1) {
364 TimeUnit.MILLISECONDS.sleep(l_factors1_G_backoff);
365 l_factors1_G_backoff = Math.max(1024, l_factors1_G_backoff * 2);
366 if (control.isFailing) throw new FailureAssistException();
367 if (Thread.interrupted()) throw new InterruptedException();
368 }
369 }
370 if (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.compareAndSet(l_calculator2_G, 0, 1)) {
371 try {
372 if (control.isFailing) throw new FailureAssistException();
373 if (l_calculator2_G.readyTrial) {
374 l_calculator2_G.readyTrial = false;
375 }
376 } catch (Throwable t) {
377 control.isFailing = true;
378 throw t;
379 } finally {
380 LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.set(l_calculator2_G, 0);
381 }
382 } else {
383 long l_calculator2_G_backoff = 1;
384 while (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.get(l_calculator2_G) == 1) {
385 TimeUnit.MILLISECONDS.sleep(l_calculator2_G_backoff);
386 l_calculator2_G_backoff = Math.max(1024, l_calculator2_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_factors1_G = null;
393 }
394 synchronized(this.getClass()) {
395 f_calculator2_G = null;
396 }
397 synchronized(this.getClass()) {
398 f_linearcombinationperformance0_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, "fourD", 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 fourD_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, LinearCombinationPerformance_Factors_jmhType l_factors1_G, LinearCombinationPerformance_Calculator_jmhType l_calculator2_G, LinearCombinationPerformance_jmhType l_linearcombinationperformance0_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 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_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 fourD_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 LinearCombinationPerformance_jmhType l_linearcombinationperformance0_G = _jmh_tryInit_f_linearcombinationperformance0_G(control);
456 LinearCombinationPerformance_Calculator_jmhType l_calculator2_G = _jmh_tryInit_f_calculator2_G(control);
457 LinearCombinationPerformance_Factors_jmhType l_factors1_G = _jmh_tryInit_f_factors1_G(control);
458
459 control.preSetup();
460
461
462 notifyControl.startMeasurement = true;
463 RawResults res = new RawResults();
464 int batchSize = iterationParams.getBatchSize();
465 fourD_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_factors1_G, l_calculator2_G, l_linearcombinationperformance0_G);
466 control.preTearDown();
467
468 if (control.isLastIteration()) {
469 if (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.compareAndSet(l_factors1_G, 0, 1)) {
470 try {
471 if (control.isFailing) throw new FailureAssistException();
472 if (l_factors1_G.readyTrial) {
473 l_factors1_G.readyTrial = false;
474 }
475 } catch (Throwable t) {
476 control.isFailing = true;
477 throw t;
478 } finally {
479 LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.set(l_factors1_G, 0);
480 }
481 } else {
482 long l_factors1_G_backoff = 1;
483 while (LinearCombinationPerformance_Factors_jmhType.tearTrialMutexUpdater.get(l_factors1_G) == 1) {
484 TimeUnit.MILLISECONDS.sleep(l_factors1_G_backoff);
485 l_factors1_G_backoff = Math.max(1024, l_factors1_G_backoff * 2);
486 if (control.isFailing) throw new FailureAssistException();
487 if (Thread.interrupted()) throw new InterruptedException();
488 }
489 }
490 if (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.compareAndSet(l_calculator2_G, 0, 1)) {
491 try {
492 if (control.isFailing) throw new FailureAssistException();
493 if (l_calculator2_G.readyTrial) {
494 l_calculator2_G.readyTrial = false;
495 }
496 } catch (Throwable t) {
497 control.isFailing = true;
498 throw t;
499 } finally {
500 LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.set(l_calculator2_G, 0);
501 }
502 } else {
503 long l_calculator2_G_backoff = 1;
504 while (LinearCombinationPerformance_Calculator_jmhType.tearTrialMutexUpdater.get(l_calculator2_G) == 1) {
505 TimeUnit.MILLISECONDS.sleep(l_calculator2_G_backoff);
506 l_calculator2_G_backoff = Math.max(1024, l_calculator2_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_factors1_G = null;
513 }
514 synchronized(this.getClass()) {
515 f_calculator2_G = null;
516 }
517 synchronized(this.getClass()) {
518 f_linearcombinationperformance0_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, "fourD", 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 fourD_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, LinearCombinationPerformance_Factors_jmhType l_factors1_G, LinearCombinationPerformance_Calculator_jmhType l_calculator2_G, LinearCombinationPerformance_jmhType l_linearcombinationperformance0_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 l_linearcombinationperformance0_G.fourD(l_factors1_G, blackhole, l_calculator2_G);
537 }
538 result.stopTime = System.nanoTime();
539 result.realTime = realTime;
540 }
541
542
543 static volatile LinearCombinationPerformance_Calculator_jmhType f_calculator2_G;
544
545 LinearCombinationPerformance_Calculator_jmhType _jmh_tryInit_f_calculator2_G(InfraControl control) throws Throwable {
546 LinearCombinationPerformance_Calculator_jmhType val = f_calculator2_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_calculator2_G;
554 if (val != null) {
555 return val;
556 }
557 val = new LinearCombinationPerformance_Calculator_jmhType();
558 Field f;
559 f = org.apache.commons.numbers.examples.jmh.core.LinearCombinationPerformance.Calculator.class.getDeclaredField("name");
560 f.setAccessible(true);
561 f.set(val, control.getParam("name"));
562 val.setup();
563 val.readyTrial = true;
564 f_calculator2_G = val;
565 } catch (Throwable t) {
566 control.isFailing = true;
567 throw t;
568 }
569 }
570 return val;
571 }
572
573 static volatile LinearCombinationPerformance_Factors_jmhType f_factors1_G;
574
575 LinearCombinationPerformance_Factors_jmhType _jmh_tryInit_f_factors1_G(InfraControl control) throws Throwable {
576 LinearCombinationPerformance_Factors_jmhType val = f_factors1_G;
577 if (val != null) {
578 return val;
579 }
580 synchronized(this.getClass()) {
581 try {
582 if (control.isFailing) throw new FailureAssistException();
583 val = f_factors1_G;
584 if (val != null) {
585 return val;
586 }
587 val = new LinearCombinationPerformance_Factors_jmhType();
588 Field f;
589 f = org.apache.commons.numbers.examples.jmh.core.LinearCombinationPerformance.Factors.class.getDeclaredField("c");
590 f.setAccessible(true);
591 f.set(val, Double.valueOf(control.getParam("c")));
592 f = org.apache.commons.numbers.examples.jmh.core.LinearCombinationPerformance.Factors.class.getDeclaredField("size");
593 f.setAccessible(true);
594 f.set(val, Integer.valueOf(control.getParam("size")));
595 val.setup();
596 val.readyTrial = true;
597 f_factors1_G = val;
598 } catch (Throwable t) {
599 control.isFailing = true;
600 throw t;
601 }
602 }
603 return val;
604 }
605
606 static volatile LinearCombinationPerformance_jmhType f_linearcombinationperformance0_G;
607
608 LinearCombinationPerformance_jmhType _jmh_tryInit_f_linearcombinationperformance0_G(InfraControl control) throws Throwable {
609 LinearCombinationPerformance_jmhType val = f_linearcombinationperformance0_G;
610 if (val != null) {
611 return val;
612 }
613 synchronized(this.getClass()) {
614 try {
615 if (control.isFailing) throw new FailureAssistException();
616 val = f_linearcombinationperformance0_G;
617 if (val != null) {
618 return val;
619 }
620 val = new LinearCombinationPerformance_jmhType();
621 val.readyTrial = true;
622 f_linearcombinationperformance0_G = val;
623 } catch (Throwable t) {
624 control.isFailing = true;
625 throw t;
626 }
627 }
628 return val;
629 }
630
631
632 }
633