summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 17:05:10 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 17:05:10 +0000
commitf985b9c9f8a3bd0aa21b9717cd7533e8a9335caf (patch)
tree41b06d71c1a85b00f81967bb5e630b7a088b12fe
parente1296faf59c3d59b9556d626cb02a8ca45e6cd31 (diff)
downloadchromium_src-f985b9c9f8a3bd0aa21b9717cd7533e8a9335caf.zip
chromium_src-f985b9c9f8a3bd0aa21b9717cd7533e8a9335caf.tar.gz
chromium_src-f985b9c9f8a3bd0aa21b9717cd7533e8a9335caf.tar.bz2
The ChromeFrame UMA upload currently occurs every 30 seconds which is incorrect. We should emulate Chrome's upload model
where there is an initial UMA upload followed by subsequent uploads every 30 minutes. The initial chrome frame UMA upload now occurs after 30 seconds followed by one every 10 minutes. Bug=46057 Review URL: http://codereview.chromium.org/2840010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50249 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/metrics_service.cc26
-rw-r--r--chrome_frame/metrics_service.h6
2 files changed, 26 insertions, 6 deletions
diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc
index 85bb0b3..81fc9ef 100644
--- a/chrome_frame/metrics_service.cc
+++ b/chrome_frame/metrics_service.cc
@@ -69,10 +69,11 @@ using base::TimeDelta;
static const char kMetricsType[] =
"Content-Type: application/vnd.mozilla.metrics.bz2\r\n";
-// The delay, in seconds, after startup before sending the first log message.
-static const int kInitialInterlogDuration = 60; // one minute
+// The first UMA upload occurs after this interval.
+static const int kInitialUMAUploadTimeoutMilliSeconds = 30000;
-static const int kUMAUploadTimeoutMilliSeconds = 30000;
+// Default to one UMA upload per 10 mins.
+static const int kMinMilliSecondsPerUMAUpload = 600000;
base::LazyInstance<base::ThreadLocalPointer<MetricsService> >
MetricsService::g_metrics_instance_(base::LINKER_INITIALIZED);
@@ -231,7 +232,9 @@ MetricsService::MetricsService()
reporting_active_(false),
user_permits_upload_(false),
state_(INITIALIZED),
- thread_(NULL) {
+ thread_(NULL),
+ initial_uma_upload_(true),
+ transmission_timer_id_(0) {
}
MetricsService::~MetricsService() {
@@ -319,6 +322,15 @@ void CALLBACK MetricsService::TransmissionTimerProc(HWND window,
DLOG(INFO) << "Transmission timer notified";
DCHECK(GetInstance() != NULL);
GetInstance()->UploadData();
+ if (GetInstance()->initial_uma_upload_) {
+ // If this is the first uma upload by this process then subsequent uma
+ // uploads should occur once every 10 minutes(default).
+ GetInstance()->initial_uma_upload_ = false;
+ DCHECK(GetInstance()->transmission_timer_id_ != 0);
+ SetTimer(NULL, GetInstance()->transmission_timer_id_,
+ kMinMilliSecondsPerUMAUpload,
+ reinterpret_cast<TIMERPROC>(TransmissionTimerProc));
+ }
}
void MetricsService::SetReporting(bool enable) {
@@ -328,8 +340,10 @@ void MetricsService::SetReporting(bool enable) {
if (reporting_active_ != enable) {
reporting_active_ = enable;
if (reporting_active_) {
- SetTimer(NULL, kChromeFrameMetricsTimerId, kUMAUploadTimeoutMilliSeconds,
- reinterpret_cast<TIMERPROC>(TransmissionTimerProc));
+ transmission_timer_id_ =
+ SetTimer(NULL, kChromeFrameMetricsTimerId,
+ kInitialUMAUploadTimeoutMilliSeconds,
+ reinterpret_cast<TIMERPROC>(TransmissionTimerProc));
}
}
}
diff --git a/chrome_frame/metrics_service.h b/chrome_frame/metrics_service.h
index 766a423..af97b1c 100644
--- a/chrome_frame/metrics_service.h
+++ b/chrome_frame/metrics_service.h
@@ -139,6 +139,12 @@ class MetricsService : public MetricsServiceBase {
PlatformThreadId thread_;
+ // Indicates if this is the first uma upload from this instance.
+ bool initial_uma_upload_;
+
+ // The transmission timer id returned by SetTimer
+ int transmission_timer_id_;
+
DISALLOW_COPY_AND_ASSIGN(MetricsService);
};