| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines a set of user experience metrics data recorded by | 5 // This file defines a set of user experience metrics data recorded by |
| 6 // the MetricsService. This is the unit of data that is sent to the server. | 6 // the MetricsService. This is the unit of data that is sent to the server. |
| 7 | 7 |
| 8 #ifndef CHROME_COMMON_METRICS_METRICS_LOG_BASE_H_ | 8 #ifndef CHROME_COMMON_METRICS_METRICS_LOG_BASE_H_ |
| 9 #define CHROME_COMMON_METRICS_METRICS_LOG_BASE_H_ | 9 #define CHROME_COMMON_METRICS_METRICS_LOG_BASE_H_ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "chrome/common/metrics/proto/chrome_user_metrics_extension.pb.h" | 16 #include "chrome/common/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 17 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace base { |
| 22 class HistogramSamples; |
| 23 } // namespace base |
| 24 |
| 21 // This class provides base functionality for logging metrics data. | 25 // This class provides base functionality for logging metrics data. |
| 22 class MetricsLogBase { | 26 class MetricsLogBase { |
| 23 public: | 27 public: |
| 24 // Creates a new metrics log | 28 // Creates a new metrics log |
| 25 // client_id is the identifier for this profile on this installation | 29 // client_id is the identifier for this profile on this installation |
| 26 // session_id is an integer that's incremented on each application launch | 30 // session_id is an integer that's incremented on each application launch |
| 27 MetricsLogBase(const std::string& client_id, | 31 MetricsLogBase(const std::string& client_id, |
| 28 int session_id, | 32 int session_id, |
| 29 const std::string& version_string); | 33 const std::string& version_string); |
| 30 virtual ~MetricsLogBase(); | 34 virtual ~MetricsLogBase(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // origin - what kind of action initiated the load | 69 // origin - what kind of action initiated the load |
| 66 // load_time - how long it took to load the page | 70 // load_time - how long it took to load the page |
| 67 void RecordLoadEvent(int window_id, | 71 void RecordLoadEvent(int window_id, |
| 68 const GURL& url, | 72 const GURL& url, |
| 69 content::PageTransition origin, | 73 content::PageTransition origin, |
| 70 int session_index, | 74 int session_index, |
| 71 base::TimeDelta load_time); | 75 base::TimeDelta load_time); |
| 72 | 76 |
| 73 // Record any changes in a given histogram for transmission. | 77 // Record any changes in a given histogram for transmission. |
| 74 void RecordHistogramDelta(const base::Histogram& histogram, | 78 void RecordHistogramDelta(const base::Histogram& histogram, |
| 75 const base::Histogram::SampleSet& snapshot); | 79 const base::HistogramSamples& snapshot); |
| 76 | 80 |
| 77 // Stop writing to this record and generate the encoded representation. | 81 // Stop writing to this record and generate the encoded representation. |
| 78 // None of the Record* methods can be called after this is called. | 82 // None of the Record* methods can be called after this is called. |
| 79 void CloseLog(); | 83 void CloseLog(); |
| 80 | 84 |
| 81 // These methods allow retrieval of the encoded representation of the | 85 // These methods allow retrieval of the encoded representation of the |
| 82 // record. They can only be called after CloseLog() has been called. | 86 // record. They can only be called after CloseLog() has been called. |
| 83 // GetEncodedLog returns false if buffer_size is less than | 87 // GetEncodedLog returns false if buffer_size is less than |
| 84 // GetEncodedLogSize(); | 88 // GetEncodedLogSize(); |
| 85 int GetEncodedLogSizeXml(); | 89 int GetEncodedLogSizeXml(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // Isolated to limit the dependency on the XML library for our consumers. | 177 // Isolated to limit the dependency on the XML library for our consumers. |
| 174 XmlWrapper* xml_wrapper_; | 178 XmlWrapper* xml_wrapper_; |
| 175 | 179 |
| 176 // Stores the protocol buffer representation for this log. | 180 // Stores the protocol buffer representation for this log. |
| 177 metrics::ChromeUserMetricsExtension uma_proto_; | 181 metrics::ChromeUserMetricsExtension uma_proto_; |
| 178 | 182 |
| 179 DISALLOW_COPY_AND_ASSIGN(MetricsLogBase); | 183 DISALLOW_COPY_AND_ASSIGN(MetricsLogBase); |
| 180 }; | 184 }; |
| 181 | 185 |
| 182 #endif // CHROME_COMMON_METRICS_METRICS_LOG_BASE_H_ | 186 #endif // CHROME_COMMON_METRICS_METRICS_LOG_BASE_H_ |
| OLD | NEW |