1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.analysis
.os
.linux
.core
.latency
.statistics
;
14 import org
.eclipse
.tracecompass
.segmentstore
.core
.ISegment
;
17 * Class to calculate simple latency statistics (min, max, average)
19 * @author Bernd Hufmann
21 public class LatencyStatistics
{
25 private long fNbSegments
;
30 public LatencyStatistics() {
31 this.fMin
= Long
.MAX_VALUE
;
32 this.fMax
= Long
.MIN_VALUE
;
40 * @return minimum value
42 public long getMin() {
49 * @return maximum value
51 public long getMax() {
56 * Get number of segments analyzed
58 * @return number of segments analyzed
60 public long getNbSegments() {
65 * Gets the arithmetic average
67 * @return arithmetic average
69 public double getAverage() {
70 return ((double) fSum
) / fNbSegments
;
74 * Update the statistics based on a given segment
77 * the segment used for the update
79 public void update (ISegment segment
) {
80 long value
= segment
.getLength();
81 fMin
= Math
.min(fMin
, value
);
82 fMax
= Math
.max(fMax
, value
);
This page took 0.043267 seconds and 6 git commands to generate.