Skip to content

Commit

Permalink
- MPerf now accepts -time, -threads, -size
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Sep 24, 2024
1 parent 147600e commit 787f7a5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/perf/org/jgroups/tests/perf/MPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public MPerf(Path out_file_path) throws IOException {
}
}

public MPerf time(int t) {this.time=t; return this;}
public MPerf size(int s) {this.msg_size=s; return this;}
public MPerf threads(int t) {this.num_threads=t; return this;}

public void start(String props, String name, boolean use_virtual_threads) throws Exception {
StringBuilder sb=new StringBuilder();
sb.append("\n\n----------------------- MPerf -----------------------\n");
Expand Down Expand Up @@ -749,6 +753,7 @@ public static void main(String[] args) throws IOException {
String props=null, name=null;
boolean run_event_loop=true, use_virtual_threads=true;
Path out_file_path=null;
int time=60, size=1000, threads=100;

for(int i=0; i < args.length; i++) {
if("-props".equals(args[i])) {
Expand All @@ -771,12 +776,25 @@ public static void main(String[] args) throws IOException {
use_virtual_threads=Boolean.parseBoolean(args[++i]);
continue;
}
if("-time".equals(args[i])) {
time=Integer.parseInt(args[++i]);
continue;
}
if("-size".equals(args[i])) {
size=Integer.parseInt(args[++i]);
continue;
}
if("-threads".equals(args[i])) {
threads=Integer.parseInt(args[++i]);
continue;
}
System.out.println("MPerf [-props <stack config>] [-name <logical name>] [-nohup] " +
"[-use_virtual_threads true|false] [-file <file path>]");
"[-use_virtual_threads true|false] [-file <file path>] " +
"[-time <secs>] [-size <bytes>] [-threads <number of sender threads>]");
return;
}

final MPerf test=new MPerf(out_file_path);
final MPerf test=new MPerf(out_file_path).time(time).size(size).threads(threads);
try {
test.start(props, name, use_virtual_threads);
if(run_event_loop)
Expand Down

0 comments on commit 787f7a5

Please sign in to comment.