Example usage for com.google.gwt.coreext.client JsIntegerDoubleMap get

List of usage examples for com.google.gwt.coreext.client JsIntegerDoubleMap get

Introduction

In this page you can find the example usage for com.google.gwt.coreext.client JsIntegerDoubleMap get.

Prototype

public final native double get(int key) ;

Source Link

Document

Returns the value associated with the specified key.

Usage

From source file:com.google.speedtracer.client.visualizations.model.ReportDataCollector.java

License:Apache License

private static void doAggregation(JsIntegerDoubleMap in, final JsIntegerDoubleMap out) {
    in.iterate(new IterationCallBack() {
        public void onIteration(int key, double val) {
            double duration = out.hasKey(key) ? out.get(key) + val : val;
            out.put(key, duration);/*from w  w  w.ja va 2s . c  o m*/
        }
    });
}

From source file:com.google.speedtracer.client.visualizations.view.EventFilter.java

License:Apache License

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;
}

From source file:com.google.speedtracer.client.visualizations.view.EventTraceBreakdown.java

License:Apache License

private void renderNode(Canvas canvas, UiEvent parent, UiEvent node,
        JsIntegerDoubleMap accumulatedErrorByType) {
    double startX = (node.getTime() - rootEvent.getTime()) * masterDomainToCoords;
    double width = node.getDuration() * masterDomainToCoords;
    final int nodeType = node.getType();
    // Insignificance is tricky. If we have lots of insignificant things, they
    // can add up to a significant thing.
    if (node.getDuration() < insignificanceThreshold) {
        // When the sub-pixel strokes are composited, we get a misleading color
        // blend. We use a unique aliasing scheme here where we suppress short
        // duration events but keep up with the total time we've suppressed for
        // each suppressed type. If the total suppressed time for a type ends up
        // being significant, we will synthesize a single aggregate event to
        // correct our accounting.
        double correctedTime = node.getSelfTime();
        if (accumulatedErrorByType.hasKey(nodeType)) {
            correctedTime += accumulatedErrorByType.get(nodeType);
        }//from  w w  w . j av a 2s.c  om

        if (correctedTime < insignificanceThreshold) {
            accumulatedErrorByType.put(nodeType, correctedTime);
            return;
        }

        // We want to draw a discrete bar.
        width = insignificanceThreshold * masterDomainToCoords;
        // Reset the type specific aggregation.
        accumulatedErrorByType.put(nodeType, 0);
    }

    canvas.setFillStyle(presenter.getColor(node));
    canvas.fillRect(startX, 0, width, COORD_HEIGHT);
}