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

Last change on this file since 405 was 359, checked in by alloc, 5 years ago

Removed unnecessary try-catch-blocks from commands (command handler catches exceptions anyway and provides more detailed output)

File size: 1.3 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 int curHandlers = Web.currentHandlers;
17 int totalHandlers = Web.handlingCount;
18 long totalTime = Web.totalHandlingTime;
19 SdtdConsole.Instance.Output ("Current Web handlers: " + curHandlers + " - total: " + totalHandlers);
20 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs - average time: " +
21 totalTime / totalHandlers + " µs");
22
23 curHandlers = WebCommandResult.currentHandlers;
24 totalHandlers = WebCommandResult.handlingCount;
25 totalTime = WebCommandResult.totalHandlingTime;
26 SdtdConsole.Instance.Output ("Current Web command handlers: " + curHandlers + " - total: " +
27 totalHandlers);
28 SdtdConsole.Instance.Output (" - Total time: " + totalTime + " µs" +
29 (totalHandlers > 0
30 ? " - average time: " + totalTime / totalHandlers + " µs"
31 : ""));
32 }
33 }
34}
Note: See TracBrowser for help on using the repository browser.