-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetrics.java
52 lines (41 loc) · 899 Bytes
/
Metrics.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public class Metrics{
private int sent;
private int received;
private int RTTs;
public Metrics(){
reset();
}
public void reset(){
sent = 0;
received = 0;
RTTs = 0;
}
public int getSent(){
return sent;
}
public int getReceived(){
return received;
}
public int getRTTs(){
return RTTs;
}
public void addSent(int n){
sent+=n;
}
public void addReceived(int n){
received+=n;
}
public void incRTTs(){
++RTTs;
}
public void decRTTs(){
--RTTs;
}
public String getMetricReport(){
StringBuilder sb = new StringBuilder("Metric Report\n");
sb.append("Received:" +getReceived()+"\n");
sb.append("Sent:" +getSent()+"\n");
sb.append("RTTs:" +getRTTs()+"\n");
return sb.toString();
}
}