/** * {@inheritDoc} */ @Override protected void processData(DefaultData defaultData, EntityManager entityManager) { SqlStatementData sqlStatementData = (SqlStatementData) defaultData; sqlStatementData.setExclusiveCount(1L); sqlStatementData.setExclusiveDuration(sqlStatementData.getDuration()); sqlStatementData.calculateExclusiveMax(sqlStatementData.getDuration()); sqlStatementData.calculateExclusiveMin(sqlStatementData.getDuration()); }
break; currentDurationSum += sqlStatementData.getDuration();
/** * Processes all the {@link SqlStatementData}s in the given invocations creating the list of the * existing statement and calculating the total duration of the statements. * * @param invocationSequenceDataList * Input as list of invocations * @param sqlStatementDataList * List where results will be stored. Needed because of reflection. * @param totalDuration * {@link MutableDouble} where total duration will be stored. */ public static void collectSqlsInInvocations(List<InvocationSequenceData> invocationSequenceDataList, List<SqlStatementData> sqlStatementDataList, MutableDouble totalDuration) { for (InvocationSequenceData invocationSequenceData : invocationSequenceDataList) { if (null != invocationSequenceData.getSqlStatementData()) { sqlStatementDataList.add(invocationSequenceData.getSqlStatementData()); totalDuration.add(invocationSequenceData.getSqlStatementData().getDuration()); } if (CollectionUtils.isNotEmpty(invocationSequenceDataList)) { collectSqlsInInvocations(invocationSequenceData.getNestedSequences(), sqlStatementDataList, totalDuration); } } }
assertThat(sqlData.getTimeStamp(), is(not(nullValue()))); assertThat(sqlData.getCount(), is(1L)); assertThat(sqlData.getDuration(), is(secondTimerValue - firstTimerValue)); assertThat(sqlData.getMin(), is(secondTimerValue - firstTimerValue)); assertThat(sqlData.getMax(), is(secondTimerValue - firstTimerValue));
assertThat(sqlData.getTimeStamp(), is(not(nullValue()))); assertThat(sqlData.getCount(), is(1L)); assertThat(sqlData.getDuration(), is(secondTimerValue - firstTimerValue)); assertThat(sqlData.getMin(), is(secondTimerValue - firstTimerValue)); assertThat(sqlData.getMax(), is(secondTimerValue - firstTimerValue));
/** * Calculates the duration starting from this invocation sequence data element. Includes span * duration as last resource if the span ident exists on the data. * * @param data * the <code>InvocationSequenceData</code> object. * @param spanService * Span service providing the additional span information if needed. * @return the duration starting from this invocation sequence data element. */ public static double calculateDuration(InvocationSequenceData data, ISpanService spanService) { if (InvocationSequenceDataHelper.hasTimerData(data)) { return data.getTimerData().getDuration(); } else if (InvocationSequenceDataHelper.hasSQLData(data)) { return data.getSqlStatementData().getDuration(); } else if ((null != spanService) && hasSpanIdent(data)) { Span span = spanService.get(data.getSpanIdent()); if ((span != null) && !References.FOLLOWS_FROM.equals(span.getReferenceType())) { return span.getDuration(); } } if (InvocationSequenceDataHelper.isRootElementInSequence(data)) { return data.getDuration(); } return -1.0d; }
return new StyledString(NumberFormatter.formatDouble(data.getMax(), timeDecimalPlaces)); case DURATION: return new StyledString(NumberFormatter.formatDouble(data.getDuration(), timeDecimalPlaces)); case PREPARED: if (data.isPreparedStatement()) {
return new StyledString(NumberFormatter.formatDouble(data.getMax(), timeDecimalPlaces)); case DURATION: return new StyledString(NumberFormatter.formatDouble(data.getDuration(), timeDecimalPlaces)); default: return new StyledString("error");
exclusiveDurationDelta += child.getSqlStatementData().getDuration(); } else { exclusiveDurationDelta += InvocationSequenceDataHelper.computeNestedDuration(child);
return new StyledString(NumberFormatter.formatDouble(data.getMax())); case DURATION: return new StyledString(NumberFormatter.formatDouble(data.getDuration())); case PREPARED: if (rawMode) {