Package edu.berkeley.xtrace.reporting

Examples of edu.berkeley.xtrace.reporting.Report


      Text t;
      BytesWritable bw;
     
      if(k instanceof ChukwaArchiveKey && v instanceof ChunkImpl) {
        ChunkImpl value = (ChunkImpl) v;
        Report xtrReport = Report.createFromString(new String(value.getData()));
      
        try {    //we do this to handle the case where not all input is x-trace
          bw = new BytesWritable(xtrReport.getMetadata().getTaskId().get());
        } catch(Exception e) {
          unparseableReport.increment(1);
          return;
        }
       
        //FIXME: can probably optimize the above lines by doing a search in the raw bytes
        t= new Text(value.getData());
      } else if(k instanceof ChukwaRecordKey && v instanceof ChukwaRecord){
        ChukwaRecord value = (ChukwaRecord) v;
        Report xtrReport = Report.createFromString(value.getValue(Record.bodyField));
        bw = new BytesWritable(xtrReport.getMetadata().getTaskId().get());
        //FIXME: can probably optimize the above lines by doing a search in the raw bytes
        t= new Text(value.getValue(Record.bodyField));
      } else {
        log.error("unexpected key/value types: "+ k.getClass().getCanonicalName()
            + " and " + v.getClass().getCanonicalName() );
View Full Code Here


      Counter dupCounter = context.getCounter("app", "duplicate report");

      int edgeCount = 0, dups = 0, numReports = 0;
     
      for(Text rep_text: values) {
        Report r = Report.createFromString(rep_text.toString());
        numReports++;
       
        if(numReports < MAX_IN_MEMORY_REPORTS) {
          if(reports.containsKey(r.getMetadata().getOpIdString()))
            dups++;
          reports.put(r.getMetadata().getOpIdString(), r);
        } else if(numReports == MAX_IN_MEMORY_REPORTS) {
          //bail out, prepare to do an external sort.
          return;
        } else
          ;
    //      do the external sort
      }
     
      reportCounter.increment(reports.size());
      dupCounter.increment(dups);
      CausalGraph g = new CausalGraph(reports);

      PtrReverse reverser = new PtrReverse();
      List<Report> sortedReports = g.topoSort(reverser);
      int sortedLen = sortedReports.size();
      if(sortedLen!= reports.size()) {
        if(sortedLen > 0)
           log.warn(taskIDString+": I only sorted " + sortedLen + " items, but expected "
            + reports.size()+", is your list cyclic?");
        else
          log.warn(taskIDString+": every event in graph has a predecessor; perhaps "
              + "the start event isn't in the input set?");
      }
      log.debug(taskIDString+": " + reverser.edgeCount + " total edges");
      edgeCounter.increment(reverser.edgeCount);
      badEdgeCounter.increment(reverser.badCount);
     
      Text[] finalOutput = new Text[sortedReports.size()];
      int i=0;
      for(Report r:sortedReports)
        finalOutput[i++] = new Text(r.toString());

      TextArrayWritable out = new TextArrayWritable();
      out.set(finalOutput);
      context.write(taskID, out);
      //Should sort values topologically and output list.  or?
View Full Code Here

      for(String inLink: r.get("Edge")) { 
        //sanitize data from old, nonconformant C++ implementation
        if(inLink.contains(","))
          inLink = inLink.substring(0, inLink.indexOf(','));
       
        Report parent = reports.get(inLink);
        if(parent != null) {
          parent.put(OUTLINK_FIELD, myOpID);
          parentCount++;
        } else { //no match
          if(!inLink.equals("0000000000000000"))  {
            log.info("no sign of parent: " + inLink);
            badCount++;
View Full Code Here

   
    HashSet<Report> predecessors = new HashSet<Report>();
    Queue<Report> bfsQ = new LinkedList<Report>();
    bfsQ.add(p);
    while(!bfsQ.isEmpty()) {
      Report r = bfsQ.remove();

      assert r!= null;
      predecessors.add(r);
      List<String> backEdges = r.get("Edge");
      if(backEdges != null)
        for(String pred:backEdges) {
          Report pre = reports.get(pred);
          if(pre != null)
            bfsQ.add(pre);
        }
    }
   
View Full Code Here

    //from report op ID to inlink count.
    //next step is to do a topological sort.

    ArrayList<Report> finalOutput = new ArrayList<Report>();
    while(!zeroInlinkReports.isEmpty()) {
      Report r = zeroInlinkReports.remove();
     
      List<String> outLinks =  r.get(XtrExtract.OUTLINK_FIELD);
      if(outLinks != null) {
        for(String outLink: outLinks) {
          Integer oldCount = counts.get(outLink);
          if(oldCount == null) {
            oldCount = 0//FIXME: can this happen?
View Full Code Here

    //if we have the reports in topological order, this should be easy.
    //Just take max of all predecessors seen until that point.
   
    //alternatively, could start at the end and walk backwards
    ArrayList<Report> backpath = new ArrayList<Report>();
    Report cur = reports.get(endID);
    do {
      backpath.add(cur);
     
      Report limitingPred = null;
      long latestPrereq = Long.MIN_VALUE;
     
      for(String predID: cur.get("Edge")) {
        Report pred = reports.get(predID);
        long finishTime = metric.dist(pred, cur);
        if( finishTime > latestPrereq) {
          latestPrereq = finishTime;
          limitingPred = pred;
        }
View Full Code Here

   * @return
   */
  public static long onHostTimes(List<Report> path) {
    long time =0;  
    for(int i =0; i < path.size()-1; ++i) {
      Report src = path.get(i+1);
      Report dest = path.get(i);
      List<String> srcHost = src.get("Host"), destHost = dest.get("Host");
      if(srcHost != null && srcHost.size() > 0 && destHost != null && destHost.size() > 0) {
        if(srcHost.get(0).equals(destHost.get(0))){
          long src_ts = getTS(src);
          long dest_ts = getTS(dest);
         
View Full Code Here

  //////IO utils
 
  public void slurpTextFile(File f) throws IOException {
   
    BufferedReader br = new BufferedReader(new FileReader(f));
    Report rep;
    while((rep = getNextReportFromReader(br)) != null ) {
      add(rep);
    }
  }
View Full Code Here

   
    HashSet<Report> predecessors = new HashSet<Report>();
    Queue<Report> bfsQ = new LinkedList<Report>();
    bfsQ.add(p);
    while(!bfsQ.isEmpty()) {
      Report r = bfsQ.remove();

      assert r!= null;
      predecessors.add(r);
      List<String> backEdges = r.get("Edge");
      if(backEdges != null)
        for(String pred:backEdges) {
          Report pre = reports.get(pred);
          if(pre != null)
            bfsQ.add(pre);
        }
    }
   
View Full Code Here

    //from report op ID to inlink count.
    //next step is to do a topological sort.

    ArrayList<Report> finalOutput = new ArrayList<Report>();
    while(!zeroInlinkReports.isEmpty()) {
      Report r = zeroInlinkReports.remove();
     
      List<String> outLinks =  r.get(XtrExtract.OUTLINK_FIELD);
      if(outLinks != null) {
        for(String outLink: outLinks) {
          Integer oldCount = counts.get(outLink);
          if(oldCount == null) {
            oldCount = 0//FIXME: can this happen?
View Full Code Here

TOP

Related Classes of edu.berkeley.xtrace.reporting.Report

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.