common
Class Statistics
java.lang.Object
common.Statistics
- All Implemented Interfaces:
- java.io.Serializable
public class Statistics
- extends java.lang.Object
- implements java.io.Serializable
This class represents a Statistics object, witch contains statistical data about a Message server, and
the static methods and datas to create these object. In particular, it contains a vector that contains
the times the messages has been sended at.
Some methods of this class must be called during the Message Server activity, to let the data be updated.
- Author:
- Marco Cornolti and Alessandro Franchini
- See Also:
- Serialized Form
Constructor Summary |
Statistics(int cacheEntries,
int managedUsers,
int onlineManagedUsers,
int queuedMsgsN)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
forwardedMessagesDates
private static java.util.Vector<java.util.Date> forwardedMessagesDates
cacheEntries
private int cacheEntries
managedUsers
private int managedUsers
onlineManagedUsers
private int onlineManagedUsers
queuedMsgsN
private int queuedMsgsN
forwardedMessagesMinute
private int forwardedMessagesMinute
forwardedMessagesHour
private int forwardedMessagesHour
forwardedMessages24Hours
private int forwardedMessages24Hours
forwardedMessages48Hours
private int forwardedMessages48Hours
forwardedMessages72Hours
private int forwardedMessages72Hours
forwardedMessages96Hours
private int forwardedMessages96Hours
forwardedMessages120Hours
private int forwardedMessages120Hours
forwardedMessages144Hours
private int forwardedMessages144Hours
freeMem
private long freeMem
Statistics
public Statistics(int cacheEntries,
int managedUsers,
int onlineManagedUsers,
int queuedMsgsN)
- Parameters:
cacheEntries
- the entries in the MS cache (user-MS corrispondences)managedUsers
- the number of managed users.onlineManagedUsers
- the number of online managed users.queuedMsgsN
- the number of messages contained in the users' queues.
forwardedMessagesSince
private static int forwardedMessagesSince(int min)
- Returns the number of messages forwarded since min minutes ago. Takes O(logN)
where N is the number of messages forwarding dates in the vector.
- Parameters:
min
- the minutes of the mesaurement.
- Returns:
- the number of messages forwarded in the last min minutes.
fwMessSinceRec
private static int fwMessSinceRec(java.util.Date from,
int start,
int end)
- Returns the number of dates present in the forwardedMessagesDates after the date
given by argument. The range of positions the algorithm has to search must be specified.
The vector must be ordered (most recent date in the last position).
This method takes O(logN) where N is the number of dates in the vector.
- Parameters:
from
- the date to start counting by.start
- the first index of the searching range.end
- the last index of the searching range.
- Returns:
- the number of messages forwarded from the date from, witch is included in the range start-end.
getCacheEntries
public int getCacheEntries()
- Returns:
- the number of cache entries contained in this statistics.
getFreeMem
public long getFreeMem()
- Returns:
- the amount of free memory.
getManagedUsers
public int getManagedUsers()
- Returns:
- the number of managed users.
getOnlineManagedUsers
public int getOnlineManagedUsers()
- Returns:
- the number of online managed users.
getQueuedMessageNumber
public int getQueuedMessageNumber()
- Returns:
- the number of queued messages.
getForwardedMessagesMinute
public int getForwardedMessagesMinute()
- Returns:
- the amount of messages forwarded in the last minute.
getForwardedMessagesHour
public int getForwardedMessagesHour()
- Returns:
- the amount of messages forwarded in the last hour.
getForwardedMessages24Hours
public int getForwardedMessages24Hours()
- Returns:
- the amount of messages forwarded in the last day.
getForwardedMessages48Hours
public int getForwardedMessages48Hours()
- Returns:
- the amount of messages forwarded in the last 2 days.
getForwardedMessages72Hours
public int getForwardedMessages72Hours()
- Returns:
- the amount of messages forwarded in the last 3 days.
getForwardedMessages96Hours
public int getForwardedMessages96Hours()
- Returns:
- the amount of messages forwarded in the last 4 days.
getForwardedMessages120Hours
public int getForwardedMessages120Hours()
- Returns:
- the amount of messages forwarded in the last 5 days.
getForwardedMessages144Hours
public int getForwardedMessages144Hours()
- Returns:
- the amount of messages forwarded in the last 6 days.
increaseForwardedMessages
public static void increaseForwardedMessages()
- Must be called whenever a new message is forwarded. Adds the current time to the vector.
get24HourFwMsgs
public static int get24HourFwMsgs()
- Returns:
- the amount of messages forwarded in the last 24 hours.