Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
02ba22b3
Commit
02ba22b3
authored
Jan 17, 2017
by
Marc Schiller
Browse files
Changed getStatus method to ignore global overload status.
parent
78096ec9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/views/fiveg/ModelBasedSegmentDatabase.java
View file @
02ba22b3
...
...
@@ -204,6 +204,8 @@ public class ModelBasedSegmentDatabase
private
final
long
THRESHOLD_BANDWIDTH
=
10
;
private
final
double
THRESHOLD_DROPRATE
=
1
;
private
final
double
YELLOW_INDICATOR
=
.
9
;
// Other storage
private
final
int
segment
;
...
...
@@ -248,6 +250,7 @@ public class ModelBasedSegmentDatabase
public
void
onHostLeavesSegment
(
MacAddress
hostAddr
)
{
// Remove MAC from current users
this
.
hostsInSegment
.
remove
(
hostAddr
);
calc
();
}
...
...
@@ -257,6 +260,7 @@ public class ModelBasedSegmentDatabase
public
void
onHostEntersSegment
(
MacAddress
hostAddr
)
{
// Add MAC to current users
this
.
hostsInSegment
.
add
(
hostAddr
);
calc
();
}
...
...
@@ -318,34 +322,75 @@ public class ModelBasedSegmentDatabase
}
public
int
getStatus
(
ParameterType
type
,
Direction
dir
)
{
this
.
calc
();
if
(
this
.
overload
)
{
return
2
;
}
if
(
type
.
equals
(
ParameterType
.
BANDWIDTH
)
&&
dir
.
equals
(
Direction
.
UPLOAD
)
&&
this
.
bandUp
<
(.
9
*
THRESHOLD_BANDWIDTH
))
{
return
1
;
if
(
type
.
equals
(
ParameterType
.
BANDWIDTH
)
&&
dir
.
equals
(
Direction
.
UPLOAD
))
{
if
(
this
.
bandUp
<
THRESHOLD_BANDWIDTH
)
{
return
2
;
}
if
(
this
.
bandUp
<
(
YELLOW_INDICATOR
*
THRESHOLD_BANDWIDTH
))
{
return
1
;
}
return
0
;
}
if
(
type
.
equals
(
ParameterType
.
BANDWIDTH
)
&&
dir
.
equals
(
Direction
.
DOWNLOAD
)
&&
this
.
bandDown
<
(.
9
*
THRESHOLD_BANDWIDTH
))
{
return
1
;
if
(
type
.
equals
(
ParameterType
.
BANDWIDTH
)
&&
dir
.
equals
(
Direction
.
DOWNLOAD
))
{
if
(
this
.
bandDown
<
THRESHOLD_BANDWIDTH
)
{
return
2
;
}
if
(
this
.
bandDown
<
(
YELLOW_INDICATOR
*
THRESHOLD_BANDWIDTH
))
{
return
1
;
}
return
0
;
}
if
(
type
.
equals
(
ParameterType
.
DROPRATE
)
&&
dir
.
equals
(
Direction
.
UPLOAD
)
&&
this
.
dropUp
>
(.
9
*
THRESHOLD_DROPRATE
))
{
return
1
;
if
(
type
.
equals
(
ParameterType
.
DROPRATE
)
&&
dir
.
equals
(
Direction
.
UPLOAD
))
{
if
(
this
.
dropUp
>
THRESHOLD_DROPRATE
)
{
return
2
;
}
if
(
this
.
dropUp
>
(
YELLOW_INDICATOR
*
THRESHOLD_DROPRATE
))
{
return
1
;
}
return
0
;
}
if
(
type
.
equals
(
ParameterType
.
DROPRATE
)
&&
dir
.
equals
(
Direction
.
DOWNLOAD
)
&&
this
.
dropDown
>
(.
9
*
THRESHOLD_DROPRATE
))
{
return
1
;
if
(
type
.
equals
(
ParameterType
.
DROPRATE
)
&&
dir
.
equals
(
Direction
.
DOWNLOAD
))
{
if
(
this
.
dropDown
>
THRESHOLD_DROPRATE
)
{
return
2
;
}
if
(
this
.
dropDown
>
(
YELLOW_INDICATOR
*
THRESHOLD_DROPRATE
))
{
return
1
;
}
return
0
;
}
if
(
type
.
equals
(
ParameterType
.
LATENCY
)
&&
dir
.
equals
(
Direction
.
UPLOAD
)
&&
this
.
latUp
>
(.
9
*
THRESHOLD_DROPRATE
))
{
return
1
;
if
(
type
.
equals
(
ParameterType
.
LATENCY
)
&&
dir
.
equals
(
Direction
.
UPLOAD
))
{
if
(
this
.
latUp
>
THRESHOLD_LATENCY
)
{
return
2
;
}
if
(
this
.
latUp
>
(
YELLOW_INDICATOR
*
THRESHOLD_LATENCY
))
{
return
1
;
}
return
0
;
}
if
(
type
.
equals
(
ParameterType
.
LATENCY
)
&&
dir
.
equals
(
Direction
.
DOWNLOAD
)
&&
this
.
latDown
>
(.
9
*
THRESHOLD_DROPRATE
))
{
return
1
;
if
(
type
.
equals
(
ParameterType
.
LATENCY
)
&&
dir
.
equals
(
Direction
.
DOWNLOAD
))
{
if
(
this
.
latDown
>
THRESHOLD_LATENCY
)
{
return
2
;
}
if
(
this
.
latDown
>
(
YELLOW_INDICATOR
*
THRESHOLD_LATENCY
))
{
return
1
;
}
return
0
;
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment