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

Unified Diff: chrome/browser/memory_details.h

Issue 823533004: Move memory histograms generation to MetricsMemoryDetails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better class comment. Created 5 years, 11 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
Index: chrome/browser/memory_details.h
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 98359fcc423f1f36dc9804253feb4c43b76787ad..170f7c959fb30da4aabc63c2034305fe581574da 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_MEMORY_DETAILS_H_
#include <map>
+#include <string>
#include <vector>
#include "base/memory/ref_counted.h"
@@ -85,32 +86,6 @@ struct ProcessData {
BrowserContextSiteDataMap site_data;
};
-// MemoryGrowthTracker tracks latest metrics about record time and memory usage
-// at that time per process.
-class MemoryGrowthTracker {
- public:
- MemoryGrowthTracker();
- ~MemoryGrowthTracker();
-
- // If 30 minutes have passed since last UMA record, UpdateSample() computes
- // a difference between current memory usage |sample| of process |pid| and
- // stored memory usage at the time of last UMA record. Then, it updates the
- // stored memory usage to |sample|, stores the difference in |diff| and
- // returns true.
- // If no memory usage of |pid| has not been recorded so far or 30 minutes
- // have not passed since last record, it just returns false.
- // |sample| is memory usage in kB.
- bool UpdateSample(base::ProcessId pid, int sample, int* diff);
-
- private:
- // Latest metrics about record time and memory usage at that time per process.
- // The second values of |memory_sizes_| are in kB.
- std::map<base::ProcessId, base::TimeTicks> times_;
- std::map<base::ProcessId, int> memory_sizes_;
-
- DISALLOW_COPY_AND_ASSIGN(MemoryGrowthTracker);
-};
-
#if defined(OS_MACOSX)
class ProcessInfoSnapshot;
#endif
@@ -156,9 +131,8 @@ 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(UserMetricsMode user_metrics_mode);
+ void StartFetch();
virtual void OnDetailsAvailable() = 0;
@@ -171,8 +145,12 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
virtual ~MemoryDetails();
- // Set MemoryGrowthTracker into MemoryDetails.
- void SetMemoryGrowthTracker(MemoryGrowthTracker* memory_growth_tracker);
+ // Returns a pointer to the ProcessData structure for Chrome.
+ ProcessData* ChromeBrowser();
+
+#if defined(OS_CHROMEOS)
+ const base::SwapInfo& swap_info() const { return swap_info_; }
+#endif
private:
// Collect child process information on the IO thread. This is needed because
@@ -204,26 +182,8 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// renderer processes is only available there.
void CollectChildInfoOnUIThread();
- // Updates the global histograms for tracking memory usage.
- void UpdateHistograms();
-
-#if defined(OS_CHROMEOS)
- void UpdateSwapHistograms();
-#endif
-
- // Returns a pointer to the ProcessData structure for Chrome.
- ProcessData* ChromeBrowser();
-
std::vector<ProcessData> process_data_;
- UserMetricsMode user_metrics_mode_;
-
- // A pointer to MemoryGrowthTracker which is contained in a longer-lived
- // owner of MemoryDetails, for example, ChromeMetricsServiceClient.
- // The pointer is NULL by default and set by SetMemoryGrowthTracker().
- // If it is NULL, nothing is tracked.
- MemoryGrowthTracker* memory_growth_tracker_;
-
#if defined(OS_CHROMEOS)
base::SwapInfo swap_info_;
#endif
« no previous file with comments | « chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698