/**
* Replication Benchmarker
* https://github.com/score-team/replication-benchmarker/
* Copyright (C) 2013 LORIA / Inria / SCORE Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package jbenchmarker;
import java.io.File;
import crdt.CRDT;
import crdt.Factory;
import crdt.simulator.CausalSimulator;
import crdt.simulator.Trace;
import crdt.simulator.tracestorage.TraceObjectWriter;
import crdt.simulator.random.RandomTrace;
import crdt.simulator.random.StandardSeqOpProfile;
/**
*
* @author score
*/
public class MainSimulation {
static int base = 100;
static int baseSerializ = 1;
static public void main(String[] args) throws Exception {
if (args.length < 12) {
System.err.println("Arguments :");
System.err.println("- Factory : import crdt.Factory<CRDT> implementation ");
System.err.println("- Number of execu : ");
System.err.println("- duration : ");
System.err.println("- perIns : ");
System.err.println("- perBlock : ");
System.err.println("- avgBlockSize : ");
System.err.println("- sdvBlockSize : ");
System.err.println("- probability : ");
System.err.println("- delay : ");
System.err.println("- sdv : ");
System.err.println("- replicas : ");
System.err.println("- name File : ");
System.exit(1);
}
Factory<CRDT> rf = (Factory<CRDT>) Class.forName(args[0]).newInstance();
int nbExec = Integer.valueOf(args[1]);
int nb = 1;
if (nbExec > 1) {
nb = nbExec + 1;
}
long duration = Long.valueOf(args[2]);
double perIns = Double.valueOf(args[3]);
double perBlock = Double.valueOf(args[4]);
int avgBlockSize = Integer.valueOf(args[5]);
double sdvBlockSize = Double.valueOf(args[6]);
double probability = Double.valueOf(args[7]);
long delay = Long.valueOf(args[8]);
double sdv = Double.valueOf(args[9]);
int replicas = Integer.valueOf(args[10]);
String nameUsr = args[11];
String repPath = System.getProperty("user.dir")+ File.separator+"ResultTest" + File.separator;
if(!new File(repPath).exists())
{
new File(repPath).mkdirs();
}
Trace trace = new RandomTrace(duration, RandomTrace.FLAT,
new StandardSeqOpProfile(perIns, perBlock, avgBlockSize, sdvBlockSize), probability, delay, sdv, replicas);
CausalSimulator cd = new CausalSimulator(rf, false, 0);
cd.setWriter(new TraceObjectWriter(repPath+nameUsr));
cd.run(trace); //create Trace
}
}