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

Unified Diff: src/heap-profiler.h

Issue 3197010: Version 2.3.10... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 4 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 | « src/heap.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap-profiler.h
===================================================================
--- src/heap-profiler.h (revision 5316)
+++ src/heap-profiler.h (working copy)
@@ -56,8 +56,8 @@
static void TearDown();
#ifdef ENABLE_LOGGING_AND_PROFILING
- static HeapSnapshot* TakeSnapshot(const char* name);
- static HeapSnapshot* TakeSnapshot(String* name);
+ static HeapSnapshot* TakeSnapshot(const char* name, int type);
+ static HeapSnapshot* TakeSnapshot(String* name, int type);
static int GetSnapshotsCount();
static HeapSnapshot* GetSnapshot(int index);
static HeapSnapshot* FindSnapshot(unsigned uid);
@@ -75,13 +75,9 @@
private:
HeapProfiler();
~HeapProfiler();
- HeapSnapshot* TakeSnapshotImpl(const char* name);
- HeapSnapshot* TakeSnapshotImpl(String* name);
+ HeapSnapshot* TakeSnapshotImpl(const char* name, int type);
+ HeapSnapshot* TakeSnapshotImpl(String* name, int type);
- // Obsolete interface.
- // Update the array info with stats from obj.
- static void CollectStats(HeapObject* obj, HistogramInfo* info);
-
HeapSnapshotsCollection* snapshots_;
unsigned next_snapshot_uid_;
@@ -132,7 +128,9 @@
bool is_null() const { return constructor_ == NULL; }
bool can_be_coarsed() const { return instance_ != NULL; }
String* constructor() const { return constructor_; }
+ Object* instance() const { return instance_; }
+ const char* GetSpecialCaseName() const;
void Print(StringStream* accumulator) const;
// Allows null clusters to be printed.
void DebugPrint(StringStream* accumulator) const;
@@ -179,6 +177,9 @@
virtual ~ConstructorHeapProfile() {}
void CollectStats(HeapObject* obj);
void PrintStats();
+
+ template<class Callback>
+ void ForEach(Callback* callback) { js_objects_info_tree_.ForEach(callback); }
// Used by ZoneSplayTree::ForEach. Made virtual to allow overriding in tests.
virtual void Call(const JSObjectsCluster& cluster,
const NumberAndSizeInfo& number_and_size);
@@ -282,6 +283,8 @@
// "retainer profile" of JS objects allocated on heap.
// It is run during garbage collection cycle, thus it doesn't need
// to use handles.
+class RetainerTreeAggregator;
+
class RetainerHeapProfile BASE_EMBEDDED {
public:
class Printer {
@@ -292,7 +295,14 @@
};
RetainerHeapProfile();
+ ~RetainerHeapProfile();
+
+ RetainerTreeAggregator* aggregator() { return aggregator_; }
+ ClustersCoarser* coarser() { return &coarser_; }
+ JSObjectsRetainerTree* retainers_tree() { return &retainers_tree_; }
+
void CollectStats(HeapObject* obj);
+ void CoarseAndAggregate();
void PrintStats();
void DebugPrintStats(Printer* printer);
void StoreReference(const JSObjectsCluster& cluster, HeapObject* ref);
@@ -301,9 +311,47 @@
ZoneScope zscope_;
JSObjectsRetainerTree retainers_tree_;
ClustersCoarser coarser_;
+ RetainerTreeAggregator* aggregator_;
};
+class AggregatedHeapSnapshot {
+ public:
+ AggregatedHeapSnapshot();
+ ~AggregatedHeapSnapshot();
+
+ HistogramInfo* info() { return info_; }
+ ConstructorHeapProfile* js_cons_profile() { return &js_cons_profile_; }
+ RetainerHeapProfile* js_retainer_profile() { return &js_retainer_profile_; }
+
+ private:
+ HistogramInfo* info_;
+ ConstructorHeapProfile js_cons_profile_;
+ RetainerHeapProfile js_retainer_profile_;
+};
+
+
+class HeapEntriesMap;
+class HeapSnapshot;
+
+class AggregatedHeapSnapshotGenerator {
+ public:
+ explicit AggregatedHeapSnapshotGenerator(AggregatedHeapSnapshot* snapshot);
+ void GenerateSnapshot();
+ void FillHeapSnapshot(HeapSnapshot* snapshot);
+
+ static const int kAllStringsType = LAST_TYPE + 1;
+
+ private:
+ void CalculateStringsStats();
+ void CollectStats(HeapObject* obj);
+ template<class Iterator>
+ void IterateRetainers(HeapEntriesMap* entries_map);
+
+ AggregatedHeapSnapshot* agg_snapshot_;
+};
+
+
class ProducerHeapProfile : public AllStatic {
public:
static void Setup();
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698