System.Diagnostics.Stopwatch is used instead of DateTime

main
Inga 🏳‍🌈 12 years ago
parent 2c65eb4bae
commit 0b77810a40
  1. 7
      FLocal.IISHandler/MainHandler.cs
  2. 5
      FLocal.IISHandler/handlers/AbstractGetHandler.cs
  3. 5
      FLocal.IISHandler/handlers/request/AbstractPostHandler.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Web;
@ -46,14 +47,14 @@ namespace FLocal.IISHandler {
public void ProcessRequest(HttpContext context) {
Initializer.instance.Initialize();
DateTime start = DateTime.Now;
Stopwatch st = Stopwatch.StartNew();
int requestNumber = counter.GetCurrentValueAndIncrement();
try {
Config.instance.Logger.Log("Began serving request #" + requestNumber + ": " + context.Request.Url.AbsoluteUri);
this.doProcessRequest(context);
Config.instance.Logger.Log("Done serving request #" + requestNumber + "; " + (DateTime.Now-start).TotalSeconds + " seconds spent");
Config.instance.Logger.Log("Done serving request #" + requestNumber + "; " + st.ElapsedMilliseconds + " ms spent");
} catch(RedirectException e) {
Config.instance.Logger.Log("Done serving request #" + requestNumber + "; " + (DateTime.Now-start).TotalSeconds + " seconds spent (redirected)");
Config.instance.Logger.Log("Done serving request #" + requestNumber + "; " + st.ElapsedMilliseconds + " ms spent (redirected)");
context.Response.Redirect(e.newUrl);
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml.Linq;
@ -38,14 +39,14 @@ namespace FLocal.IISHandler.handlers {
}
private XDocument getData(WebContext context) {
DateTime start = DateTime.Now;
var st = Stopwatch.StartNew();
var specificData = this.getSpecificData(context);
var commonData = this.getCommonData(context);
return new XDocument(
new XElement("root",
specificData,
commonData,
new XElement("processingTime", (DateTime.Now-start).TotalSeconds)
new XElement("processingTime", st.ElapsedMilliseconds)
)
);
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml.Linq;
@ -41,14 +42,14 @@ namespace FLocal.IISHandler.handlers.request {
}
private XDocument getData(WebContext context) {
DateTime start = DateTime.Now;
var st = Stopwatch.StartNew();
var specificData = this.Do(context);
var commonData = this.getCommonData(context);
return new XDocument(
new XElement("root",
specificData,
commonData,
new XElement("processingTime", (DateTime.Now-start).TotalSeconds)
new XElement("processingTime", st.ElapsedMilliseconds)
)
);
}

Loading…
Cancel
Save