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

Unified Diff: chrome/browser/memory_details.h

Issue 10151005: cros: Log per-process memory use on low memory events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/low_memory_observer.cc ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory_details.h
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 568f591328a4af632411c6d058119e1e8db94596..422a09bc07e7fd88ee885bbcfb48b60ce9c39a92 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -107,6 +107,11 @@ class ProcessInfoSnapshot;
// }
class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
public:
+ enum UserMetricsMode {
+ UPDATE_USER_METRICS, // Update UMA memory histograms with results.
+ SKIP_USER_METRICS
+ };
+
// Constructor.
MemoryDetails();
@@ -116,10 +121,15 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// Initiate updating the current memory details. These are fetched
// asynchronously because data must be collected from multiple threads.
+ // Updates UMA memory histograms if |mode| is UPDATE_USER_METRICS.
// OnDetailsAvailable will be called when this process is complete.
- void StartFetch();
+ void StartFetch(UserMetricsMode user_metrics_mode);
- virtual void OnDetailsAvailable() {}
+ virtual void OnDetailsAvailable() = 0;
+
+ // Returns a string summarizing memory usage of the Chrome browser process
+ // and all sub-processes, suitable for logging.
+ std::string ToLogString();
protected:
friend class base::RefCountedThreadSafe<MemoryDetails>;
@@ -156,8 +166,7 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// renderer processes is only available there.
void CollectChildInfoOnUIThread();
- // Each time we take a memory sample, we do a little work to update
- // the global histograms for tracking memory usage.
+ // Updates the global histograms for tracking memory usage.
void UpdateHistograms();
// Returns a pointer to the ProcessData structure for Chrome.
@@ -165,6 +174,8 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
std::vector<ProcessData> process_data_;
+ UserMetricsMode user_metrics_mode_;
+
DISALLOW_COPY_AND_ASSIGN(MemoryDetails);
};
« no previous file with comments | « chrome/browser/low_memory_observer.cc ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698