Skip to content

Commit

Permalink
Merge broke Sum
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacchella committed Apr 9, 2014
1 parent 9626946 commit adda52f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
5 changes: 4 additions & 1 deletion junit/jrds/TestSum.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import jrds.TestProbe.DummyProbe;
import jrds.graphe.Sum;
import jrds.mockobjects.Full;
import jrds.mockobjects.GenerateProbe;
import jrds.mockobjects.MokeProbe;
import jrds.store.ExtractInfo;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -72,7 +75,7 @@ public void getSum() throws Exception {
hl.addProbe(p);

ArrayList<String> glist = new ArrayList<String>();
glist.add(p.getGraphList().iterator().next().getQualifieName());
glist.add(p.getGraphList().iterator().next().getQualifiedName());
Sum s = new Sum("A sum test", glist);
s.configure(hl);
PlottableMap ppm = s.getCustomData();
Expand Down
19 changes: 16 additions & 3 deletions src/jrds/graphe/Sum.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jrds.graphe;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;

Expand Down Expand Up @@ -83,16 +84,28 @@ public void configure(long start, long end, long step) {
for(String name : graphList) {
GraphNode g = hl.getGraphById(name.hashCode());
logger.trace("Looking for " + name + " in graph base, and found " + g);
if(g == null) {
logger.error("Graph not found: " + name);
continue;
}

try {
dp = g.getPlottedDate(ei);
} catch (IOException e) {
logger.error("Failed to read " + g.getProbe());
continue;
}

if(g != null) {
fd = g.getProbe().fetchData(ConsolFun.AVERAGE, start, end, step);
g.getProbe().fetchData().fill(dp, ei);

//First pass, no data to use
if(allvalues == null) {
allvalues = (double[][]) fd.getValues().clone();
allvalues = (double[][]) dp.getValues().clone();
}
//Next step, sum previous values
else {
double[][] tempallvalues = fd.getValues();
double[][] tempallvalues = dp.getValues();
for(int c = 0 ; c < tempallvalues.length ; c++) {
for(int r = 0 ; r < tempallvalues[c].length; r++) {
double v = tempallvalues[c][r];
Expand Down
1 change: 1 addition & 0 deletions src/jrds/probe/ContainerProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Map;

import jrds.HostInfo;
import jrds.JrdsSample;
import jrds.Probe;
import jrds.ProbeDesc;
import jrds.store.EmptyExtractor;
Expand Down

0 comments on commit adda52f

Please sign in to comment.