= Updated stats formatting
This commit is contained in:
@@ -3,7 +3,9 @@ package commands;
|
|||||||
import core.Command;
|
import core.Command;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import core.CommandManager.ThreadData;
|
import core.CommandManager.ThreadData;
|
||||||
|
import core.Config;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyEmbed;
|
||||||
import dataStructures.KittyGuild;
|
import dataStructures.KittyGuild;
|
||||||
import dataStructures.KittyRating;
|
import dataStructures.KittyRating;
|
||||||
import dataStructures.KittyRole;
|
import dataStructures.KittyRole;
|
||||||
@@ -23,25 +25,30 @@ public class CommandStats extends Command
|
|||||||
@Override
|
@Override
|
||||||
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||||
{
|
{
|
||||||
String out = "```\n";
|
// Variables
|
||||||
Stats stats = Stats.instance;
|
Stats stats = Stats.instance;
|
||||||
|
String out = "";
|
||||||
long seen = stats.GetMessagesSeen();
|
long seen = stats.GetMessagesSeen();
|
||||||
long processed = stats.GetCommandsProcessed();
|
long processed = stats.GetCommandsProcessed();
|
||||||
|
|
||||||
out += "----- [General] -----\n";
|
// General
|
||||||
|
out += "General";
|
||||||
|
out += "```\n";
|
||||||
out += " Messages observed: " + seen + "\n";
|
out += " Messages observed: " + seen + "\n";
|
||||||
out += "Commands processed: " + processed + "\n";
|
out += "Commands processed: " + processed + "\n";
|
||||||
out += " Command invoke %: " + ((int)((processed / (float)seen) * 1000)) / 10.0f + "%\n";
|
out += " Command invoke %: " + ((int)((processed / (float)seen) * 1000)) / 10.0f + "%\n";
|
||||||
out += " KittyBot uptime: " + stats.GetFormattedUptime() + "\n";
|
out += " Bot uptime: " + stats.GetFormattedUptime() + "\n";
|
||||||
out += "\n";
|
out += "```\n";
|
||||||
out += "----- [Health] -----\n";
|
|
||||||
|
// Health
|
||||||
|
out += "Health";
|
||||||
|
out += "```\n";
|
||||||
out += " SMT cores: " + stats.GetCPUAvailable() + "\n";
|
out += " SMT cores: " + stats.GetCPUAvailable() + "\n";
|
||||||
|
|
||||||
// If CPU load works on this OS, list it.
|
// If CPU load works on this OS, list it. -1.0 is the error state
|
||||||
double CPULoad = stats.GetSystemCPULoad();
|
double CPULoad = stats.GetSystemCPULoad();
|
||||||
if(CPULoad > -0.9) // -1.0 is the error state
|
out += CPULoad > -0.9
|
||||||
out += "System CPU Load: " + (CPULoad * 100) + "%\n";
|
? " CPU Load: " + (CPULoad * 100) + "%\n" : "";
|
||||||
|
|
||||||
ThreadData data = stats.GetThreadData();
|
ThreadData data = stats.GetThreadData();
|
||||||
Integer terminated = data.states.get(Thread.State.TERMINATED);
|
Integer terminated = data.states.get(Thread.State.TERMINATED);
|
||||||
@@ -58,12 +65,18 @@ public class CommandStats extends Command
|
|||||||
+ " term-" + (terminated == null ? 0 : terminated)
|
+ " term-" + (terminated == null ? 0 : terminated)
|
||||||
+ "\n";
|
+ "\n";
|
||||||
|
|
||||||
|
out += "```\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Cache
|
||||||
Integer guildCount = stats.GetGuildCount();
|
Integer guildCount = stats.GetGuildCount();
|
||||||
Integer userCount = stats.GetUserCount();
|
Integer userCount = stats.GetUserCount();
|
||||||
|
|
||||||
out += "\n----- [Cache] -----\n"
|
out += "Cache";
|
||||||
|
out += "```\n"
|
||||||
+ "Cached Guilds: " + guildCount + "\n"
|
+ "Cached Guilds: " + guildCount + "\n"
|
||||||
+ " Cached Users: " + userCount;
|
+ " Cached Users: " + userCount;
|
||||||
|
|
||||||
out += "\n```";
|
out += "\n```";
|
||||||
|
|
||||||
KittyEmbed embed = new KittyEmbed();
|
KittyEmbed embed = new KittyEmbed();
|
||||||
|
|||||||
Reference in New Issue
Block a user