Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Thomas Vachuska
2015-05-29 17:09:59 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d910a5c5e1b1fcff84f292030d892ffdb243f028
d910a5c5
1 parent
fdbc4c27
Fixing port-stats DBZ
Change-Id: I2bd1f9d94c1441d6bdcde00a5d2a3e595e0c5c4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
core/api/src/main/java/org/onosproject/net/statistic/DefaultLoad.java
incubator/net/src/main/java/org/onosproject/incubator/net/impl/PortStatisticsManager.java
core/api/src/main/java/org/onosproject/net/statistic/DefaultLoad.java
View file @
d910a5c
...
...
@@ -17,6 +17,8 @@ package org.onosproject.net.statistic;
import
com.google.common.base.MoreObjects
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkArgument
;
/**
* Implementation of a load.
*/
...
...
@@ -62,6 +64,7 @@ public class DefaultLoad implements Load {
* @param interval poll interval for this load
*/
public
DefaultLoad
(
long
current
,
long
previous
,
int
interval
)
{
checkArgument
(
interval
>
0
,
"Interval must be greater than 0"
);
this
.
current
=
current
;
this
.
previous
=
previous
;
this
.
time
=
System
.
currentTimeMillis
();
...
...
incubator/net/src/main/java/org/onosproject/incubator/net/impl/PortStatisticsManager.java
View file @
d910a5c
...
...
@@ -46,8 +46,11 @@ import static org.slf4j.LoggerFactory.getLogger;
@Component
(
immediate
=
true
)
@Service
public
class
PortStatisticsManager
implements
PortStatisticsService
{
private
final
Logger
log
=
getLogger
(
getClass
());
private
static
final
int
SECOND
=
1_000
;
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
DeviceService
deviceService
;
...
...
@@ -73,9 +76,9 @@ public class PortStatisticsManager implements PortStatisticsService {
public
Load
load
(
ConnectPoint
connectPoint
)
{
DataPoint
c
=
current
.
get
(
connectPoint
);
DataPoint
p
=
previous
.
get
(
connectPoint
);
if
(
c
!=
null
&&
p
!=
null
)
{
if
(
c
!=
null
&&
p
!=
null
&&
(
c
.
time
>
p
.
time
+
SECOND
)
)
{
return
new
DefaultLoad
(
c
.
stats
.
bytesSent
(),
p
.
stats
.
bytesSent
(),
(
int
)
(
c
.
time
-
p
.
time
)
/
1000
);
(
int
)
(
c
.
time
-
p
.
time
)
/
SECOND
);
}
return
null
;
}
...
...
Please
register
or
login
to post a comment