From 787f7a5041c3087ee71cdfcd31bda3e9f297643d Mon Sep 17 00:00:00 2001 From: Bela Ban Date: Tue, 24 Sep 2024 13:34:43 +0200 Subject: [PATCH] - MPerf now accepts -time, -threads, -size --- tests/perf/org/jgroups/tests/perf/MPerf.java | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/perf/org/jgroups/tests/perf/MPerf.java b/tests/perf/org/jgroups/tests/perf/MPerf.java index 040d90d673..6cda656d79 100644 --- a/tests/perf/org/jgroups/tests/perf/MPerf.java +++ b/tests/perf/org/jgroups/tests/perf/MPerf.java @@ -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"); @@ -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])) { @@ -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 ] [-name ] [-nohup] " + - "[-use_virtual_threads true|false] [-file ]"); + "[-use_virtual_threads true|false] [-file ] " + + "[-time ] [-size ] [-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)