Package com.google.gwt.coreext.client

Examples of com.google.gwt.coreext.client.JsIntegerDoubleMap


        double msPerPixel, UiEvent rootEvent) {
      if (isMarked(node)) {
        return;
      }

      JsIntegerDoubleMap typeMap = JsIntegerDoubleMap.create();
      JSOArray<UiEvent> children = node.getChildren();
      // Leaf node check
      if (children.isEmpty()) {
        markNode(node);
        final int nodeType = node.getType();
        typeMap.put(nodeType, node.getSelfTime());
        // Set the typemap for parent nodes to use in their calculations.
        node.setTypeDurations(typeMap);
        setDominantColorIfImportant(node, nodeType, msPerPixel, rootEvent);
        return;
      }
View Full Code Here


        double msPerPixel, UiEvent rootEvent) {
      final double aggregateThreshold = AGGREGATE_SIGNIFICANCE_IN_PIXELS
          / msPerPixel;
      // We check to see if this insignificant thing is part of something
      // significant.
      JsIntegerDoubleMap aggregateTimes = rootEvent.getTypeDurations();
      // Visitors should already have run
      assert aggregateTimes != null : "aggregateTimes is null";

      // Find the dominant color for this node, and if it belongs to an
      // important color, then set the dominant color on the UiEvent.
      if (aggregateTimes.hasKey(dominantType)
          && (aggregateTimes.get(dominantType) >= aggregateThreshold)
          || (node.getType() == LogEvent.TYPE)) {
        setDominantColor(node, EventRecordColors.getColorForType(dominantType));
      }
    }
View Full Code Here

    if (masterCanvasElement != null) {
      return;
    }

    // See comment in renderNode.
    final JsIntegerDoubleMap accumlatedErrorByType = JsIntegerDoubleMap.create();
    final Canvas canvas = new Canvas(MASTER_COORD_WIDTH, COORD_HEIGHT);
    traverseAndRender(canvas, null, rootEvent, accumlatedErrorByType);
    masterCanvasElement = canvas.getElement();
  }
View Full Code Here

      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());
View Full Code Here

    // 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);
View Full Code Here

  private void ensureData() {
    if (data == null) {
      data = new ArrayList<ColorCodedValue>();
      UiEvent event = getParentRow().getEvent();
      JsIntegerDoubleMap durations = event.getTypeDurations();

      assert (durations != null);

      durations.iterate(new JsIntegerDoubleMap.IterationCallBack() {
        public void onIteration(int key, double val) {
          if (val > 0) {
            data.add(new ColorCodedValue(EventRecord.typeToString(key)
                + " (" + TimeStampFormatter.format(val) + ")", val,
                EventRecordColors.getColorForType(key)));
View Full Code Here

  }

  private double getDurationForEventType(UiEvent eventRecord) {
    // Ensure aggregate times are computed.
    AggregateTimeVisitor.apply(eventRecord);
    final JsIntegerDoubleMap durationsByType = eventRecord.getTypeDurations();
    return durationsByType.hasKey(eventType) ? durationsByType.get(eventType) : 0.0;
  }
View Full Code Here

    dispatchTestUiEvents(mockDispatcher);

    // Test aggregating with window bounds around the entire data set.
    ReportDataCollector dataCollector = new ReportDataCollector(mockDispatcher);
    ReportData data = dataCollector.gatherDataWithinWindow(0, 22);
    JsIntegerDoubleMap typeDurations = data.getAggregatedTypeDurations();
    // Available time should be 4ms;
    assertEquals(4.0, typeDurations.get(-1), ERROR_MARGIN);
    assertEquals(6.0, typeDurations.get(4), ERROR_MARGIN);
    assertEquals(3.0, typeDurations.get(3), ERROR_MARGIN);
    assertEquals(6.0, typeDurations.get(2), ERROR_MARGIN);
    assertEquals(3.0, typeDurations.get(1), ERROR_MARGIN);

    // Tests that aggregating works even when events fall on both window
    // boundaries.
    data = dataCollector.gatherDataWithinWindow(1.5, 20.7);
    typeDurations = data.getAggregatedTypeDurations();
    // Available time should still be 4ms;
    assertEquals(4.0, typeDurations.get(-1), ERROR_MARGIN);
    assertEquals(4.7, typeDurations.get(4), ERROR_MARGIN);
    assertEquals(2.5, typeDurations.get(3), ERROR_MARGIN);
    assertEquals(5.0, typeDurations.get(2), ERROR_MARGIN);
    assertEquals(3.0, typeDurations.get(1), ERROR_MARGIN);
   
    // Tests gathering data with a window completely to the right of everything.
    data = dataCollector.gatherDataWithinWindow(100, 120);
    typeDurations = data.getAggregatedTypeDurations();
    assertEquals(20.0, typeDurations.get(-1), ERROR_MARGIN);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.coreext.client.JsIntegerDoubleMap

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.