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

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

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

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