List of usage examples for com.google.gwt.coreext.client JsIntegerDoubleMap hasKey
public final native boolean hasKey(int key) ;
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);/* w w w .ja v a 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); }/* www.j a v a2 s .c o m*/ 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); }