1 package io.netty.buffer.jmh_generated;
2
3 import java.util.List;
4 import java.util.concurrent.atomic.AtomicInteger;
5 import java.util.Collection;
6 import java.util.ArrayList;
7 import java.util.concurrent.TimeUnit;
8 import org.openjdk.jmh.annotations.CompilerControl;
9 import org.openjdk.jmh.runner.InfraControl;
10 import org.openjdk.jmh.infra.ThreadParams;
11 import org.openjdk.jmh.results.BenchmarkTaskResult;
12 import org.openjdk.jmh.results.Result;
13 import org.openjdk.jmh.results.ThroughputResult;
14 import org.openjdk.jmh.results.AverageTimeResult;
15 import org.openjdk.jmh.results.SampleTimeResult;
16 import org.openjdk.jmh.results.SingleShotResult;
17 import org.openjdk.jmh.util.SampleBuffer;
18 import org.openjdk.jmh.annotations.Mode;
19 import org.openjdk.jmh.annotations.Fork;
20 import org.openjdk.jmh.annotations.Measurement;
21 import org.openjdk.jmh.annotations.Threads;
22 import org.openjdk.jmh.annotations.Warmup;
23 import org.openjdk.jmh.annotations.BenchmarkMode;
24 import org.openjdk.jmh.results.RawResults;
25 import org.openjdk.jmh.results.ResultRole;
26 import java.lang.reflect.Field;
27 import org.openjdk.jmh.infra.BenchmarkParams;
28 import org.openjdk.jmh.infra.IterationParams;
29 import org.openjdk.jmh.infra.Blackhole;
30 import org.openjdk.jmh.infra.Control;
31 import org.openjdk.jmh.results.ScalarResult;
32 import org.openjdk.jmh.results.AggregationPolicy;
33 import org.openjdk.jmh.runner.FailureAssistException;
34
35 import io.netty.buffer.jmh_generated.CompositeByteBufRandomAccessBenchmark_jmhType;
36 public final class CompositeByteBufRandomAccessBenchmark_setLong_jmhTest {
37
38 byte p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015;
39 byte p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031;
40 byte p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047;
41 byte p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063;
42 byte p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079;
43 byte p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095;
44 byte p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111;
45 byte p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127;
46 byte p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143;
47 byte p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159;
48 byte p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175;
49 byte p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191;
50 byte p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207;
51 byte p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223;
52 byte p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239;
53 byte p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255;
54 int startRndMask;
55 BenchmarkParams benchmarkParams;
56 IterationParams iterationParams;
57 ThreadParams threadParams;
58 Blackhole blackhole;
59 Control notifyControl;
60
61 public BenchmarkTaskResult setLong_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable {
62 this.benchmarkParams = control.benchmarkParams;
63 this.iterationParams = control.iterationParams;
64 this.threadParams = threadParams;
65 this.notifyControl = control.notifyControl;
66 if (this.blackhole == null) {
67 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
68 }
69 if (threadParams.getSubgroupIndex() == 0) {
70 RawResults res = new RawResults();
71 CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0 = _jmh_tryInit_f_compositebytebufrandomaccessbenchmark0_0(control);
72
73 control.preSetup();
74
75
76 control.announceWarmupReady();
77 while (control.warmupShouldWait) {
78 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
79 res.allOps++;
80 }
81
82 notifyControl.startMeasurement = true;
83 setLong_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_compositebytebufrandomaccessbenchmark0_0);
84 notifyControl.stopMeasurement = true;
85 control.announceWarmdownReady();
86 try {
87 while (control.warmdownShouldWait) {
88 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
89 res.allOps++;
90 }
91 } catch (Throwable e) {
92 if (!(e instanceof InterruptedException)) throw e;
93 }
94 control.preTearDown();
95
96 if (control.isLastIteration()) {
97 l_compositebytebufrandomaccessbenchmark0_0.teardown();
98 f_compositebytebufrandomaccessbenchmark0_0 = null;
99 }
100 res.allOps += res.measuredOps;
101 int batchSize = iterationParams.getBatchSize();
102 int opsPerInv = benchmarkParams.getOpsPerInvocation();
103 res.allOps *= opsPerInv;
104 res.allOps /= batchSize;
105 res.measuredOps *= opsPerInv;
106 res.measuredOps /= batchSize;
107 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
108 results.add(new ThroughputResult(ResultRole.PRIMARY, "setLong", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
109 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
110 return results;
111 } else
112 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
113 }
114
115 public static void setLong_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0) throws Throwable {
116 long operations = 0;
117 long realTime = 0;
118 result.startTime = System.nanoTime();
119 do {
120 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
121 operations++;
122 } while(!control.isDone);
123 result.stopTime = System.nanoTime();
124 result.realTime = realTime;
125 result.measuredOps = operations;
126 }
127
128
129 public BenchmarkTaskResult setLong_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
130 this.benchmarkParams = control.benchmarkParams;
131 this.iterationParams = control.iterationParams;
132 this.threadParams = threadParams;
133 this.notifyControl = control.notifyControl;
134 if (this.blackhole == null) {
135 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
136 }
137 if (threadParams.getSubgroupIndex() == 0) {
138 RawResults res = new RawResults();
139 CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0 = _jmh_tryInit_f_compositebytebufrandomaccessbenchmark0_0(control);
140
141 control.preSetup();
142
143
144 control.announceWarmupReady();
145 while (control.warmupShouldWait) {
146 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
147 res.allOps++;
148 }
149
150 notifyControl.startMeasurement = true;
151 setLong_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_compositebytebufrandomaccessbenchmark0_0);
152 notifyControl.stopMeasurement = true;
153 control.announceWarmdownReady();
154 try {
155 while (control.warmdownShouldWait) {
156 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
157 res.allOps++;
158 }
159 } catch (Throwable e) {
160 if (!(e instanceof InterruptedException)) throw e;
161 }
162 control.preTearDown();
163
164 if (control.isLastIteration()) {
165 l_compositebytebufrandomaccessbenchmark0_0.teardown();
166 f_compositebytebufrandomaccessbenchmark0_0 = null;
167 }
168 res.allOps += res.measuredOps;
169 int batchSize = iterationParams.getBatchSize();
170 int opsPerInv = benchmarkParams.getOpsPerInvocation();
171 res.allOps *= opsPerInv;
172 res.allOps /= batchSize;
173 res.measuredOps *= opsPerInv;
174 res.measuredOps /= batchSize;
175 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
176 results.add(new AverageTimeResult(ResultRole.PRIMARY, "setLong", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
177 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
178 return results;
179 } else
180 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
181 }
182
183 public static void setLong_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0) throws Throwable {
184 long operations = 0;
185 long realTime = 0;
186 result.startTime = System.nanoTime();
187 do {
188 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
189 operations++;
190 } while(!control.isDone);
191 result.stopTime = System.nanoTime();
192 result.realTime = realTime;
193 result.measuredOps = operations;
194 }
195
196
197 public BenchmarkTaskResult setLong_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
198 this.benchmarkParams = control.benchmarkParams;
199 this.iterationParams = control.iterationParams;
200 this.threadParams = threadParams;
201 this.notifyControl = control.notifyControl;
202 if (this.blackhole == null) {
203 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
204 }
205 if (threadParams.getSubgroupIndex() == 0) {
206 RawResults res = new RawResults();
207 CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0 = _jmh_tryInit_f_compositebytebufrandomaccessbenchmark0_0(control);
208
209 control.preSetup();
210
211
212 control.announceWarmupReady();
213 while (control.warmupShouldWait) {
214 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
215 res.allOps++;
216 }
217
218 notifyControl.startMeasurement = true;
219 int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20);
220 int batchSize = iterationParams.getBatchSize();
221 int opsPerInv = benchmarkParams.getOpsPerInvocation();
222 SampleBuffer buffer = new SampleBuffer();
223 setLong_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_compositebytebufrandomaccessbenchmark0_0);
224 notifyControl.stopMeasurement = true;
225 control.announceWarmdownReady();
226 try {
227 while (control.warmdownShouldWait) {
228 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
229 res.allOps++;
230 }
231 } catch (Throwable e) {
232 if (!(e instanceof InterruptedException)) throw e;
233 }
234 control.preTearDown();
235
236 if (control.isLastIteration()) {
237 l_compositebytebufrandomaccessbenchmark0_0.teardown();
238 f_compositebytebufrandomaccessbenchmark0_0 = null;
239 }
240 res.allOps += res.measuredOps * batchSize;
241 res.allOps *= opsPerInv;
242 res.allOps /= batchSize;
243 res.measuredOps *= opsPerInv;
244 BenchmarkTaskResult results = new BenchmarkTaskResult((long)res.allOps, (long)res.measuredOps);
245 results.add(new SampleTimeResult(ResultRole.PRIMARY, "setLong", buffer, benchmarkParams.getTimeUnit()));
246 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
247 return results;
248 } else
249 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
250 }
251
252 public static void setLong_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, CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0) throws Throwable {
253 long realTime = 0;
254 long operations = 0;
255 int rnd = (int)System.nanoTime();
256 int rndMask = startRndMask;
257 long time = 0;
258 int currentStride = 0;
259 do {
260 rnd = (rnd * 1664525 + 1013904223);
261 boolean sample = (rnd & rndMask) == 0;
262 if (sample) {
263 time = System.nanoTime();
264 }
265 for (int b = 0; b < batchSize; b++) {
266 if (control.volatileSpoiler) return;
267 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
268 }
269 if (sample) {
270 buffer.add((System.nanoTime() - time) / opsPerInv);
271 if (currentStride++ > targetSamples) {
272 buffer.half();
273 currentStride = 0;
274 rndMask = (rndMask << 1) + 1;
275 }
276 }
277 operations++;
278 } while(!control.isDone);
279 startRndMask = Math.max(startRndMask, rndMask);
280 result.realTime = realTime;
281 result.measuredOps = operations;
282 }
283
284
285 public BenchmarkTaskResult setLong_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
286 this.benchmarkParams = control.benchmarkParams;
287 this.iterationParams = control.iterationParams;
288 this.threadParams = threadParams;
289 this.notifyControl = control.notifyControl;
290 if (this.blackhole == null) {
291 this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
292 }
293 if (threadParams.getSubgroupIndex() == 0) {
294 CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0 = _jmh_tryInit_f_compositebytebufrandomaccessbenchmark0_0(control);
295
296 control.preSetup();
297
298
299 notifyControl.startMeasurement = true;
300 RawResults res = new RawResults();
301 int batchSize = iterationParams.getBatchSize();
302 setLong_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_compositebytebufrandomaccessbenchmark0_0);
303 control.preTearDown();
304
305 if (control.isLastIteration()) {
306 l_compositebytebufrandomaccessbenchmark0_0.teardown();
307 f_compositebytebufrandomaccessbenchmark0_0 = null;
308 }
309 int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
310 long totalOps = opsPerInv;
311 BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
312 results.add(new SingleShotResult(ResultRole.PRIMARY, "setLong", res.getTime(), totalOps, benchmarkParams.getTimeUnit()));
313 this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
314 return results;
315 } else
316 throw new IllegalStateException("Harness failed to distribute threads among groups properly");
317 }
318
319 public static void setLong_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, CompositeByteBufRandomAccessBenchmark_jmhType l_compositebytebufrandomaccessbenchmark0_0) throws Throwable {
320 long realTime = 0;
321 result.startTime = System.nanoTime();
322 for (int b = 0; b < batchSize; b++) {
323 if (control.volatileSpoiler) return;
324 blackhole.consume(l_compositebytebufrandomaccessbenchmark0_0.setLong());
325 }
326 result.stopTime = System.nanoTime();
327 result.realTime = realTime;
328 }
329
330
331 CompositeByteBufRandomAccessBenchmark_jmhType f_compositebytebufrandomaccessbenchmark0_0;
332
333 CompositeByteBufRandomAccessBenchmark_jmhType _jmh_tryInit_f_compositebytebufrandomaccessbenchmark0_0(InfraControl control) throws Throwable {
334 if (control.isFailing) throw new FailureAssistException();
335 CompositeByteBufRandomAccessBenchmark_jmhType val = f_compositebytebufrandomaccessbenchmark0_0;
336 if (val == null) {
337 val = new CompositeByteBufRandomAccessBenchmark_jmhType();
338 Field f;
339 f = io.netty.buffer.CompositeByteBufRandomAccessBenchmark.class.getDeclaredField("bufferType");
340 f.setAccessible(true);
341 f.set(val, io.netty.buffer.CompositeByteBufRandomAccessBenchmark.ByteBufType.valueOf(control.getParam("bufferType")));
342 f = io.netty.buffer.CompositeByteBufRandomAccessBenchmark.class.getDeclaredField("size");
343 f.setAccessible(true);
344 f.set(val, Integer.valueOf(control.getParam("size")));
345 val.setup();
346 f_compositebytebufrandomaccessbenchmark0_0 = val;
347 }
348 return val;
349 }
350
351
352 }
353