Package org.apache.uima.util

Examples of org.apache.uima.util.ProcessTraceEvent


    pt2.addEvent("c2", "t2", "testing", 500, "success");
    pt2.endEvent("c2", "t1", "success");
    pt2.addEvent("c1", "t1", "testing", 250, "success");

    pt1.aggregate(pt2);
    ProcessTraceEvent c1evt = (ProcessTraceEvent) pt1.getEvents().get(0);
    ProcessTraceEvent c2evt = (ProcessTraceEvent) pt1.getEvents().get(1);
    ProcessTraceEvent c2subEvt = (ProcessTraceEvent) c2evt.getSubEvents().get(0);
    Assert.assertEquals(1250, c1evt.getDuration());
    Assert.assertEquals(1000, c2subEvt.getDuration());
  }
View Full Code Here


    int tabCnt = tCnt;
    for (int j = 0; j < tabCnt; j++) {
      tabS = tabS + "\t";
    }
    for (int i = 0; i < lst.size(); i++) {
      ProcessTraceEvent prEvent = (ProcessTraceEvent) lst.get(i);
      compNameS = prEvent.getComponentName();
      typeS = prEvent.getType();
      dur = prEvent.getDurationExcludingSubEvents();
      totDur = prEvent.getDuration();
      subEveList = prEvent.getSubEvents();
      if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(Checkpoint.class).log(
                Level.FINEST,
                tabS + "COMPONENT : " + compNameS + "\tTYPE : " + typeS + "\tDescription : "
                        + prEvent.getDescription());
        UIMAFramework.getLogger(Checkpoint.class).log(Level.FINEST,
                tabS + "TOTAL_TIME : " + totDur + "\tTIME_EXCLUDING_SUBEVENTS : " + dur);
      }
      if (subEveList != null) {
        printEveList(subEveList, (tabCnt + 1));
View Full Code Here

   *
   */
  private void copyComponentEvents(String aEvType, List aList, ProcessTrace aPTr)
          throws IOException {
    for (int i = 0; i < aList.size(); i++) {
      ProcessTraceEvent prEvent = (ProcessTraceEvent) aList.get(i);
      if (aEvType != null && aEvType.equals(prEvent.getType())) {
        aPTr.addEvent(prEvent);
      }
    }

  }
View Full Code Here

    }
    // count total time
    int totalTime = 0;
    Iterator it = aProcessTrace.getEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      // Dont add total time the CPM ran for. Just add all of the times of all components to
      // get the time.
      if ("CPM".equals(event.getComponentName())) {
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).log(
                  Level.FINEST,
                  "Current Component::" + event.getComponentName() + " Time::"
                          + event.getDuration());
        }
        continue;
      }
      if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                "Current Component::" + event.getComponentName());
      }
      totalTime += event.getDuration();
    }
    float totalTimeSeconds = (float) totalTime / 1000;
    if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
      UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
              "Total Time: " + totalTimeSeconds + " seconds");
    }

    // create root tree node
    if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
      UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
              "100% (" + totalTime + "ms) - Collection Processing Engine");
    }
    // build tree
    it = aProcessTrace.getEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      buildEventTree(event, totalTime);
    }
  }
View Full Code Here

              Level.FINEST,
              "" + pct + "% (" + duration + "ms) - " + aEvent.getComponentName() + " (" + type
                      + ")");
    Iterator it = aEvent.getSubEvents().iterator();
    while (it.hasNext()) {
      ProcessTraceEvent event = (ProcessTraceEvent) it.next();
      buildEventTree(event, aTotalTime);
    }
  }
View Full Code Here

      try {
        synchronized (procTr) {
          List eventList = procTr.getEvents();

          for (int j = 0; eventList != null && j < eventList.size(); j++) {
            ProcessTraceEvent prEvent = (ProcessTraceEvent) eventList.get(j);
            processTrace.addEvent(prEvent);
          }
        }
        return processTrace;
      } catch (Exception e) {
View Full Code Here

      }
      synchronized (srcProcTr) {

        List eventList = srcProcTr.getEventsByComponentName(name, false);
        for (int j = 0; j < eventList.size(); j++) {
          ProcessTraceEvent prEvent = (ProcessTraceEvent) eventList.get(j);
          aProcessTrace.addEvent(prEvent);
        }
      }
    }
  }
View Full Code Here

   */
  public synchronized static long extractTime(ProcessTrace aPT, String eventName) {
    List aList = aPT.getEvents();
    int counter = 0;
    while (aList != null && aList.size() > 0 && counter < aList.size()) {
      ProcessTraceEvent pte = (ProcessTraceEvent) aList.get(counter++);
      if (pte == null) {
        return 0;
      } else if (eventName == null || eventName.equals(pte.getDescription())) {
        return pte.getDurationExcludingSubEvents();
      } else {
        List subEvents = pte.getSubEvents();
        for (int i = 0; subEvents != null && i < subEvents.size(); i++) {

          if (eventName.equals(((ProcessTraceEvent) subEvents.get(i)).getType())) {
            return ((ProcessTraceEvent) subEvents.get(i)).getDurationExcludingSubEvents();
          }
View Full Code Here

   *          event container
   */
  public static void dumpEvents(ProcessTrace aPTr) {
    List aList = aPTr.getEvents();
    for (int i = 0; i < aList.size(); i++) {
      ProcessTraceEvent prEvent = (ProcessTraceEvent) aList.get(i);
      String aEvType = prEvent.getType();
      if (System.getProperty("DEBUG_EVENTS") != null) {
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(CPMUtils.class).log(
                  Level.FINEST,
                  "Returning Report With Event::" + aEvType + " For Component:::"
                          + prEvent.getComponentName() + " Duration:::"
                          + prEvent.getDurationExcludingSubEvents());
        }
      }
    }

  }
View Full Code Here

        }
        if (logCas) {
          String ip = "no IP";
          List eList = aStatus.getProcessTrace().getEventsByComponentName("UimaEE", false);
          for (int e = 0; e < eList.size(); e++) {
            ProcessTraceEvent event = (ProcessTraceEvent) eList.get(e);
            if (event.getDescription().equals("Service IP")) {
              ip = event.getResultMessage();
            }
          }
          String casId = ((UimaASProcessStatus) aStatus).getCasReferenceId();
          if (casId != null) {
            long current = System.nanoTime() / 1000000 - mStartTime;
View Full Code Here

TOP

Related Classes of org.apache.uima.util.ProcessTraceEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.