Statistic.java 2.77 KB
Newer Older
Alex Wenckus's avatar
Alex Wenckus committed
1 2 3 4 5 6 7 8 9 10
/**
 * $RCSfile  $
 * $Revision  $
 * $Date  $
 *
 * Copyright (C) 1999-2006 Jive Software. All rights reserved.
 *
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
 */
11

Alex Wenckus's avatar
Alex Wenckus committed
12 13 14
package org.jivesoftware.wildfire.stats;

/**
15 16 17
 * A statistic being tracked by the server.
 *
 * @see StatisticsManager
Alex Wenckus's avatar
Alex Wenckus committed
18 19 20 21 22 23
 */
public interface Statistic {

    /**
     * Returns the name of a stat.
     *
24
     * @return the name of a stat.
Alex Wenckus's avatar
Alex Wenckus committed
25 26 27 28 29 30
     */
    public String getName();

    /**
     * Returns the type of a stat.
     *
31
     * @return the type of a stat.
Alex Wenckus's avatar
Alex Wenckus committed
32 33 34 35 36 37
     */
    public Type getStatType();

    /**
     * Returns a description of the stat.
     *
38
     * @return a description of the stat.
Alex Wenckus's avatar
Alex Wenckus committed
39 40 41 42 43 44
     */
    public String getDescription();

    /**
     * Returns the units that relate to the stat.
     *
45
     * @return the name of the units that relate to the stat.
Alex Wenckus's avatar
Alex Wenckus committed
46 47 48 49
     */
    public String getUnits();

    /**
50 51 52
     * Returns the current sample of data.
     *
     * @return a sample of the data.
Alex Wenckus's avatar
Alex Wenckus committed
53
     */
54
    public double sample();
Alex Wenckus's avatar
Alex Wenckus committed
55

56 57 58
    /**
     * The type of statistic.
     */
59
    @SuppressWarnings({"UnnecessarySemicolon"})  // Support for QDox Parser
Alex Wenckus's avatar
Alex Wenckus committed
60 61 62
    public enum Type {

        /**
63 64 65
         * The average rate over time. For example, the averave kb/s in bandwidth used for
         * file transfers. Each time the {@link Statistic#sample()} method is invoked, it should
         * return the "amount" of data recorded since the last invocation.
Alex Wenckus's avatar
Alex Wenckus committed
66
         */
Alex Wenckus's avatar
Alex Wenckus committed
67
        rate,
68 69 70 71 72 73 74

        /**
         * The total rate over time. For example, the number of users created. Each time the
         * {@link Statistic#sample()} method is invoked, it should return the "amount" of data
         * recorded since the last invocation. The values will be totalled over the relevant
         * time interval (by minute, hourly, daily, etc.).
         */
Matt Tucker's avatar
Matt Tucker committed
75
        // TODO: rate_total,
76

77
        /*
78 79 80 81 82
         * The average count over a time period. An example would be the
         * number of users in multi-user chats. Each time the {@link Statistic#sample()}
         * method is invoked, it should return the current measurement of the data, irrelevant of
         * previous reads of the data.   
         */
83
        count;
84

Alex Wenckus's avatar
Alex Wenckus committed
85
        /**
86 87 88 89 90
         * The max count over a time period. An example would be the maximum number of users
         * connected to the server. Each time the {@link Statistic#sample()}
         * method is invoked, it should return the current measurement of the data, irrelevant of
         * previous reads of the data. The max value read will be stored for each time interval
         * (by minute, hourly, daily, etc.).
Alex Wenckus's avatar
Alex Wenckus committed
91
         */
Matt Tucker's avatar
Matt Tucker committed
92
        // TODO: count_max
Alex Wenckus's avatar
Alex Wenckus committed
93 94
    }
}