Last change
on this file since 412 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
|
Rev | Line | |
---|
[230] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
[325] | 3 | using AllocsFixes.NetConnections.Servers.Web;
|
---|
[230] | 4 |
|
---|
[325] | 5 | namespace 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) {
|
---|
[359] | 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");
|
---|
[279] | 22 |
|
---|
[359] | 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 | : ""));
|
---|
[230] | 32 | }
|
---|
| 33 | }
|
---|
[325] | 34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.