private TableModel sort( final TableModel tableModel, final List<SortConstraint> sortConstraints ) { logger.debug( "Sorting by " + sortConstraints ); PerformanceLoggingStopWatch stopWatch = this.performanceMonitorContext.createStopWatch( PerformanceTags.REPORT_QUERY_SORT ); stopWatch.start(); try { return new SortingTableModel( new MetaNormalizedTableModel( tableModel ), sortConstraints ); } finally { stopWatch.close(); } }
@Test public void performQueryDataTest() throws ReportDataFactoryException { PerformanceLoggingStopWatch stopWatch = Mockito.mock(PerformanceLoggingStopWatch.class); Mockito.doNothing().when(stopWatch).stop(); Mockito.doAnswer(new Answer() { @Override return null; }).when(stopWatch).close(); Mockito.doNothing().when(stopWatch).start(); Mockito.when(performanceMonitorContext.createStopWatch(Mockito.eq(PerformanceTags.REPORT_QUERY), Mockito.any())).thenReturn(stopWatch); DataFactory dataFactory = Mockito.mock(DataFactory.class); order.verify(stopWatch).start(); order.verify(stopWatch).stop();
public static PerformanceLoggingStopWatch startNew( final String tag, final Object message ) { PerformanceLoggingStopWatch loggingStopWatch = new LoggingStopWatch( tag, message ); loggingStopWatch.start(); return loggingStopWatch; }
public void close() { stopWatch.close(); } }
public void initializePerformanceMonitoring( final PerformanceMonitorContext monitorContext ) { summaryWatch.stop(); eventWatch.stop(); summaryWatch = monitorContext.createStopWatch( PerformanceTags.getSummaryTag( PerformanceTags.REPORT_LAYOUT_PROCESS_SUFFIX, getClass().getSimpleName() ) ); eventWatch = monitorContext.createStopWatch( PerformanceTags.getDetailTag( PerformanceTags.REPORT_LAYOUT_PROCESS_SUFFIX, getClass().getSimpleName() ) ); }
sw.start(); getPerformanceMonitorContext().createStopWatch( PerformanceTags.REPORT_PREPARE_DATA ); try { preDataSw.start(); state = processPaginationLevel( state, stateList, maxRows ); } else { preDataSw.start(); state = processPrepareLevels( state, maxRows ); preDataSw.stop( true ); preDataSw.close(); sw.close();
public static PerformanceLoggingStopWatch startNew(final String tag, final Object message) { PerformanceLoggingStopWatch loggingStopWatch = new LoggingStopWatch(tag, message); loggingStopWatch.start(); return loggingStopWatch; }
public void stateChanged( final ChangeEvent e ) { stopWatch.close(); } }
@Override public Object answer(InvocationOnMock invocation) throws Throwable { ((PerformanceLoggingStopWatch) invocation.getMock()).stop(); return null; } }).when(stopWatch).close();
getPerformanceMonitorContext().createStopWatch( PerformanceTags.REPORT_PROCESSING ); try { swGlobal.start(); if ( AbstractReportProcessor.logger.isDebugEnabled() ) { AbstractReportProcessor.logger.debug( new MemoryUsageMessage( System.identityHashCode( Thread.currentThread() ) getPerformanceMonitorContext().createStopWatch( PerformanceTags.REPORT_GENERATE ); try { sw.start(); final long paginateTime = System.currentTimeMillis(); if ( AbstractReportProcessor.logger.isDebugEnabled() ) { sw.close(); swGlobal.close();
public void restart( final ReportState state ) throws ReportProcessingException { try { stopWatch.start(); if ( inlineDataRowRuntime == null ) { inlineDataRowRuntime = new InlineDataRowRuntime(); } inlineDataRowRuntime.setState( state ); final ExpressionRuntime oldRuntime; final OutputFunction outputFunction = getOutputFunction(); if ( outputFunction != null ) { oldRuntime = outputFunction.getRuntime(); outputFunction.setRuntime( inlineDataRowRuntime ); } else { oldRuntime = null; } try { if ( outputFunction != null ) { outputFunction.restart( state ); } } finally { if ( outputFunction != null ) { outputFunction.setRuntime( oldRuntime ); } } } finally { stopWatch.stop( true ); } }
private ProcessState performStructuralPreprocessing( final ProcessState startState, final DefaultProcessingContext processingContext ) throws ReportProcessingException { PerformanceLoggingStopWatch sw = getPerformanceMonitorContext().createStopWatch( PerformanceTags.REPORT_PREPARE_CROSSTAB ); try { sw.start(); processingContext.setProcessingLevel( LayoutProcess.LEVEL_STRUCTURAL_PREPROCESSING ); processingContext.setProgressLevel( -1 ); final int maxRows = startState.getNumberOfRows(); ProcessState state = processPrepareLevels( startState, maxRows ); if ( state.isFinish() ) { state = state.restart(); } else { throw new IllegalStateException( "Repaginate did not produce an finish state" ); } return state; } finally { sw.close(); } }
public void close() { super.close(); paragraphLayoutWatch.close(); }
protected boolean startParagraphBox( final RenderBox box ) { if ( box.getNodeType() != LayoutNodeTypes.TYPE_BOX_PARAGRAPH ) { return true; } final ParagraphRenderBox paragraphBox = (ParagraphRenderBox) box; if ( paragraphBox.isLineBoxUnchanged() ) { nodeContext.updateX2( paragraphBox.getCachedMaxChildX2() ); return false; } paragraphLayoutWatch.start(); try { paragraphBox.clearLayout(); textMinorAxisLayoutStep.process( paragraphBox, getNodeContext(), getPageGrid() ); paragraphBox.updateMinorLayoutAge(); paragraphBox.setCachedMaxChildX2( nodeContext.getMaxChildX2() ); } finally { paragraphLayoutWatch.stop( true ); } return false; }
public void fireReportEvent( final ReportEvent event ) { try { stopWatch.start(); if ( inlineDataRowRuntime == null ) { inlineDataRowRuntime = new InlineDataRowRuntime(); } final ReportState state = inlineDataRowRuntime.getState(); inlineDataRowRuntime.setState( event.getState() ); try { final int pageEventMask = ReportEvent.PAGE_STARTED | ReportEvent.PAGE_FINISHED; if ( ( event.getType() & pageEventMask ) == 0 && ( ( event.getType() & ReportEvent.GROUP_BODY_FINISHED ) == ReportEvent.GROUP_BODY_FINISHED ) ) { fireGroupBodyFinishedEvent( event ); } else { super.fireReportEvent( event ); } } catch ( InvalidReportStateException exception ) { throw exception; } catch ( Throwable t ) { throw new InvalidReportStateException( "Failed to fire report event for sub-layout-process", t ); } finally { inlineDataRowRuntime.setState( state ); } } finally { stopWatch.stop( true ); } }