OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 stack.RemoveLast(); | 327 stack.RemoveLast(); |
328 } | 328 } |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 | 332 |
333 CpuProfile::CpuProfile(const char* title, unsigned uid, bool record_samples) | 333 CpuProfile::CpuProfile(const char* title, unsigned uid, bool record_samples) |
334 : title_(title), | 334 : title_(title), |
335 uid_(uid), | 335 uid_(uid), |
336 record_samples_(record_samples), | 336 record_samples_(record_samples), |
337 start_time_(Time::NowFromSystemTime()) { | 337 start_time_us_(OS::Ticks()), |
338 timer_.Start(); | 338 end_time_us_(0) { |
339 } | 339 } |
340 | 340 |
341 | 341 |
342 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) { | 342 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) { |
343 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); | 343 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); |
344 if (record_samples_) samples_.Add(top_frame_node); | 344 if (record_samples_) samples_.Add(top_frame_node); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void CpuProfile::CalculateTotalTicksAndSamplingRate() { | 348 void CpuProfile::CalculateTotalTicksAndSamplingRate() { |
349 end_time_ = start_time_ + timer_.Elapsed(); | 349 end_time_us_ = OS::Ticks(); |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 void CpuProfile::Print() { | 353 void CpuProfile::Print() { |
354 OS::Print("[Top down]:\n"); | 354 OS::Print("[Top down]:\n"); |
355 top_down_.Print(); | 355 top_down_.Print(); |
356 } | 356 } |
357 | 357 |
358 | 358 |
359 CodeEntry* const CodeMap::kSharedFunctionCodeEntry = NULL; | 359 CodeEntry* const CodeMap::kSharedFunctionCodeEntry = NULL; |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 if (no_symbolized_entries) { | 652 if (no_symbolized_entries) { |
653 *entry++ = EntryForVMState(sample.state); | 653 *entry++ = EntryForVMState(sample.state); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 profiles_->AddPathToCurrentProfiles(entries); | 657 profiles_->AddPathToCurrentProfiles(entries); |
658 } | 658 } |
659 | 659 |
660 | 660 |
661 } } // namespace v8::internal | 661 } } // namespace v8::internal |
OLD | NEW |