Package com.google.speedtracer.client.model

Examples of com.google.speedtracer.client.model.UiEvent


          details.updateProfile();
        }
      }

      public void onMouseOver(MouseOverEvent event) {
        UiEvent e = (UiEvent) event.getSource();
        assert e != null;
        GraphCalloutModel calloutModel = getVisualization().getTimeline().getModel().getGraphCalloutModel();
        calloutModel.update(e.getTime(), e.getDuration(),
            UiEvent.typeToDetailedTypeString(e), 0, true);
      }
    };

    // Create the EventFilterPanel UI.
View Full Code Here


   */
  static UiEvent splitEventTreeOnBoundary(UiEvent node, double time,
      boolean lessThan) {
    assert (node != null) : "This function should never be called with a null node!";

    UiEvent shallowClone = boundedClone(node, time, lessThan);
    // If this node falls outside the splittable bound, it will be null.
    if (shallowClone == null) {
      return null;
    }

    JSOArray<UiEvent> children = node.getChildren();
    for (int i = 0, n = children.size(); i < n; i++) {
      UiEvent child = splitEventTreeOnBoundary(children.get(i), time, lessThan);
      if (child != null) {
        // Ignore children that have been split.
        shallowClone.addChild(child);
      }
    }
View Full Code Here

    Collector uiEventCollector = new Collector() {
      private List<HintRecord> hints = new ArrayList<HintRecord>();

      @Override
      void examineRecord(EventRecord record, JsIntegerDoubleMap out) {
        UiEvent castedRecord = record.cast();
        AggregateTimeVisitor.apply(castedRecord);
        // Aggregate the type durations. Only UiEvents will have type
        // durations set. We simply ignore events without a duration map.
        JsIntegerDoubleMap typeDurations = castedRecord.getTypeDurations();
        if (typeDurations != null) {
          doAggregation(typeDurations, out);
        }
        setTotalAvailableTime(getTotalAvailableTime()
            - castedRecord.getDuration());
        addHintsFromJSOArray(record.getHintRecords(), hints);
      }

      @Override
      void finishCollection(JsIntegerDoubleMap aggregateDurationsOut,
View Full Code Here

      // now cut out the immediate children.
      JSOArray<UiEvent> children = event.getChildren();
      for (int i = 0, n = children.size(); i < n; i++) {
        // The simple act of getting children takes a long time. That is crazy.
        UiEvent child = children.get(i);
        double startX = (child.getTime() - event.getTime()) * domainToCoords;
        canvas.clearRect(startX, 0, domainToCoords * child.getDuration(),
            canvas.getCoordWidth());
      }
    }
View Full Code Here

    index = index - 1;

    // Not all records will be UiEvents. But we want access to fields like
    // duration and the type maps. These will return appropriate 0 and null
    // values for non-UiEvent EventRecords.
    UiEvent record = eventList.get(index).cast();
    final List<HintRecord> hints = new ArrayList<HintRecord>();
    final JsIntegerDoubleMap aggregateTypeDurations = JsIntegerDoubleMap.create();

    // We want to add a wedge in the pie chart for the time the browser's UI
    // thread was available.
    collector.setTotalAvailableTime(rightBound - leftBound);

    // We are starting at the right edge of the window, which may chop an event.
    if (UiEvent.isUiEvent(record)) {
      record = splitEventTreeOnBoundary(record, rightBound, true);
      // Guard against having the record split an event outside the window.
      if (record == null) {
        return new ReportData(null, null);
      }
    }

    // We will walk backward to find the left window boundary. Because we can
    // have ResourceUpdate records that have nonsensical time stamps, we place
    // the terminating condition within the loop.
    while (index >= 0) {
      double endTime = record.getTime() + record.getDuration();
      // Our real terminating condition is if the record passes the left edge.
      if (endTime < leftBound) {
        break;
      }
      // Chop records that fall within the window, but start to the left of
      // the leftBound.
      if (UiEvent.isUiEvent(record) && record.getTime() < leftBound
          && endTime >= leftBound) {
        record = splitEventTreeOnBoundary(record, leftBound, false);
        assert (record != null) : "Splitting a node should yield a valid non-null clone here!";
      }
View Full Code Here

    // TODO (jaimeyap): We just need the start and end indices.
    // Therefore we should eventually just do a binary search for start index.
    // Will need to do based on endTime, and therefore would need a list sorted
    // by end time. Also need a new Comparator object.
    UiEvent e = eventList.get(eventIndex);
    double endTime = e.getEndTime();
    while (endTime > left) {
      // Walk backwards
      --eventIndex;
      if (eventIndex < 0) {
        break;
      } else {
        e = eventList.get(eventIndex);
        endTime = e.getEndTime();
      }
    }

    int[] result = {(eventIndex + 1), endIndex};
    return result;
View Full Code Here

    if (!UiEvent.isUiEvent(eventRecord)) {
      return;
    }

    UiEvent uiEvent = eventRecord.cast();

    // compute the total duration of all children
    double childTime = 0;
    for (int i = 0, j = uiEvent.getChildren().size(); i < j; i++) {
      childTime += uiEvent.getChildren().get(i).getDuration();
    }
    // add self duration of current node
    uiEvent.setSelfTime(uiEvent.getDuration() - childTime);

    // work on all children then
    for (int i = 0; i < uiEvent.getChildren().size(); i++) {
      computeSelfTime(uiEvent.getChildren().get(i));
    }
  }
View Full Code Here

   * with other events below the threshold that are adjacent.
   *
   * @param node
   */
  public static void maybeExpandNode(LazyItem node, boolean force) {
    UiEvent event = node.getUiEvent();
    boolean whiteListed = isWhiteListed(event);
    JSOArray<UiEvent> children = event.getChildren();
    // If we are not whitelisted, not forcing an expansion, and the duration
    // does not meet the threshold. Leave it unexpanded (set the expansion icon
    // to plus).
    if (!whiteListed && event.getDuration() < TREE_ITEM_EXPANSION_THRESHOLD
        && !force) {
      // Node MUST have already passed the Coalescing threshold
      if (children.size() > 0) {
        // Change the icon to closed. We let the click handler expand it.
        node.setDirtyChildren(true);
        node.setExpansionIcon(false);
      }
      return;
    } else {
      final LazyEventTree tree = node.getOwningTree();
      SiblingCoalescer coalescer = null;
      for (int i = 0, n = children.size(); i < n; i++) {
        UiEvent childUiEvent = children.get(i);
        boolean childWhiteListed = isWhiteListed(childUiEvent);
        // We coalesce zero duration events always EXCEPT:
        // 1. If it is white listed.
        // 2. If there is only one node in the child list (n==1).
        // 3. If we are on the last node and starting a new coalescer (n==i+1)
        // and (coalescer == null)
        if (childUiEvent.getDuration() <= TREE_ITEM_COALESCING_THRESHOLD
            && !childWhiteListed) {
          if (coalescer == null) {
            // If we are on the last child and attempting to start a new
            // coalescer.
            if ((n - i) == 1) {
View Full Code Here

    }

    public void expand() {
      for (int i = 0, n = coalescedItems.size(); i < n
          && i < MAX_NODE_EXPANSION_COUNT; i++) {
        UiEvent event = coalescedItems.get(0);
        // This is the magic constructor that inserts the LazyItem before the
        // placeholder.
        LazyItem formerlyHidden = new LazyItem(parent, parentContainer, event);

        deemphasizeNodeIfParentIsNotDeemphasized(parent, formerlyHidden);

        // If its got kids, we obviously are not going to be in an opened state.
        // Change the icon.
        if (event.getChildren().size() > 0) {
          formerlyHidden.setExpansionIcon(false);
        }

        coalescedItems.remove(0);
      }
View Full Code Here

   *        spent in layout
   */
  private void findLayouts(JSOArray<UiEvent> events, Results results) {

    for (int i = 0; i < events.size(); i++) {
      UiEvent event = events.get(i);

      if (event.getType() == EventRecordType.LAYOUT_EVENT) {
        results.layoutsFound++;
        results.layoutTime += event.getSelfTime();
      }

      // recursively search all children
      if (event.getChildren() != null) {
        findLayouts(event.getChildren(), results);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.google.speedtracer.client.model.UiEvent

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.