Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
workload-visualizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ExplorViz
explorviz-github-archive
workload-visualizer
Commits
28890d87
Commit
28890d87
authored
10 years ago
by
Florian Fittkau
Browse files
Options
Downloads
Patches
Plain Diff
...
parent
3c9a4d26
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/explorviz/loadforecaster/Main.java
+30
-17
30 additions, 17 deletions
src/explorviz/loadforecaster/Main.java
with
30 additions
and
17 deletions
src/explorviz/loadforecaster/Main.java
+
30
−
17
View file @
28890d87
...
...
@@ -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
/
60
f
),
getWorkload
((
currentSecond
+
PLAN_DURATION_STEP_IN_SEC
)
/
60
f
),
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
=
0
f
;
minute
<=
1440
f
;
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
)
/
2
d
)
*
INTENSITY
);
private
static
int
getWorkload
(
float
expiredMinute
)
{
final
int
numSessions
=
(
int
)
((
numSessions
(
expiredMinute
)
/
2
d
)
*
INTENSITY
);
return
numSessions
>
1
?
numSessions
:
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment