Added chart with average routing metric
This commit is contained in:
parent
3017f92a55
commit
57ae779373
|
@ -26,16 +26,12 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: CollectServer.java,v 1.5 2010/12/07 22:46:13 adamdunkels Exp $
|
||||
*
|
||||
* -----------------------------------------------------------------
|
||||
*
|
||||
* CollectServer
|
||||
*
|
||||
* Authors : Joakim Eriksson, Niclas Finne
|
||||
* Created : 3 jul 2008
|
||||
* Updated : $Date: 2010/12/07 22:46:13 $
|
||||
* $Revision: 1.5 $
|
||||
*/
|
||||
|
||||
package se.sics.contiki.collect;
|
||||
|
@ -367,6 +363,44 @@ public class CollectServer implements SerialConnectionListener {
|
|||
return data.getValue(SensorData.RTMETRIC);
|
||||
}
|
||||
},
|
||||
new AggregatedTimeChartPanel<boolean[]>(this, NETWORK, "Avg Routing Metric (Over Time)", "Time",
|
||||
"Average Routing Metric") {
|
||||
private int nodeCount;
|
||||
{
|
||||
ValueAxis axis = chart.getXYPlot().getRangeAxis();
|
||||
((NumberAxis)axis).setAutoRangeIncludesZero(true);
|
||||
axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
|
||||
}
|
||||
@Override
|
||||
protected boolean[] createState(Node node) {
|
||||
return new boolean[1];
|
||||
}
|
||||
@Override
|
||||
protected void clearState(Map<Node,boolean[]> map) {
|
||||
nodeCount = 0;
|
||||
for(boolean[] value : map.values()) {
|
||||
value[0] = false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected String getTitle(int selectedCount, int dataCount, int duplicateCount) {
|
||||
return "Average Routing Metric (" + dataCount + " packets from " + nodeCount + " node"
|
||||
+ (nodeCount > 1 ? "s" : "") + ')';
|
||||
}
|
||||
@Override
|
||||
protected int getTotalDataValue(int value) {
|
||||
// Return average value
|
||||
return nodeCount > 0 ? (value / nodeCount) : value;
|
||||
}
|
||||
@Override
|
||||
protected int getSensorDataValue(SensorData data, boolean[] nodeState) {
|
||||
if (!nodeState[0]) {
|
||||
nodeCount++;
|
||||
nodeState[0] = true;
|
||||
}
|
||||
return data.getValue(SensorData.RTMETRIC);
|
||||
}
|
||||
},
|
||||
new TimeChartPanel(this, NETWORK, "ETX (Over Time)", "ETX to Next Hop", "Time", "ETX") {
|
||||
{
|
||||
ValueAxis axis = chart.getXYPlot().getRangeAxis();
|
||||
|
|
|
@ -26,16 +26,12 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: AggregatedTimeChartPanel.java,v 1.1 2010/11/03 14:53:05 adamdunkels Exp $
|
||||
*
|
||||
* -----------------------------------------------------------------
|
||||
*
|
||||
* PacketChartPanel
|
||||
*
|
||||
* Authors : Joakim Eriksson, Niclas Finne
|
||||
* Created : 6 sep 2010
|
||||
* Updated : $Date: 2010/11/03 14:53:05 $
|
||||
* $Revision: 1.1 $
|
||||
*/
|
||||
|
||||
package se.sics.contiki.collect.gui;
|
||||
|
@ -175,7 +171,7 @@ public abstract class AggregatedTimeChartPanel<T> extends JPanel implements Visu
|
|||
series.add(new Minute(new Date((minute - 1) * 60000L)), 0);
|
||||
}
|
||||
}
|
||||
series.add(new Minute(new Date(minute * 60000L)), count);
|
||||
series.add(new Minute(new Date(minute * 60000L)), getTotalDataValue(count));
|
||||
count = 0;
|
||||
lastMinute = minute + 1;
|
||||
minute = min;
|
||||
|
@ -198,6 +194,10 @@ public abstract class AggregatedTimeChartPanel<T> extends JPanel implements Visu
|
|||
protected void clearState(Map<Node,T> map) {
|
||||
}
|
||||
|
||||
protected int getTotalDataValue(int value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
protected abstract int getSensorDataValue(SensorData sd, T nodeState);
|
||||
|
||||
public boolean getBaseShapeVisible() {
|
||||
|
|
Loading…
Reference in a new issue