/** * @see org.apache.uima.util.ProcessTrace#toString() */ public String toString() { // count total time so we can do percentages int totalTime = 0; for (ProcessTraceEvent event : mEventList) { totalTime += event.getDuration(); } // go back through and generate string StringBuffer buf = new StringBuffer(); for (ProcessTraceEvent event : mEventList) { event.toString(buf, 0, totalTime); } return buf.toString(); }
typeS = prEvent.getType(); dur = prEvent.getDurationExcludingSubEvents(); totDur = prEvent.getDuration(); subEveList = prEvent.getSubEvents(); if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
public AnalysisEnginePerformanceReports(ProcessTrace aProcessTrace) { mProcessTrace = aProcessTrace; pctFormat = NumberFormat.getPercentInstance(); pctFormat.setMaximumFractionDigits(2); for (ProcessTraceEvent evt : aProcessTrace.getEvents()) { if (ProcessTraceEvent.ANALYSIS_ENGINE.equals(evt.getType()) || ProcessTraceEvent.SERVICE_CALL.equals(evt.getType())) { mTotalTime += evt.getDuration(); } addEventData(evt); } }
/** * @see org.apache.uima.util.ProcessTraceEvent#getDurationExcludingSubEvents() */ public int getDurationExcludingSubEvents() { int result = getDuration(); for (ProcessTraceEvent evt : getSubEvents()) { result -= evt.getDuration(); } return result; }
while (it.hasNext()) { ProcessTraceEvent event = (ProcessTraceEvent) it.next(); totalTime += event.getDuration();
public void collectionProcessComplete() { if (logger != null) logger.logString(df.format(new Date()) + "\tCollection completed"); synchronized (this) { if (this.isProcessing) { this.notify(); if (logger != null) { StringBuilder reportContent = new StringBuilder(); for (ProcessTraceEvent event : mCPE.getPerformanceReport().getEvents()) { String componentName = event.getComponentName(); componentName = componentName.substring(componentName.lastIndexOf(".") + 1); String eventType = event.getType(); if (eventType.startsWith("End")) reportContent.append("\t\t" + event.getType() + "\t" + event.getDuration() + " ms\n"); else reportContent.append(componentName + "\t" + event.getType() + "\t" + event.getDuration() + " ms\n"); } this.logger.collectionProcessComplete(reportContent.toString()); } } this.isProcessing = false; } } }
reportContent += "Processing Time\t" + processingTime + "\t"; for (ProcessTraceEvent event : mCPE.getPerformanceReport().getEvents()) { reportContent += event.getComponentName() + "-" + event.getType() + "\t" + event.getDuration() + "\t";
for (int i = 0; i < aEventTypes.length; i++) { if (aEventTypes[i].equals(type)) { duration += evt.getDuration(); continue whileLoop;
long aTotalTime) { final DecimalFormat pctFmt = new DecimalFormat("##.##%"); long duration = aEvent.getDuration(); double pct; if (aTotalTime != 0) {
protected void addEventData(ProcessTraceEvent aEvent) { mAnalysisTime += aEvent.getDuration(); String componentName = aEvent.getComponentName(); mAnnotatorAnalysisTimes.put(componentName, aEvent.getDuration()); } else if (ProcessTraceEvent.ANALYSIS_ENGINE.equals(aEvent.getType())) { int duration = aEvent.getDuration(); int subEventDuration = getSubEventDuration(aEvent, subEventTypes); if (subEventDuration > 0) { int duration = aEvent.getDuration(); int subEventDuration = getSubEventDuration(aEvent, subEventTypes); if (subEventDuration > 0) { int duration = aEvent.getDuration(); int subEventDuration = getSubEventDuration(aEvent, subEventTypes); if (subEventDuration > 0) {
/** * Helper method to help build the CPM report. * * @param aEvent the a event * @param aTotalTime the a total time */ public void buildEventTree(ProcessTraceEvent aEvent, int aTotalTime) { // Skip reporting the CPM time.This time has already been acquired by summing up // times from all individual components if ("CPM".equals(aEvent.getComponentName())) { return; } int duration = aEvent.getDuration(); float pct = (float) ((duration * 100 * 10) / aTotalTime) / 10; String type = (String) mEventTypeMap.get(aEvent.getType()); if (type == null) { type = aEvent.getType(); } if (System.getProperty("DEBUG") != null) UIMAFramework.getLogger(this.getClass()).log( Level.FINEST, "" + pct + "% (" + duration + "ms) - " + aEvent.getComponentName() + " (" + type + ")"); Iterator it = aEvent.getSubEvents().iterator(); while (it.hasNext()) { ProcessTraceEvent event = (ProcessTraceEvent) it.next(); buildEventTree(event, aTotalTime); } }
Level.FINEST, "Current Component::" + event.getComponentName() + " Time::" + event.getDuration()); "Current Component::" + event.getComponentName()); totalTime += event.getDuration();