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

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

Issue 1740073002: Make CPU profiler unwind the inlined functions stack. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebaseline Created 4 years, 9 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
« no previous file with comments | « src/profiler/cpu-profiler.cc ('k') | src/profiler/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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PROFILER_PROFILE_GENERATOR_H_ 5 #ifndef V8_PROFILER_PROFILE_GENERATOR_H_
6 #define V8_PROFILER_PROFILE_GENERATOR_H_ 6 #define V8_PROFILER_PROFILE_GENERATOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include "include/v8-profiler.h" 9 #include "include/v8-profiler.h"
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void SetBuiltinId(Builtins::Name id); 92 void SetBuiltinId(Builtins::Name id);
93 Builtins::Name builtin_id() const { 93 Builtins::Name builtin_id() const {
94 return BuiltinIdField::decode(bit_field_); 94 return BuiltinIdField::decode(bit_field_);
95 } 95 }
96 96
97 uint32_t GetHash() const; 97 uint32_t GetHash() const;
98 bool IsSameFunctionAs(CodeEntry* entry) const; 98 bool IsSameFunctionAs(CodeEntry* entry) const;
99 99
100 int GetSourceLine(int pc_offset) const; 100 int GetSourceLine(int pc_offset) const;
101 101
102 void AddInlineStack(int pc_offset, std::vector<CodeEntry*>& inline_stack);
103 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const;
104
102 Address instruction_start() const { return instruction_start_; } 105 Address instruction_start() const { return instruction_start_; }
106 Logger::LogEventsAndTags tag() const { return TagField::decode(bit_field_); }
103 107
104 static const char* const kEmptyNamePrefix; 108 static const char* const kEmptyNamePrefix;
105 static const char* const kEmptyResourceName; 109 static const char* const kEmptyResourceName;
106 static const char* const kEmptyBailoutReason; 110 static const char* const kEmptyBailoutReason;
107 static const char* const kNoDeoptReason; 111 static const char* const kNoDeoptReason;
108 112
109 private: 113 private:
110 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {}; 114 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {};
111 class BuiltinIdField : public BitField<Builtins::Name, 8, 8> {}; 115 class BuiltinIdField : public BitField<Builtins::Name, 8, 8> {};
112 Logger::LogEventsAndTags tag() const { return TagField::decode(bit_field_); }
113 116
114 uint32_t bit_field_; 117 uint32_t bit_field_;
115 const char* name_prefix_; 118 const char* name_prefix_;
116 const char* name_; 119 const char* name_;
117 const char* resource_name_; 120 const char* resource_name_;
118 int line_number_; 121 int line_number_;
119 int column_number_; 122 int column_number_;
120 int script_id_; 123 int script_id_;
121 int position_; 124 int position_;
122 const char* bailout_reason_; 125 const char* bailout_reason_;
123 const char* deopt_reason_; 126 const char* deopt_reason_;
124 SourcePosition deopt_position_; 127 SourcePosition deopt_position_;
125 size_t pc_offset_; 128 size_t pc_offset_;
126 JITLineInfoTable* line_info_; 129 JITLineInfoTable* line_info_;
127 Address instruction_start_; 130 Address instruction_start_;
131 // Should be an unordered_map, but it doesn't currently work on Win & MacOS.
132 std::map<int, std::vector<CodeEntry*>> inline_locations_;
128 133
129 std::vector<InlinedFunctionInfo> inlined_function_infos_; 134 std::vector<InlinedFunctionInfo> inlined_function_infos_;
130 135
131 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 136 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
132 }; 137 };
133 138
134 139
135 class ProfileTree; 140 class ProfileTree;
136 141
137 class ProfileNode { 142 class ProfileNode {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 DISALLOW_COPY_AND_ASSIGN(ProfileNode); 189 DISALLOW_COPY_AND_ASSIGN(ProfileNode);
185 }; 190 };
186 191
187 192
188 class ProfileTree { 193 class ProfileTree {
189 public: 194 public:
190 explicit ProfileTree(Isolate* isolate); 195 explicit ProfileTree(Isolate* isolate);
191 ~ProfileTree(); 196 ~ProfileTree();
192 197
193 ProfileNode* AddPathFromEnd( 198 ProfileNode* AddPathFromEnd(
194 const Vector<CodeEntry*>& path, 199 const std::vector<CodeEntry*>& path,
195 int src_line = v8::CpuProfileNode::kNoLineNumberInfo, 200 int src_line = v8::CpuProfileNode::kNoLineNumberInfo,
196 bool update_stats = true); 201 bool update_stats = true);
197 ProfileNode* root() const { return root_; } 202 ProfileNode* root() const { return root_; }
198 unsigned next_node_id() { return next_node_id_++; } 203 unsigned next_node_id() { return next_node_id_++; }
199 unsigned GetFunctionId(const ProfileNode* node); 204 unsigned GetFunctionId(const ProfileNode* node);
200 205
201 void Print() { 206 void Print() {
202 root_->Print(0); 207 root_->Print(0);
203 } 208 }
204 209
(...skipping 13 matching lines...) Expand all
218 223
219 DISALLOW_COPY_AND_ASSIGN(ProfileTree); 224 DISALLOW_COPY_AND_ASSIGN(ProfileTree);
220 }; 225 };
221 226
222 227
223 class CpuProfile { 228 class CpuProfile {
224 public: 229 public:
225 CpuProfile(Isolate* isolate, const char* title, bool record_samples); 230 CpuProfile(Isolate* isolate, const char* title, bool record_samples);
226 231
227 // Add pc -> ... -> main() call path to the profile. 232 // Add pc -> ... -> main() call path to the profile.
228 void AddPath(base::TimeTicks timestamp, const Vector<CodeEntry*>& path, 233 void AddPath(base::TimeTicks timestamp, const std::vector<CodeEntry*>& path,
229 int src_line, bool update_stats); 234 int src_line, bool update_stats);
230 void CalculateTotalTicksAndSamplingRate(); 235 void CalculateTotalTicksAndSamplingRate();
231 236
232 const char* title() const { return title_; } 237 const char* title() const { return title_; }
233 const ProfileTree* top_down() const { return &top_down_; } 238 const ProfileTree* top_down() const { return &top_down_; }
234 239
235 int samples_count() const { return samples_.length(); } 240 int samples_count() const { return samples_.length(); }
236 ProfileNode* sample(int index) const { return samples_.at(index); } 241 ProfileNode* sample(int index) const { return samples_.at(index); }
237 base::TimeTicks sample_timestamp(int index) const { 242 base::TimeTicks sample_timestamp(int index) const {
238 return timestamps_.at(index); 243 return timestamps_.at(index);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 CodeEntry* NewCodeEntry( 332 CodeEntry* NewCodeEntry(
328 Logger::LogEventsAndTags tag, const char* name, 333 Logger::LogEventsAndTags tag, const char* name,
329 const char* name_prefix = CodeEntry::kEmptyNamePrefix, 334 const char* name_prefix = CodeEntry::kEmptyNamePrefix,
330 const char* resource_name = CodeEntry::kEmptyResourceName, 335 const char* resource_name = CodeEntry::kEmptyResourceName,
331 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, 336 int line_number = v8::CpuProfileNode::kNoLineNumberInfo,
332 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, 337 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo,
333 JITLineInfoTable* line_info = NULL, Address instruction_start = NULL); 338 JITLineInfoTable* line_info = NULL, Address instruction_start = NULL);
334 339
335 // Called from profile generator thread. 340 // Called from profile generator thread.
336 void AddPathToCurrentProfiles(base::TimeTicks timestamp, 341 void AddPathToCurrentProfiles(base::TimeTicks timestamp,
337 const Vector<CodeEntry*>& path, int src_line, 342 const std::vector<CodeEntry*>& path,
338 bool update_stats); 343 int src_line, bool update_stats);
339 344
340 // Limits the number of profiles that can be simultaneously collected. 345 // Limits the number of profiles that can be simultaneously collected.
341 static const int kMaxSimultaneousProfiles = 100; 346 static const int kMaxSimultaneousProfiles = 100;
342 347
343 private: 348 private:
344 StringsStorage function_and_resource_names_; 349 StringsStorage function_and_resource_names_;
345 List<CodeEntry*> code_entries_; 350 List<CodeEntry*> code_entries_;
346 List<CpuProfile*> finished_profiles_; 351 List<CpuProfile*> finished_profiles_;
347 352
348 Isolate* isolate_; 353 Isolate* isolate_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 CodeEntry* unresolved_entry_; 386 CodeEntry* unresolved_entry_;
382 387
383 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); 388 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
384 }; 389 };
385 390
386 391
387 } // namespace internal 392 } // namespace internal
388 } // namespace v8 393 } // namespace v8
389 394
390 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ 395 #endif // V8_PROFILER_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/profiler/cpu-profiler.cc ('k') | src/profiler/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698