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

Unified Diff: src/profile-generator.h

Issue 3124024: Heap profiler: allow returning aggregated snapshots via the new API. (Closed)
Patch Set: Comments addressed 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-profiler.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index bebf40a37641048ecb33f0f5c5c41751991c9984..5611b6fa4ed3bf05f6937e3012a2f6781dab7796 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -67,6 +67,8 @@ class StringsStorage {
~StringsStorage();
const char* GetName(String* name);
+ inline const char* GetFunctionName(String* name);
+ inline const char* GetFunctionName(const char* name);
private:
INLINE(static bool StringsMatch(void* key1, void* key2)) {
@@ -298,9 +300,13 @@ class CpuProfilesCollection {
void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path);
private:
- INLINE(const char* GetFunctionName(String* name));
- INLINE(const char* GetFunctionName(const char* name));
const char* GetName(int args_count);
+ const char* GetFunctionName(String* name) {
+ return function_and_resource_names_.GetFunctionName(name);
+ }
+ const char* GetFunctionName(const char* name) {
+ return function_and_resource_names_.GetFunctionName(name);
+ }
List<CpuProfile*>* GetProfilesList(int security_token_id);
int TokenToIndex(int security_token_id);
@@ -498,7 +504,6 @@ class HeapEntry BASE_EMBEDDED {
};
HeapEntry() { }
- void Init(HeapSnapshot* snapshot, int children_count, int retainers_count);
void Init(HeapSnapshot* snapshot,
Type type,
const char* name,
@@ -640,12 +645,19 @@ class HeapSnapshotsDiff;
// HeapSnapshotGenerator fills in a HeapSnapshot.
class HeapSnapshot {
public:
+ enum Type {
+ kFull = v8::HeapSnapshot::kFull,
+ kAggregated = v8::HeapSnapshot::kAggregated
+ };
+
HeapSnapshot(HeapSnapshotsCollection* collection,
+ Type type,
const char* title,
unsigned uid);
~HeapSnapshot();
HeapSnapshotsCollection* collection() { return collection_; }
+ Type type() { return type_; }
const char* title() { return title_; }
unsigned uid() { return uid_; }
HeapEntry* root() { return entries_[root_entry_index_]; }
@@ -655,6 +667,12 @@ class HeapSnapshot {
HeapEntry* AddEntry(
HeapObject* object, int children_count, int retainers_count);
bool WillAddEntry(HeapObject* object);
+ HeapEntry* AddEntry(HeapEntry::Type type,
+ const char* name,
+ uint64_t id,
+ int size,
+ int children_count,
+ int retainers_count);
int AddCalculatedData();
HeapEntryCalculatedData& GetCalculatedData(int index) {
return calculated_data_[index];
@@ -681,6 +699,7 @@ class HeapSnapshot {
static int CalculateNetworkSize(JSObject* obj);
HeapSnapshotsCollection* collection_;
+ Type type_;
const char* title_;
unsigned uid_;
int root_entry_index_;
@@ -688,6 +707,9 @@ class HeapSnapshot {
List<HeapEntry*> entries_;
bool entries_sorted_;
List<HeapEntryCalculatedData> calculated_data_;
+#ifdef DEBUG
+ int raw_entries_size_;
+#endif
friend class HeapSnapshotTester;
@@ -792,12 +814,16 @@ class HeapSnapshotsCollection {
bool is_tracking_objects() { return is_tracking_objects_; }
- HeapSnapshot* NewSnapshot(const char* name, unsigned uid);
+ HeapSnapshot* NewSnapshot(
+ HeapSnapshot::Type type, const char* name, unsigned uid);
void SnapshotGenerationFinished() { ids_.SnapshotGenerationFinished(); }
List<HeapSnapshot*>* snapshots() { return &snapshots_; }
HeapSnapshot* GetSnapshot(unsigned uid);
const char* GetName(String* name) { return names_.GetName(name); }
+ const char* GetFunctionName(String* name) {
+ return names_.GetFunctionName(name);
+ }
TokenEnumerator* token_enumerator() { return token_enumerator_; }
@@ -848,6 +874,8 @@ class HeapEntriesMap {
int total_children_count() { return total_children_count_; }
int total_retainers_count() { return total_retainers_count_; }
+ static HeapEntry *const kHeapEntryPlaceholder;
+
private:
struct EntryInfo {
explicit EntryInfo(HeapEntry* entry)
@@ -903,8 +931,6 @@ class HeapSnapshotGenerator {
HeapEntry* child_entry) = 0;
virtual void SetRootReference(Object* child_obj,
HeapEntry* child_entry) = 0;
-
- static HeapEntry *const kHeapEntryPlaceholder;
};
explicit HeapSnapshotGenerator(HeapSnapshot* snapshot);
« no previous file with comments | « src/heap-profiler.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698