summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 17:56:33 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 17:56:33 +0000
commit84c988a36a6592307eb56e39c7e62aa42b8dc2ad (patch)
treec8d28b4e4c3b21eba82cd5c735fef7693737bdc6 /chrome/browser/metrics
parent5cc5211e127095a53b78ed6cbb20b33e6de941e4 (diff)
downloadchromium_src-84c988a36a6592307eb56e39c7e62aa42b8dc2ad.zip
chromium_src-84c988a36a6592307eb56e39c7e62aa42b8dc2ad.tar.gz
chromium_src-84c988a36a6592307eb56e39c7e62aa42b8dc2ad.tar.bz2
Revert 77398 - Remove unused memory usage collection in MetricsServiceMetricsService was calling MemoryDetails::StartFetch but wasn't using the result so I'm removing the call entirely.BUG=43207TEST=None
TBR=sail@chromium.org Review URL: http://codereview.chromium.org/6880038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_service.cc42
-rw-r--r--chrome/browser/metrics/metrics_service.h4
2 files changed, 38 insertions, 8 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index cfe83f2..427a4c0d 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -168,6 +168,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/load_notification_details.h"
+#include "chrome/browser/memory_details.h"
#include "chrome/browser/metrics/histogram_synchronizer.h"
#include "chrome/browser/metrics/metrics_log.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -316,6 +317,23 @@ struct MetricsService::ChildProcessStats {
ChildProcessInfo::ProcessType process_type;
};
+// Handles asynchronous fetching of memory details.
+// Will run the provided task after finished.
+class MetricsMemoryDetails : public MemoryDetails {
+ public:
+ explicit MetricsMemoryDetails(Task* completion) : completion_(completion) {}
+
+ virtual void OnDetailsAvailable() {
+ MessageLoop::current()->PostTask(FROM_HERE, completion_);
+ }
+
+ private:
+ ~MetricsMemoryDetails() {}
+
+ Task* completion_;
+ DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails);
+};
+
class MetricsService::InitTaskComplete : public Task {
public:
explicit InitTaskComplete(
@@ -942,8 +960,10 @@ void MetricsService::StartLogTransmissionTimer() {
// Right before the UMA transmission gets started, there's one more thing we'd
// like to record: the histogram of memory usage, so we spawn a task to
- // collect histograms from all the renderers and when that task is finished,
- // it will call OnHistogramSynchronizationDone to continue processing.
+ // collect the memory details and when that task is finished, it will call
+ // OnMemoryDetailCollectionDone, which will call HistogramSynchronization to
+ // collect histograms from all renderers and then we will call
+ // OnHistogramSynchronizationDone to continue processing.
MessageLoop::current()->PostDelayedTask(FROM_HERE,
log_sender_factory_.
NewRunnableMethod(&MetricsService::LogTransmissionTimerDone),
@@ -951,6 +971,19 @@ void MetricsService::StartLogTransmissionTimer() {
}
void MetricsService::LogTransmissionTimerDone() {
+ Task* task = log_sender_factory_.
+ NewRunnableMethod(&MetricsService::OnMemoryDetailCollectionDone);
+
+ scoped_refptr<MetricsMemoryDetails> details(new MetricsMemoryDetails(task));
+ details->StartFetch();
+
+ // Collect WebCore cache information to put into a histogram.
+ for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
+ !i.IsAtEnd(); i.Advance())
+ i.GetCurrentValue()->Send(new ViewMsg_GetCacheResourceStats());
+}
+
+void MetricsService::OnMemoryDetailCollectionDone() {
DCHECK(IsSingleThreaded());
// HistogramSynchronizer will Collect histograms from all renderers and it
@@ -968,11 +1001,6 @@ void MetricsService::LogTransmissionTimerDone() {
HistogramSynchronizer::FetchRendererHistogramsAsynchronously(
MessageLoop::current(), callback_task,
kMaxHistogramGatheringWaitDuration);
-
- // Collect WebCore cache information to put into a histogram.
- for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
- !i.IsAtEnd(); i.Advance())
- i.GetCurrentValue()->Send(new ViewMsg_GetCacheResourceStats());
}
void MetricsService::OnHistogramSynchronizationDone() {
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 922cf38..0d4730e 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -215,8 +215,10 @@ class MetricsService : public NotificationObserver,
// Internal function to collect process memory information.
void LogTransmissionTimerDone();
- // Do not call OnHistogramSynchronizationDone() directly.
+ // Do not call OnMemoryDetailCollectionDone() or
+ // OnHistogramSynchronizationDone() directly.
// Use StartLogTransmissionTimer() to schedule a call.
+ void OnMemoryDetailCollectionDone();
void OnHistogramSynchronizationDone();
// Takes whatever log should be uploaded next (according to the state_)