@Test public void testCumulativeCalculation() { RelationalNode[] children = new RelationalNode[2]; children[0] = createFakeNode(createData(1)); children[1] = createFakeNode(createData(1)); children[0].getNodeStatistics().setBatchEndTime(100); children[0].getNodeStatistics().collectCumulativeNodeStats(0l, RelationalNodeStatistics.BATCHCOMPLETE_STOP); children[0].getNodeStatistics().collectNodeStats(new RelationalNode[0]); children[1].getNodeStatistics().setBatchEndTime(200); children[1].getNodeStatistics().collectCumulativeNodeStats(0l, RelationalNodeStatistics.BATCHCOMPLETE_STOP); children[1].getNodeStatistics().collectNodeStats(new RelationalNode[0]); RelationalNodeStatistics stats = new RelationalNodeStatistics(); stats.setBatchEndTime(1000); stats.setBatchStartTime(0); stats.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); stats.collectNodeStats(children); assertEquals(1000, stats.getNodeCumulativeProcessingTime()); assertEquals(700, stats.getNodeNextBatchProcessingTime()); }
@Test public void testBatchTimer() { RelationalNodeStatistics testnodeStatistics = new RelationalNodeStatistics(); testnodeStatistics.startBatchTimer(); assertTrue("The batch timer did not yield a start time", testnodeStatistics.getBatchStartTime()!= 0); //$NON-NLS-1$ testnodeStatistics.stopBatchTimer(); assertTrue("The batch timer did not yield an end time", testnodeStatistics.getBatchEndTime()!= 0); //$NON-NLS-1$ }
public void collectNodeStats(RelationalNode[] relationalNodes) { // set nodeEndTime to the time gathered at the end of the last batch this.nodeEndTime = this.batchEndTime; this.nodeCumulativeProcessingTime = this.nodeEndTime - this.nodeStartTime; this.nodeNextBatchProcessingTime = this.nodeCumulativeNextBatchProcessingTime; for (int i = 0; i < relationalNodes.length; i++) { if (relationalNodes[i] == null) { break; } this.nodeNextBatchProcessingTime -= relationalNodes[i].getNodeStatistics().getNodeCumulativeNextBatchProcessingTime(); } }
this.getProcessingState().nodeStatistics.startBatchTimer(); this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats((long)batch.getRowCount(), RelationalNodeStatistics.BATCHCOMPLETE_STOP); if (batch.getTerminationFlag()) { this.getProcessingState().nodeStatistics.collectNodeStats(this.getChildren()); if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); recordStats = false; } finally { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer();
public void initialize(CommandContext context, BufferManager bufferManager, ProcessorDataManager dataMgr) { this.getProcessingState().context = context; this.getProcessingState().bufferManager = bufferManager; this.getProcessingState().dataMgr = dataMgr; if(context.getCollectNodeStatistics()) { this.getProcessingState().nodeStatistics = new RelationalNodeStatistics(); } if (getOutputElements() != null) { this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(getOutputElements()); } else { this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(); } }
public PlanNode getDescriptionProperties() { // Default implementation - should be overridden PlanNode result = new PlanNode(getClassName()); result.addProperty(PROP_ID, String.valueOf(getID())); result.addProperty(PROP_OUTPUT_COLS, AnalysisRecord.getOutputColumnProperties(this.data.elements)); if(this.getProcessingState().context != null && this.getProcessingState().context.getCollectNodeStatistics()) { result.addProperty(PROP_NODE_STATS_LIST, this.getProcessingState().nodeStatistics.getStatisticsList()); } List<String> costEstimates = this.getCostEstimates(); if(costEstimates != null) { result.addProperty(PROP_NODE_COST_ESTIMATES, costEstimates); } for(int i=0; i<children.length; i++) { if(children[i] != null) { result.addProperty("Child " + i, this.children[i].getDescriptionProperties()); //$NON-NLS-1$ } } return result; }
this.getProcessingState().nodeStatistics.startBatchTimer(); if (recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(buffer.getRowCount(), RelationalNodeStatistics.BATCHCOMPLETE_STOP); this.getProcessingState().nodeStatistics.collectNodeStats(this.getChildren()); if (LogManager.isMessageToBeRecorded(org.teiid.logging.LogConstants.CTX_DQP, MessageLevel.TRACE) && !buffer.isForwardOnly()) { for (long i = 1; i <= buffer.getRowCount(); i+=buffer.getBatchSize()) { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); recordStats = false; } finally { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer();
public void initialize(CommandContext context, BufferManager bufferManager, ProcessorDataManager dataMgr) { this.getProcessingState().context = context; this.getProcessingState().bufferManager = bufferManager; this.getProcessingState().dataMgr = dataMgr; if(context.getCollectNodeStatistics()) { this.getProcessingState().nodeStatistics = new RelationalNodeStatistics(); } if (getOutputElements() != null) { this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(getOutputElements()); } else { this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(); } }
public PlanNode getDescriptionProperties() { // Default implementation - should be overridden PlanNode result = new PlanNode(getClassName()); result.addProperty(PROP_ID, String.valueOf(getID())); result.addProperty(PROP_OUTPUT_COLS, AnalysisRecord.getOutputColumnProperties(this.data.elements)); if(this.getProcessingState().context != null && this.getProcessingState().context.getCollectNodeStatistics()) { result.addProperty(PROP_NODE_STATS_LIST, this.getProcessingState().nodeStatistics.getStatisticsList()); } List<String> costEstimates = this.getCostEstimates(); if(costEstimates != null) { result.addProperty(PROP_NODE_COST_ESTIMATES, costEstimates); } for(int i=0; i<children.length; i++) { if(children[i] != null) { result.addProperty("Child " + i, this.children[i].getDescriptionProperties()); //$NON-NLS-1$ } } return result; }
this.getProcessingState().nodeStatistics.startBatchTimer(); if (recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(buffer.getRowCount(), RelationalNodeStatistics.BATCHCOMPLETE_STOP); this.getProcessingState().nodeStatistics.collectNodeStats(this.getChildren()); if (LogManager.isMessageToBeRecorded(org.teiid.logging.LogConstants.CTX_DQP, MessageLevel.TRACE) && !buffer.isForwardOnly()) { for (long i = 1; i <= buffer.getRowCount(); i+=buffer.getBatchSize()) { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); recordStats = false; } finally { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer();
public void initialize(CommandContext context, BufferManager bufferManager, ProcessorDataManager dataMgr) { this.getProcessingState().context = context; this.getProcessingState().bufferManager = bufferManager; this.getProcessingState().dataMgr = dataMgr; if(context.getCollectNodeStatistics()) { this.getProcessingState().nodeStatistics = new RelationalNodeStatistics(); } if (getOutputElements() != null) { this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(getOutputElements()); } else { this.getProcessingState().batchSize = bufferManager.getProcessorBatchSize(); } }
public void collectNodeStats(RelationalNode[] relationalNodes) { // set nodeEndTime to the time gathered at the end of the last batch this.nodeEndTime = this.batchEndTime; this.nodeCumulativeProcessingTime = this.nodeEndTime - this.nodeStartTime; this.nodeNextBatchProcessingTime = this.nodeCumulativeNextBatchProcessingTime; for (int i = 0; i < relationalNodes.length; i++) { if (relationalNodes[i] == null) { break; } this.nodeNextBatchProcessingTime -= relationalNodes[i].getNodeStatistics().getNodeCumulativeNextBatchProcessingTime(); } }
public PlanNode getDescriptionProperties() { // Default implementation - should be overridden PlanNode result = new PlanNode(getClassName()); result.addProperty(PROP_ID, String.valueOf(getID())); result.addProperty(PROP_OUTPUT_COLS, AnalysisRecord.getOutputColumnProperties(this.data.elements)); if(this.getProcessingState().context != null && this.getProcessingState().context.getCollectNodeStatistics()) { result.addProperty(PROP_NODE_STATS_LIST, this.getProcessingState().nodeStatistics.getStatisticsList()); } List<String> costEstimates = this.getCostEstimates(); if(costEstimates != null) { result.addProperty(PROP_NODE_COST_ESTIMATES, costEstimates); } for(int i=0; i<children.length; i++) { if(children[i] != null) { result.addProperty("Child " + i, this.children[i].getDescriptionProperties()); //$NON-NLS-1$ } } return result; }
this.getProcessingState().nodeStatistics.startBatchTimer(); this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats((long)batch.getRowCount(), RelationalNodeStatistics.BATCHCOMPLETE_STOP); if (batch.getTerminationFlag()) { this.getProcessingState().nodeStatistics.collectNodeStats(this.getChildren()); if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); recordStats = false; } finally { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer();
public void collectNodeStats(RelationalNode[] relationalNodes) { // set nodeEndTime to the time gathered at the end of the last batch this.nodeEndTime = this.batchEndTime; this.nodeCumulativeProcessingTime = this.nodeEndTime - this.nodeStartTime; this.nodeNextBatchProcessingTime = this.nodeCumulativeNextBatchProcessingTime; for (int i = 0; i < relationalNodes.length; i++) { if (relationalNodes[i] == null) { break; } this.nodeNextBatchProcessingTime -= relationalNodes[i].getNodeStatistics().getNodeCumulativeNextBatchProcessingTime(); } }
this.getProcessingState().nodeStatistics.startBatchTimer(); if (recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(buffer.getRowCount(), RelationalNodeStatistics.BATCHCOMPLETE_STOP); this.getProcessingState().nodeStatistics.collectNodeStats(this.getChildren()); if (LogManager.isMessageToBeRecorded(org.teiid.logging.LogConstants.CTX_DQP, MessageLevel.TRACE) && !buffer.isForwardOnly()) { for (long i = 1; i <= buffer.getRowCount(); i+=buffer.getBatchSize()) { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); recordStats = false; } finally { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer();
this.getProcessingState().nodeStatistics.startBatchTimer(); this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats((long)batch.getRowCount(), RelationalNodeStatistics.BATCHCOMPLETE_STOP); if (batch.getTerminationFlag()) { this.getProcessingState().nodeStatistics.collectNodeStats(this.getChildren()); if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer(); this.getProcessingState().nodeStatistics.collectCumulativeNodeStats(null, RelationalNodeStatistics.BLOCKEDEXCEPTION_STOP); recordStats = false; } finally { if(recordStats) { this.getProcessingState().nodeStatistics.stopBatchTimer();