| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 double actual_sampling_rate); | 293 double actual_sampling_rate); |
| 294 List<CpuProfile*>* Profiles(int security_token_id); | 294 List<CpuProfile*>* Profiles(int security_token_id); |
| 295 const char* GetName(String* name) { | 295 const char* GetName(String* name) { |
| 296 return function_and_resource_names_.GetName(name); | 296 return function_and_resource_names_.GetName(name); |
| 297 } | 297 } |
| 298 const char* GetName(int args_count) { | 298 const char* GetName(int args_count) { |
| 299 return function_and_resource_names_.GetName(args_count); | 299 return function_and_resource_names_.GetName(args_count); |
| 300 } | 300 } |
| 301 CpuProfile* GetProfile(int security_token_id, unsigned uid); | 301 CpuProfile* GetProfile(int security_token_id, unsigned uid); |
| 302 bool IsLastProfile(const char* title); | 302 bool IsLastProfile(const char* title); |
| 303 void RemoveProfile(CpuProfile* profile); |
| 304 bool HasDetachedProfiles() { return detached_profiles_.length() > 0; } |
| 303 | 305 |
| 304 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, | 306 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, |
| 305 String* name, String* resource_name, int line_number); | 307 String* name, String* resource_name, int line_number); |
| 306 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, const char* name); | 308 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, const char* name); |
| 307 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, | 309 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, |
| 308 const char* name_prefix, String* name); | 310 const char* name_prefix, String* name); |
| 309 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, int args_count); | 311 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, int args_count); |
| 310 CodeEntry* NewCodeEntry(int security_token_id); | 312 CodeEntry* NewCodeEntry(int security_token_id); |
| 311 | 313 |
| 312 // Called from profile generator thread. | 314 // Called from profile generator thread. |
| 313 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path); | 315 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path); |
| 314 | 316 |
| 315 // Limits the number of profiles that can be simultaneously collected. | 317 // Limits the number of profiles that can be simultaneously collected. |
| 316 static const int kMaxSimultaneousProfiles = 100; | 318 static const int kMaxSimultaneousProfiles = 100; |
| 317 | 319 |
| 318 private: | 320 private: |
| 319 const char* GetFunctionName(String* name) { | 321 const char* GetFunctionName(String* name) { |
| 320 return function_and_resource_names_.GetFunctionName(name); | 322 return function_and_resource_names_.GetFunctionName(name); |
| 321 } | 323 } |
| 322 const char* GetFunctionName(const char* name) { | 324 const char* GetFunctionName(const char* name) { |
| 323 return function_and_resource_names_.GetFunctionName(name); | 325 return function_and_resource_names_.GetFunctionName(name); |
| 324 } | 326 } |
| 327 int GetProfileIndex(unsigned uid); |
| 325 List<CpuProfile*>* GetProfilesList(int security_token_id); | 328 List<CpuProfile*>* GetProfilesList(int security_token_id); |
| 326 int TokenToIndex(int security_token_id); | 329 int TokenToIndex(int security_token_id); |
| 327 | 330 |
| 328 INLINE(static bool UidsMatch(void* key1, void* key2)) { | 331 INLINE(static bool UidsMatch(void* key1, void* key2)) { |
| 329 return key1 == key2; | 332 return key1 == key2; |
| 330 } | 333 } |
| 331 | 334 |
| 332 StringsStorage function_and_resource_names_; | 335 StringsStorage function_and_resource_names_; |
| 333 List<CodeEntry*> code_entries_; | 336 List<CodeEntry*> code_entries_; |
| 334 List<List<CpuProfile*>* > profiles_by_token_; | 337 List<List<CpuProfile*>* > profiles_by_token_; |
| 335 // Mapping from profiles' uids to indexes in the second nested list | 338 // Mapping from profiles' uids to indexes in the second nested list |
| 336 // of profiles_by_token_. | 339 // of profiles_by_token_. |
| 337 HashMap profiles_uids_; | 340 HashMap profiles_uids_; |
| 341 List<CpuProfile*> detached_profiles_; |
| 338 | 342 |
| 339 // Accessed by VM thread and profile generator thread. | 343 // Accessed by VM thread and profile generator thread. |
| 340 List<CpuProfile*> current_profiles_; | 344 List<CpuProfile*> current_profiles_; |
| 341 Semaphore* current_profiles_semaphore_; | 345 Semaphore* current_profiles_semaphore_; |
| 342 | 346 |
| 343 DISALLOW_COPY_AND_ASSIGN(CpuProfilesCollection); | 347 DISALLOW_COPY_AND_ASSIGN(CpuProfilesCollection); |
| 344 }; | 348 }; |
| 345 | 349 |
| 346 | 350 |
| 347 class SampleRateCalculator { | 351 class SampleRateCalculator { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 enum Type { | 670 enum Type { |
| 667 kFull = v8::HeapSnapshot::kFull, | 671 kFull = v8::HeapSnapshot::kFull, |
| 668 kAggregated = v8::HeapSnapshot::kAggregated | 672 kAggregated = v8::HeapSnapshot::kAggregated |
| 669 }; | 673 }; |
| 670 | 674 |
| 671 HeapSnapshot(HeapSnapshotsCollection* collection, | 675 HeapSnapshot(HeapSnapshotsCollection* collection, |
| 672 Type type, | 676 Type type, |
| 673 const char* title, | 677 const char* title, |
| 674 unsigned uid); | 678 unsigned uid); |
| 675 ~HeapSnapshot(); | 679 ~HeapSnapshot(); |
| 680 void Delete(); |
| 676 | 681 |
| 677 HeapSnapshotsCollection* collection() { return collection_; } | 682 HeapSnapshotsCollection* collection() { return collection_; } |
| 678 Type type() { return type_; } | 683 Type type() { return type_; } |
| 679 const char* title() { return title_; } | 684 const char* title() { return title_; } |
| 680 unsigned uid() { return uid_; } | 685 unsigned uid() { return uid_; } |
| 681 HeapEntry* root() { return root_entry_; } | 686 HeapEntry* root() { return root_entry_; } |
| 682 HeapEntry* gc_roots() { return gc_roots_entry_; } | 687 HeapEntry* gc_roots() { return gc_roots_entry_; } |
| 683 HeapEntry* natives_root() { return natives_root_entry_; } | 688 HeapEntry* natives_root() { return natives_root_entry_; } |
| 684 List<HeapEntry*>* entries() { return &entries_; } | 689 List<HeapEntry*>* entries() { return &entries_; } |
| 685 | 690 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 HeapSnapshotsCollection(); | 838 HeapSnapshotsCollection(); |
| 834 ~HeapSnapshotsCollection(); | 839 ~HeapSnapshotsCollection(); |
| 835 | 840 |
| 836 bool is_tracking_objects() { return is_tracking_objects_; } | 841 bool is_tracking_objects() { return is_tracking_objects_; } |
| 837 | 842 |
| 838 HeapSnapshot* NewSnapshot( | 843 HeapSnapshot* NewSnapshot( |
| 839 HeapSnapshot::Type type, const char* name, unsigned uid); | 844 HeapSnapshot::Type type, const char* name, unsigned uid); |
| 840 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 845 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
| 841 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 846 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
| 842 HeapSnapshot* GetSnapshot(unsigned uid); | 847 HeapSnapshot* GetSnapshot(unsigned uid); |
| 848 void RemoveSnapshot(HeapSnapshot* snapshot); |
| 843 | 849 |
| 844 StringsStorage* names() { return &names_; } | 850 StringsStorage* names() { return &names_; } |
| 845 TokenEnumerator* token_enumerator() { return token_enumerator_; } | 851 TokenEnumerator* token_enumerator() { return token_enumerator_; } |
| 846 | 852 |
| 847 uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); } | 853 uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); } |
| 848 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 854 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
| 849 | 855 |
| 850 HeapSnapshotsDiff* CompareSnapshots(HeapSnapshot* snapshot1, | 856 HeapSnapshotsDiff* CompareSnapshots(HeapSnapshot* snapshot1, |
| 851 HeapSnapshot* snapshot2); | 857 HeapSnapshot* snapshot2); |
| 852 | 858 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 }; | 1205 }; |
| 1200 | 1206 |
| 1201 | 1207 |
| 1202 String* GetConstructorNameForHeapProfile(JSObject* object); | 1208 String* GetConstructorNameForHeapProfile(JSObject* object); |
| 1203 | 1209 |
| 1204 } } // namespace v8::internal | 1210 } } // namespace v8::internal |
| 1205 | 1211 |
| 1206 #endif // ENABLE_LOGGING_AND_PROFILING | 1212 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1207 | 1213 |
| 1208 #endif // V8_PROFILE_GENERATOR_H_ | 1214 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |