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

Side by Side Diff: src/profile-generator.h

Issue 10535096: Implement heap profiler memory usage reporting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make sizeof to be conformant to C++ guide. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 StringsStorage(); 65 StringsStorage();
66 ~StringsStorage(); 66 ~StringsStorage();
67 67
68 const char* GetCopy(const char* src); 68 const char* GetCopy(const char* src);
69 const char* GetFormatted(const char* format, ...); 69 const char* GetFormatted(const char* format, ...);
70 const char* GetVFormatted(const char* format, va_list args); 70 const char* GetVFormatted(const char* format, va_list args);
71 const char* GetName(String* name); 71 const char* GetName(String* name);
72 const char* GetName(int index); 72 const char* GetName(int index);
73 inline const char* GetFunctionName(String* name); 73 inline const char* GetFunctionName(String* name);
74 inline const char* GetFunctionName(const char* name); 74 inline const char* GetFunctionName(const char* name);
75 size_t GetUsedMemorySize() const;
75 76
76 private: 77 private:
77 static const int kMaxNameSize = 1024; 78 static const int kMaxNameSize = 1024;
78 79
79 INLINE(static bool StringsMatch(void* key1, void* key2)) { 80 INLINE(static bool StringsMatch(void* key1, void* key2)) {
80 return strcmp(reinterpret_cast<char*>(key1), 81 return strcmp(reinterpret_cast<char*>(key1),
81 reinterpret_cast<char*>(key2)) == 0; 82 reinterpret_cast<char*>(key2)) == 0;
82 } 83 }
83 const char* AddOrDisposeString(char* str, uint32_t hash); 84 const char* AddOrDisposeString(char* str, uint32_t hash);
84 85
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 void SnapshotGenerationFinished(); 644 void SnapshotGenerationFinished();
644 SnapshotObjectId FindEntry(Address addr); 645 SnapshotObjectId FindEntry(Address addr);
645 SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size); 646 SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size);
646 void MoveObject(Address from, Address to); 647 void MoveObject(Address from, Address to);
647 SnapshotObjectId last_assigned_id() const { 648 SnapshotObjectId last_assigned_id() const {
648 return next_id_ - kObjectIdStep; 649 return next_id_ - kObjectIdStep;
649 } 650 }
650 651
651 void StopHeapObjectsTracking(); 652 void StopHeapObjectsTracking();
652 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); 653 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
654 size_t GetUsedMemorySize() const;
653 655
654 static SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info); 656 static SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info);
655 static inline SnapshotObjectId GetNthGcSubrootId(int delta); 657 static inline SnapshotObjectId GetNthGcSubrootId(int delta);
656 658
657 static const int kObjectIdStep = 2; 659 static const int kObjectIdStep = 2;
658 static const SnapshotObjectId kInternalRootObjectId; 660 static const SnapshotObjectId kInternalRootObjectId;
659 static const SnapshotObjectId kGcRootsObjectId; 661 static const SnapshotObjectId kGcRootsObjectId;
660 static const SnapshotObjectId kNativesRootObjectId; 662 static const SnapshotObjectId kNativesRootObjectId;
661 static const SnapshotObjectId kGcRootsFirstSubrootId; 663 static const SnapshotObjectId kGcRootsFirstSubrootId;
662 static const SnapshotObjectId kFirstAvailableObjectId; 664 static const SnapshotObjectId kFirstAvailableObjectId;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 return ids_.FindEntry(object_addr); 729 return ids_.FindEntry(object_addr);
728 } 730 }
729 SnapshotObjectId GetObjectId(Address object_addr, int object_size) { 731 SnapshotObjectId GetObjectId(Address object_addr, int object_size) {
730 return ids_.FindOrAddEntry(object_addr, object_size); 732 return ids_.FindOrAddEntry(object_addr, object_size);
731 } 733 }
732 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); 734 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
733 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } 735 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); }
734 SnapshotObjectId last_assigned_id() const { 736 SnapshotObjectId last_assigned_id() const {
735 return ids_.last_assigned_id(); 737 return ids_.last_assigned_id();
736 } 738 }
739 size_t GetUsedMemorySize() const;
737 740
738 private: 741 private:
739 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { 742 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) {
740 return key1 == key2; 743 return key1 == key2;
741 } 744 }
742 745
743 bool is_tracking_objects_; // Whether tracking object moves is needed. 746 bool is_tracking_objects_; // Whether tracking object moves is needed.
744 List<HeapSnapshot*> snapshots_; 747 List<HeapSnapshot*> snapshots_;
745 // Mapping from snapshots' uids to HeapSnapshot* pointers. 748 // Mapping from snapshots' uids to HeapSnapshot* pointers.
746 HashMap snapshots_uids_; 749 HashMap snapshots_uids_;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1095
1093 friend class HeapSnapshotJSONSerializerEnumerator; 1096 friend class HeapSnapshotJSONSerializerEnumerator;
1094 friend class HeapSnapshotJSONSerializerIterator; 1097 friend class HeapSnapshotJSONSerializerIterator;
1095 1098
1096 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); 1099 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
1097 }; 1100 };
1098 1101
1099 } } // namespace v8::internal 1102 } } // namespace v8::internal
1100 1103
1101 #endif // V8_PROFILE_GENERATOR_H_ 1104 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« include/v8-profiler.h ('K') | « src/heap-profiler.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698