OLD | NEW |
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 CodeEntry root_entry_; | 189 CodeEntry root_entry_; |
190 unsigned next_node_id_; | 190 unsigned next_node_id_; |
191 ProfileNode* root_; | 191 ProfileNode* root_; |
192 | 192 |
193 DISALLOW_COPY_AND_ASSIGN(ProfileTree); | 193 DISALLOW_COPY_AND_ASSIGN(ProfileTree); |
194 }; | 194 }; |
195 | 195 |
196 | 196 |
197 class CpuProfile { | 197 class CpuProfile { |
198 public: | 198 public: |
199 CpuProfile(const char* title, unsigned uid, bool record_samples); | 199 CpuProfile(const char* title, bool record_samples); |
200 | 200 |
201 // Add pc -> ... -> main() call path to the profile. | 201 // Add pc -> ... -> main() call path to the profile. |
202 void AddPath(const Vector<CodeEntry*>& path); | 202 void AddPath(const Vector<CodeEntry*>& path); |
203 void CalculateTotalTicksAndSamplingRate(); | 203 void CalculateTotalTicksAndSamplingRate(); |
204 | 204 |
205 const char* title() const { return title_; } | 205 const char* title() const { return title_; } |
206 unsigned uid() const { return uid_; } | |
207 const ProfileTree* top_down() const { return &top_down_; } | 206 const ProfileTree* top_down() const { return &top_down_; } |
208 | 207 |
209 int samples_count() const { return samples_.length(); } | 208 int samples_count() const { return samples_.length(); } |
210 ProfileNode* sample(int index) const { return samples_.at(index); } | 209 ProfileNode* sample(int index) const { return samples_.at(index); } |
211 | 210 |
212 Time start_time() const { return start_time_; } | 211 Time start_time() const { return start_time_; } |
213 Time end_time() const { return end_time_; } | 212 Time end_time() const { return end_time_; } |
214 | 213 |
215 void UpdateTicksScale(); | 214 void UpdateTicksScale(); |
216 | 215 |
217 void Print(); | 216 void Print(); |
218 | 217 |
219 private: | 218 private: |
220 const char* title_; | 219 const char* title_; |
221 unsigned uid_; | |
222 bool record_samples_; | 220 bool record_samples_; |
223 Time start_time_; | 221 Time start_time_; |
224 Time end_time_; | 222 Time end_time_; |
225 ElapsedTimer timer_; | 223 ElapsedTimer timer_; |
226 List<ProfileNode*> samples_; | 224 List<ProfileNode*> samples_; |
227 ProfileTree top_down_; | 225 ProfileTree top_down_; |
228 | 226 |
229 DISALLOW_COPY_AND_ASSIGN(CpuProfile); | 227 DISALLOW_COPY_AND_ASSIGN(CpuProfile); |
230 }; | 228 }; |
231 | 229 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 272 |
275 DISALLOW_COPY_AND_ASSIGN(CodeMap); | 273 DISALLOW_COPY_AND_ASSIGN(CodeMap); |
276 }; | 274 }; |
277 | 275 |
278 | 276 |
279 class CpuProfilesCollection { | 277 class CpuProfilesCollection { |
280 public: | 278 public: |
281 explicit CpuProfilesCollection(Heap* heap); | 279 explicit CpuProfilesCollection(Heap* heap); |
282 ~CpuProfilesCollection(); | 280 ~CpuProfilesCollection(); |
283 | 281 |
284 bool StartProfiling(const char* title, unsigned uid, bool record_samples); | 282 bool StartProfiling(const char* title, bool record_samples); |
285 CpuProfile* StopProfiling(const char* title); | 283 CpuProfile* StopProfiling(const char* title); |
286 List<CpuProfile*>* profiles() { return &finished_profiles_; } | 284 List<CpuProfile*>* profiles() { return &finished_profiles_; } |
287 const char* GetName(Name* name) { | 285 const char* GetName(Name* name) { |
288 return function_and_resource_names_.GetName(name); | 286 return function_and_resource_names_.GetName(name); |
289 } | 287 } |
290 const char* GetName(int args_count) { | 288 const char* GetName(int args_count) { |
291 return function_and_resource_names_.GetName(args_count); | 289 return function_and_resource_names_.GetName(args_count); |
292 } | 290 } |
293 const char* GetFunctionName(Name* name) { | 291 const char* GetFunctionName(Name* name) { |
294 return function_and_resource_names_.GetFunctionName(name); | 292 return function_and_resource_names_.GetFunctionName(name); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 CodeEntry* gc_entry_; | 350 CodeEntry* gc_entry_; |
353 CodeEntry* unresolved_entry_; | 351 CodeEntry* unresolved_entry_; |
354 | 352 |
355 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 353 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
356 }; | 354 }; |
357 | 355 |
358 | 356 |
359 } } // namespace v8::internal | 357 } } // namespace v8::internal |
360 | 358 |
361 #endif // V8_PROFILE_GENERATOR_H_ | 359 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |