source: binary-improvements/MapRendering/Commands/webstat.cs@ 332

Last change on this file since 332 was 325, checked in by alloc, 6 years ago

Code style cleanup (mostly whitespace changes, enforcing braces, using cleanup)

File size: 1.4 KB
RevLine 
[230]1using System;
2using System.Collections.Generic;
[325]3using AllocsFixes.NetConnections.Servers.Web;
[230]4
[325]5namespace AllocsFixes.CustomCommands {
6 public class webstat : ConsoleCmdAbstract {
7 public override string GetDescription () {
[230]8 return "DEBUG PURPOSES ONLY";
9 }
10
[325]11 public override string[] GetCommands () {
12 return new[] {"webstat"};
[230]13 }
14
[325]15 public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
[230]16 try {
[325]17 int curHandlers = Web.currentHandlers;
18 int totalHandlers = Web.handlingCount;
19 long totalTime = Web.totalHandlingTime;
[279]20 SdtdConsole.Instance.Output ("Current Web handlers: " + curHandlers + " - total: " + totalHandlers);
[325]21 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs - average time: " +
22 totalTime / totalHandlers + " µs");
[279]23
[325]24 curHandlers = WebCommandResult.currentHandlers;
25 totalHandlers = WebCommandResult.handlingCount;
26 totalTime = WebCommandResult.totalHandlingTime;
27 SdtdConsole.Instance.Output ("Current Web command handlers: " + curHandlers + " - total: " +
28 totalHandlers);
29 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs" +
30 (totalHandlers > 0
31 ? " - average time: " + totalTime / totalHandlers + " µs"
32 : ""));
[230]33 } catch (Exception e) {
34 Log.Out ("Error in webstat.Run: " + e);
35 }
36 }
37 }
[325]38}
Note: See TracBrowser for help on using the repository browser.