All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LoggingResourceStream.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Streaming.h"
6 #include "IResourceStream.h"
7 
8 namespace Eegeo
9 {
10  namespace Streaming
11  {
13  {
14  private:
15  int totalRequests;
16  int totalFailedRequests;
17  int totalSuccessRequests;
18  int totalRawResourceBytesSuccessRequests;
19 
20  int totalSuccessRequestFromWeb;
21  int totalSuccessRequestFromCache;
22  int totalRawResourceBytesSuccessRequestsFromWeb;
23  int totalRawResourceBytesSuccessRequestsFromCache;
24  int totalSuccessPreDecompressWebBytesRead;
25 
26  float totalFailRequestFromWebTimeMilliseconds;
27  float totalSuccessRequestFromWebTimeMilliseconds;
28  float totalSuccessRequestFromCacheTimeMilliseconds;
29 
30  public:
32 
33  int TotalNumRequests() const;
34  int TotalFailedRequests() const;
35  int TotalSuccessRequests() const;
36  int TotalSuccessRequestsFromWeb() const;
37  int TotalSuccessRequestsFromCache() const;
38  int TotalBytesSuccessRequests() const;
39  int TotalBytesSuccessRequestsFromWeb() const;
40  int TotalBytesSuccessRequestsFromCache() const;
41  int TotalSuccessPreDecompressWebBytesRead() const;
42 
43  int AvgBytesPerSuccessRequests() const;
44 
45  float AvgTimeSuccessCacheLoadMs() const;
46  float AvgTimeSuccessWebLoadMs() const;
47  float AvgTimeFailWebLoadMs() const;
48 
49  void ResetCounters();
50 
51  void LogFailedRequest(const MortonKey& key, float totalTimeTakenMilliseconds);
52 
53  void LogSuccessfulRequest(const MortonKey& key,
54  size_t rawResourceSize,
55  bool loadedFromCache,
56  float totalTimeTakenMilliseconds,
57  size_t preDecompressBytesRead);
58  };
59  }
60 }