comparison MetroWpf/Stocks.Common/Models/SummaryStats.cs @ 20:6109bc268b90

Latest
author adminsh@apollo
date Tue, 20 Mar 2012 13:37:46 +0000
parents
children
comparison
equal deleted inserted replaced
19:09d18d6e5f40 20:6109bc268b90
1 using System;
2 using System.Text;
3
4 namespace Stocks.Common.Models
5 {
6 public class SummaryStats
7 {
8 public WebRequestStats LastWebRequest { get; set; }
9 public int PriceChangeEvents { get; set; }
10 public int NumberOfRequests { get; set; }
11 public DateTime TimeServiceStarted { get; set; }
12
13 public void Reset()
14 {
15 LastWebRequest = new WebRequestStats();
16 PriceChangeEvents = 0;
17 NumberOfRequests = 0;
18 TimeServiceStarted = DateTime.Now;
19 }
20
21 public override string ToString()
22 {
23 var sb = new StringBuilder();
24 sb.AppendLine("Stocks Service Summary Stats:");
25 sb.AppendLine(string.Format(" Time service started: {0}", TimeServiceStarted));
26 sb.AppendLine(string.Format(" Number of requests: {0}", NumberOfRequests));
27 sb.AppendLine(string.Format(" Number of price change events: {0}", PriceChangeEvents));
28 sb.AppendLine(string.Format(" Number of symbols sent on last request: {0}", LastWebRequest.SymbolCount));
29 sb.AppendLine(string.Format(" Number of prices in last response: {0}", LastWebRequest.PricesDownloaded));
30 sb.AppendLine(string.Format(" Time taken for last request: {0}", LastWebRequest.Duration));
31 //sb.AppendLine(string.Format(" Response string for last request: {0}", LastWebRequest.Response));
32 return sb.ToString();
33 }
34 }
35 }