Package com.reign.kat.lib.utils.stats
Class BotStats
java.lang.Object
com.reign.kat.lib.utils.stats.BotStats
Bot Statistics Monitor
 Contains information about recent command executions.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddCommandExecutionStat(Command command, long timeTaken, CommandParameters input) Log a command execution and its stats to the BotStats history.static voidaddCommands(Command... commands) Add multiple commands to be monitored.static voidaddCommands(Collection<Command> commands) Add a Collection of Command to be monitored and timed.static voidaddToReport(String key, Supplier<Float> func) Prints a nicely formatted table to the terminal of average execution times of all commands.Get the last 10 average execution time of all commands monitored.getAvgExecutionTimeFor(Command... commands) Returns the average execution time for a list of commandsstatic HashMap<Command,ArrayList<CommandExecution>> getCommandExecutionHistoryFor(Command... commands) Returns a HashMap of CommandExecutions for each specified command the key being the Command, and the value being a CommandExecutionstatic void
- 
Field Details- 
HISTORY_SIZEpublic static final int HISTORY_SIZE- See Also:
 
 
- 
- 
Constructor Details- 
BotStats
 
- 
- 
Method Details- 
addToReport
- 
addCommandsAdd multiple commands to be monitored.- Parameters:
- commands- Commands to be monitored.
 
- 
addCommandsAdd a Collection of Command to be monitored and timed.- Parameters:
- commands- Commands to add to the monitoring system.
 
- 
addCommandExecutionStatpublic static void addCommandExecutionStat(Command command, long timeTaken, CommandParameters input) Log a command execution and its stats to the BotStats history.- Parameters:
- command- Command which was executed.
- timeTaken- how long the command took to execute (ms).
- input- The arguments passed to the command.
 
- 
getCommandExecutionHistoryForpublic static HashMap<Command,ArrayList<CommandExecution>> getCommandExecutionHistoryFor(Command... commands) Returns a HashMap of CommandExecutions for each specified command the key being the Command, and the value being a CommandExecution- Parameters:
- commands- commands to fetch for.
- Returns:
- HashMap of Command, CommandExecution
 
- 
getAvgExecutionTimeForReturns the average execution time for a list of commands- Parameters:
- commands- Commands to retrieve the avg. execution time for.
- Returns:
- Hashmap of commands and their execution times in ms.
 
- 
getAvgExecutionTimeGet the last 10 average execution time of all commands monitored.- Returns:
- Hashmap of the previous 10 execution timings.
 
- 
buildReportPrints a nicely formatted table to the terminal of average execution times of all commands.
- 
reportToConsolepublic static void reportToConsole()
 
-