Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: chrome/browser/metrics/metrics_service.h

Issue 113473: Automatically adapt to faster/slower uploads of renderer histograms... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 service that collects information about the user 5 // This file defines a service that collects information about the user
6 // experience in order to help improve future versions of the app. 6 // experience in order to help improve future versions of the app.
7 7
8 #ifndef CHROME_BROWSER_METRICS_SERVICE_H_ 8 #ifndef CHROME_BROWSER_METRICS_SERVICE_H_
9 #define CHROME_BROWSER_METRICS_SERVICE_H_ 9 #define CHROME_BROWSER_METRICS_SERVICE_H_
10 10
11 #include <list> 11 #include <list>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/histogram.h" 18 #include "base/histogram.h"
19 #include "base/scoped_ptr.h" 19 #include "base/scoped_ptr.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "chrome/browser/metrics/metrics_log.h" 21 #include "chrome/browser/metrics/metrics_log.h"
22 #include "chrome/browser/net/url_fetcher.h" 22 #include "chrome/browser/net/url_fetcher.h"
23 #include "chrome/common/notification_registrar.h" 23 #include "chrome/common/notification_registrar.h"
24 #include "webkit/glue/webplugin.h" 24 #include "webkit/glue/webplugin.h"
25 25
26 class BookmarkModel; 26 class BookmarkModel;
27 class BookmarkNode; 27 class BookmarkNode;
28 class HistogramSynchronizer;
28 class PrefService; 29 class PrefService;
29 class Profile; 30 class Profile;
30 class TemplateURLModel; 31 class TemplateURLModel;
31 32
32 // This is used to quickly log stats from child process related notifications in 33 // This is used to quickly log stats from child process related notifications in
33 // MetricsService::child_stats_buffer_. The buffer's contents are transferred 34 // MetricsService::child_stats_buffer_. The buffer's contents are transferred
34 // out when Local State is periodically saved. The information is then 35 // out when Local State is periodically saved. The information is then
35 // reported to the UMA server on next launch. 36 // reported to the UMA server on next launch.
36 struct ChildProcessStats { 37 struct ChildProcessStats {
37 public: 38 public:
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Deletes pending_log_ and current_log_, and pushes their text into the 181 // Deletes pending_log_ and current_log_, and pushes their text into the
181 // appropriate unsent_log vectors. Called when Chrome shuts down. 182 // appropriate unsent_log vectors. Called when Chrome shuts down.
182 void PushPendingLogsToUnsentLists(); 183 void PushPendingLogsToUnsentLists();
183 184
184 // Save the pending_log_text_ persistently in a pref for transmission when we 185 // Save the pending_log_text_ persistently in a pref for transmission when we
185 // next run. Note that IF this text is "too large," we just dicard it. 186 // next run. Note that IF this text is "too large," we just dicard it.
186 void PushPendingLogTextToUnsentOngoingLogs(); 187 void PushPendingLogTextToUnsentOngoingLogs();
187 188
188 // Start timer for next log transmission. 189 // Start timer for next log transmission.
189 void StartLogTransmissionTimer(); 190 void StartLogTransmissionTimer();
190 // Do not call TryToStartTransmission() directly. 191
192 // Internal function to collect process memory information.
193 void LogTransmissionTimerDone();
194
195 // Do not call OnMemoryDetailCollectionDone() or
196 // OnHistogramSynchronizationDone() directly.
191 // Use StartLogTransmissionTimer() to schedule a call. 197 // Use StartLogTransmissionTimer() to schedule a call.
192 void TryToStartTransmission(); 198 void OnMemoryDetailCollectionDone();
199 void OnHistogramSynchronizationDone();
193 200
194 // Takes whatever log should be uploaded next (according to the state_) 201 // Takes whatever log should be uploaded next (according to the state_)
195 // and makes it the pending log. If pending_log_ is not NULL, 202 // and makes it the pending log. If pending_log_ is not NULL,
196 // MakePendingLog does nothing and returns. 203 // MakePendingLog does nothing and returns.
197 void MakePendingLog(); 204 void MakePendingLog();
198 205
199 // Determines from state_ and permissions set out by the server and by 206 // Determines from state_ and permissions set out by the server and by
200 // the user whether the pending_log_ should be sent or discarded. Called by 207 // the user whether the pending_log_ should be sent or discarded. Called by
201 // TryToStartTransmission. 208 // TryToStartTransmission.
202 bool TransmissionPermitted() const; 209 bool TransmissionPermitted() const;
203 210
204 // Internal function to collect process memory information.
205 void CollectMemoryDetails();
206
207 // Check to see if there is a log that needs to be, or is being, transmitted. 211 // Check to see if there is a log that needs to be, or is being, transmitted.
208 bool pending_log() const { 212 bool pending_log() const {
209 return pending_log_ || !pending_log_text_.empty(); 213 return pending_log_ || !pending_log_text_.empty();
210 } 214 }
211 // Check to see if there are any unsent logs from previous sessions. 215 // Check to see if there are any unsent logs from previous sessions.
212 bool unsent_logs() const { 216 bool unsent_logs() const {
213 return !unsent_initial_logs_.empty() || !unsent_ongoing_logs_.empty(); 217 return !unsent_initial_logs_.empty() || !unsent_ongoing_logs_.empty();
214 } 218 }
215 // Record stats, client ID, Session ID, etc. in a special "first" log. 219 // Record stats, client ID, Session ID, etc. in a special "first" log.
216 void PrepareInitialLog(); 220 void PrepareInitialLog();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 std::set<std::string> histograms_to_upload_; 472 std::set<std::string> histograms_to_upload_;
469 std::set<std::string> histograms_to_omit_; 473 std::set<std::string> histograms_to_omit_;
470 474
471 // Indicate that a timer for sending the next log has already been queued. 475 // Indicate that a timer for sending the next log has already been queued.
472 bool timer_pending_; 476 bool timer_pending_;
473 477
474 DISALLOW_COPY_AND_ASSIGN(MetricsService); 478 DISALLOW_COPY_AND_ASSIGN(MetricsService);
475 }; 479 };
476 480
477 #endif // CHROME_BROWSER_METRICS_SERVICE_H_ 481 #endif // CHROME_BROWSER_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698