Commit 28890d87 authored by Florian Fittkau's avatar Florian Fittkau

...

parent 3c9a4d26
......@@ -20,18 +20,14 @@ import org.jfree.data.xy.DefaultXYDataset;
import org.jfree.data.xy.XYSeries;
public class Main extends JFrame {
private static final double INTENSITY = 6;
private static final int THREAD_COUNT = 32;
/**
* This value somehow is bound to the thread amount => do a real run with
* the desired thread amount and low values. Afterwards, adjust the constant
* accordingly.
*/
private static final float SESSION_TO_REQUEST_RATIO = 2.1f;
private static final double INTENSITY = 400;
private static final int JMETER_INSTANCES = 1;
private static final boolean CREATE_PLAN_ON_STDOUT = false;
private static int PLAN_DURATION_STEP_IN_SEC = 5 * 60;
private static int PLAN_OVERALL_DURATION_IN_SEC = 87200;
private static final long serialVersionUID = 5979088644386284446L;
public static void main(String[] args) {
......@@ -51,6 +47,10 @@ public class Main extends JFrame {
chartPanel.setPreferredSize(fullScreen);
setContentPane(chartPanel);
if (CREATE_PLAN_ON_STDOUT) {
createVariableThroughputOut();
}
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
......@@ -60,19 +60,34 @@ public class Main extends JFrame {
});
}
private void createVariableThroughputOut() {
int propCounter = 1;
for (int currentSecond = 0; currentSecond < PLAN_OVERALL_DURATION_IN_SEC; currentSecond += PLAN_DURATION_STEP_IN_SEC) {
output("propName" + propCounter++, getWorkload(currentSecond / 60f),
getWorkload((currentSecond + PLAN_DURATION_STEP_IN_SEC) / 60f),
PLAN_DURATION_STEP_IN_SEC);
}
}
private void output(String propName, int startRPS, int targetRPS, int durationInSec) {
System.out.println("<collectionProp name=\"" + propName + "\">\n\t<stringProp name=\""
+ startRPS + "\">" + startRPS + "</stringProp>\n\t<stringProp name=\"" + targetRPS
+ "\">" + targetRPS + "</stringProp>\n\t<stringProp name=\"" + durationInSec
+ "\">" + durationInSec + "</stringProp>\n</collectionProp>");
}
private DefaultXYDataset createDataset() {
final DefaultXYDataset dataset = new DefaultXYDataset();
final XYSeries series1 = new XYSeries("Approximate requests per sec");
for (float minute = 0f; minute <= 1440f; minute += 0.2f) {
series1.add((minute + 1380) * 1000 * 60, getWorkload(minute) * THREAD_COUNT
* JMETER_INSTANCES * SESSION_TO_REQUEST_RATIO);
for (int minute = 0; minute <= (PLAN_OVERALL_DURATION_IN_SEC / 60); minute += 1) {
series1.add((minute + 1380) * 1000 * 60, getWorkload(minute) * JMETER_INSTANCES);
}
dataset.addSeries("Approximate requests per sec", series1.toArray());
return dataset;
}
private JFreeChart createChart(DefaultXYDataset dataset, String title) {
......@@ -80,8 +95,6 @@ public class Main extends JFrame {
"Requests per sec", dataset, false, true, false);
final XYPlot plot = (XYPlot) chart.getPlot();
// plot.setBackgroundPaint(Color.white);
// plot.setRangeGridlinePaint(Color.black);
final XYItemRenderer renderer = plot.getRenderer();
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{1} -> {2}",
new SimpleDateFormat("HH:mm"), NumberFormat.getInstance()));
......@@ -91,8 +104,8 @@ public class Main extends JFrame {
return chart;
}
private static double getWorkload(float expiredMinute) {
final double numSessions = ((numSessions(expiredMinute) / 2d) * INTENSITY);
private static int getWorkload(float expiredMinute) {
final int numSessions = (int) ((numSessions(expiredMinute) / 2d) * INTENSITY);
return numSessions > 1 ? numSessions : 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment