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

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

Issue 18053004: CpuProfiler: eliminate 2 layers of 4 for CodeCreateEvent calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: win32 compile error was fixed Created 7 years, 5 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
« no previous file with comments | « src/cpu-profiler-inl.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 HashMap names_; 90 HashMap names_;
91 91
92 DISALLOW_COPY_AND_ASSIGN(StringsStorage); 92 DISALLOW_COPY_AND_ASSIGN(StringsStorage);
93 }; 93 };
94 94
95 95
96 class CodeEntry { 96 class CodeEntry {
97 public: 97 public:
98 // CodeEntry doesn't own name strings, just references them. 98 // CodeEntry doesn't own name strings, just references them.
99 INLINE(CodeEntry(Logger::LogEventsAndTags tag, 99 INLINE(CodeEntry(Logger::LogEventsAndTags tag,
100 const char* name_prefix,
101 const char* name, 100 const char* name,
102 int security_token_id = TokenEnumerator::kNoSecurityToken, 101 int security_token_id = TokenEnumerator::kNoSecurityToken,
102 const char* name_prefix = CodeEntry::kEmptyNamePrefix,
103 const char* resource_name = CodeEntry::kEmptyResourceName, 103 const char* resource_name = CodeEntry::kEmptyResourceName,
104 int line_number = v8::CpuProfileNode::kNoLineNumberInfo)); 104 int line_number = v8::CpuProfileNode::kNoLineNumberInfo));
105 ~CodeEntry(); 105 ~CodeEntry();
106 106
107 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); } 107 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
108 INLINE(const char* name_prefix() const) { return name_prefix_; } 108 INLINE(const char* name_prefix() const) { return name_prefix_; }
109 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; } 109 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; }
110 INLINE(const char* name() const) { return name_; } 110 INLINE(const char* name() const) { return name_; }
111 INLINE(const char* resource_name() const) { return resource_name_; } 111 INLINE(const char* resource_name() const) { return resource_name_; }
112 INLINE(int line_number() const) { return line_number_; } 112 INLINE(int line_number() const) { return line_number_; }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 CpuProfile* StopProfiling(int security_token_id, 311 CpuProfile* StopProfiling(int security_token_id,
312 const char* title, 312 const char* title,
313 double actual_sampling_rate); 313 double actual_sampling_rate);
314 List<CpuProfile*>* Profiles(int security_token_id); 314 List<CpuProfile*>* Profiles(int security_token_id);
315 const char* GetName(Name* name) { 315 const char* GetName(Name* name) {
316 return function_and_resource_names_.GetName(name); 316 return function_and_resource_names_.GetName(name);
317 } 317 }
318 const char* GetName(int args_count) { 318 const char* GetName(int args_count) {
319 return function_and_resource_names_.GetName(args_count); 319 return function_and_resource_names_.GetName(args_count);
320 } 320 }
321 const char* GetFunctionName(Name* name) {
322 return function_and_resource_names_.GetFunctionName(name);
323 }
324 const char* GetFunctionName(const char* name) {
325 return function_and_resource_names_.GetFunctionName(name);
326 }
321 CpuProfile* GetProfile(int security_token_id, unsigned uid); 327 CpuProfile* GetProfile(int security_token_id, unsigned uid);
322 bool IsLastProfile(const char* title); 328 bool IsLastProfile(const char* title);
323 void RemoveProfile(CpuProfile* profile); 329 void RemoveProfile(CpuProfile* profile);
324 bool HasDetachedProfiles() { return detached_profiles_.length() > 0; } 330 bool HasDetachedProfiles() { return detached_profiles_.length() > 0; }
325 331
326 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, 332 CodeEntry* NewCodeEntry(
327 Name* name, String* resource_name, int line_number); 333 Logger::LogEventsAndTags tag,
328 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, const char* name); 334 const char* name,
329 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, 335 int security_token_id = TokenEnumerator::kNoSecurityToken,
330 const char* name_prefix, Name* name); 336 const char* name_prefix = CodeEntry::kEmptyNamePrefix,
331 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, int args_count); 337 const char* resource_name = CodeEntry::kEmptyResourceName,
332 CodeEntry* NewCodeEntry(int security_token_id); 338 int line_number = v8::CpuProfileNode::kNoLineNumberInfo);
333 339
334 // Called from profile generator thread. 340 // Called from profile generator thread.
335 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path); 341 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path);
336 342
337 // Limits the number of profiles that can be simultaneously collected. 343 // Limits the number of profiles that can be simultaneously collected.
338 static const int kMaxSimultaneousProfiles = 100; 344 static const int kMaxSimultaneousProfiles = 100;
339 345
340 private: 346 private:
341 const char* GetFunctionName(Name* name) {
342 return function_and_resource_names_.GetFunctionName(name);
343 }
344 const char* GetFunctionName(const char* name) {
345 return function_and_resource_names_.GetFunctionName(name);
346 }
347 int GetProfileIndex(unsigned uid); 347 int GetProfileIndex(unsigned uid);
348 List<CpuProfile*>* GetProfilesList(int security_token_id); 348 List<CpuProfile*>* GetProfilesList(int security_token_id);
349 int TokenToIndex(int security_token_id); 349 int TokenToIndex(int security_token_id);
350 350
351 INLINE(static bool UidsMatch(void* key1, void* key2)) { 351 INLINE(static bool UidsMatch(void* key1, void* key2)) {
352 return key1 == key2; 352 return key1 == key2;
353 } 353 }
354 354
355 StringsStorage function_and_resource_names_; 355 StringsStorage function_and_resource_names_;
356 List<CodeEntry*> code_entries_; 356 List<CodeEntry*> code_entries_;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 CodeEntry* gc_entry_; 432 CodeEntry* gc_entry_;
433 SampleRateCalculator sample_rate_calc_; 433 SampleRateCalculator sample_rate_calc_;
434 434
435 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); 435 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
436 }; 436 };
437 437
438 438
439 } } // namespace v8::internal 439 } } // namespace v8::internal
440 440
441 #endif // V8_PROFILE_GENERATOR_H_ 441 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/cpu-profiler-inl.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698