public int weight(Pipe p) { if (weights[p.id]==0) { int result = (int)p.config().slabBits(); //returns the max pipe length from this pipe or any of the pipes that feed its producer. //if this value turns out to be large then we should probably not join these two stages. int producerId = GraphManager.getRingProducerId(graphManager, p.id); if (producerId>=0) { PronghornStage producer = GraphManager.getStage(graphManager, producerId); int count = GraphManager.getInputPipeCount(graphManager, producer); while (--count>=0) { Pipe inputPipe = GraphManager.getInputPipe(graphManager, producer, count); result = Math.max(result, inputPipe.config().slabBits()); } } else { //no producer found, an external thread must be pushing data into this, there is nothing to combine it with } weights[p.id] = result; } return weights[p.id]; }
public int weight(Pipe p) { if (weights[p.id]==0) { int result = (int)p.config().slabBits(); //returns the max pipe length from this pipe or any of the pipes that feed its producer. //if this value turns out to be large then we should probably not join these two stages. int producerId = GraphManager.getRingProducerId(graphManager, p.id); if (producerId>=0) { PronghornStage producer = GraphManager.getStage(graphManager, producerId); int count = GraphManager.getInputPipeCount(graphManager, producer); while (--count>=0) { Pipe inputPipe = GraphManager.getInputPipe(graphManager, producer, count+1); result = Math.max(result, inputPipe.config().slabBits()); } } else { //no producer found, an external thread must be pushing data into this, there is nothing to combine it with } weights[p.id] = result; } return weights[p.id]; }