aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/LatencyStats.java
blob: 6cdbb50e1ebd2d1054c16af5439af9d44f1935f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;

/**
 * LatencyStats handles adding latencies and counts.
 * @author hakonhall
 */
public class LatencyStats {

    private long latencyMsSum;
    private long count;

    public LatencyStats() { this(0, 0); }

    /**
     * @param latencyMsSum    The sum of the latencies of all RPCs (or whatever) in milliseconds.
     * @param count           The number of RPC calls (or whatever).
     */
    public LatencyStats(long latencyMsSum, long count) {
        this.latencyMsSum = latencyMsSum;
        this.count = count;
    }

    void add(LatencyStats latencyToAdd) {
        latencyMsSum += latencyToAdd.latencyMsSum;
        count += latencyToAdd.count;
    }

    public long getLatencyMsSum() { return latencyMsSum; }
    public long getCount() { return count; }
}