File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
test/micro/org/openjdk/bench/java/util/concurrent Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2014, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2014, 2023 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
3535import org .openjdk .jmh .annotations .TearDown ;
3636import org .openjdk .jmh .annotations .Warmup ;
3737import org .openjdk .jmh .infra .Blackhole ;
38+ import org .openjdk .jmh .infra .ThreadParams ;
3839
3940import java .util .concurrent .ArrayBlockingQueue ;
4041import java .util .concurrent .BlockingQueue ;
5556@ Fork (3 )
5657public class ProducerConsumer {
5758
58- @ Param ("100" )
59+ @ Param ("100" ) // Will be expanded to at least the number of threads used
5960 private int capacity ;
6061
6162 @ Param
@@ -65,7 +66,9 @@ public class ProducerConsumer {
6566 private Producer prod ;
6667
6768 @ Setup
68- public void prepare () {
69+ public void prepare (ThreadParams params ) {
70+ capacity = Math .max (params .getThreadCount (), capacity );
71+
6972 switch (type ) {
7073 case ABQ_F :
7174 q = new ArrayBlockingQueue <>(capacity , true );
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2014, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2014, 2023 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
3434import org .openjdk .jmh .annotations .State ;
3535import org .openjdk .jmh .annotations .Warmup ;
3636import org .openjdk .jmh .infra .Blackhole ;
37+ import org .openjdk .jmh .infra .ThreadParams ;
3738
3839import java .util .concurrent .ArrayBlockingQueue ;
3940import java .util .concurrent .BlockingQueue ;
4950@ Fork (3 )
5051public class Queues {
5152
52- @ Param ("100" )
53+ @ Param ("100" ) // Will be expanded to at least the number of threads used
5354 private int capacity ;
5455
5556 @ Param
@@ -65,7 +66,9 @@ public enum QueueType {
6566 private BlockingQueue <Integer > q ;
6667
6768 @ Setup
68- public void setup () {
69+ public void setup (ThreadParams params ) {
70+ capacity = Math .max (params .getThreadCount (), capacity );
71+
6972 switch (type ) {
7073 case ABQ_F :
7174 q = new ArrayBlockingQueue <>(capacity , true );
You can’t perform that action at this time.
0 commit comments