| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // Remove child from the stack. | 348 // Remove child from the stack. |
| 349 stack.RemoveLast(); | 349 stack.RemoveLast(); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 | 353 |
| 354 | 354 |
| 355 CpuProfile::CpuProfile(const char* title, bool record_samples) | 355 CpuProfile::CpuProfile(const char* title, bool record_samples) |
| 356 : title_(title), | 356 : title_(title), |
| 357 record_samples_(record_samples), | 357 record_samples_(record_samples), |
| 358 start_time_(Time::NowFromSystemTime()) { | 358 start_time_(TimeTicks::HighResolutionNow()) { |
| 359 timer_.Start(); | |
| 360 } | 359 } |
| 361 | 360 |
| 362 | 361 |
| 363 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) { | 362 void CpuProfile::AddPath(const Vector<CodeEntry*>& path) { |
| 364 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); | 363 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); |
| 365 if (record_samples_) samples_.Add(top_frame_node); | 364 if (record_samples_) samples_.Add(top_frame_node); |
| 366 } | 365 } |
| 367 | 366 |
| 368 | 367 |
| 369 void CpuProfile::CalculateTotalTicksAndSamplingRate() { | 368 void CpuProfile::CalculateTotalTicksAndSamplingRate() { |
| 370 end_time_ = start_time_ + timer_.Elapsed(); | 369 end_time_ = TimeTicks::HighResolutionNow(); |
| 371 } | 370 } |
| 372 | 371 |
| 373 | 372 |
| 374 void CpuProfile::Print() { | 373 void CpuProfile::Print() { |
| 375 OS::Print("[Top down]:\n"); | 374 OS::Print("[Top down]:\n"); |
| 376 top_down_.Print(); | 375 top_down_.Print(); |
| 377 } | 376 } |
| 378 | 377 |
| 379 | 378 |
| 380 CodeEntry* const CodeMap::kSharedFunctionCodeEntry = NULL; | 379 CodeEntry* const CodeMap::kSharedFunctionCodeEntry = NULL; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 case OTHER: | 690 case OTHER: |
| 692 case EXTERNAL: | 691 case EXTERNAL: |
| 693 return program_entry_; | 692 return program_entry_; |
| 694 case IDLE: | 693 case IDLE: |
| 695 return idle_entry_; | 694 return idle_entry_; |
| 696 default: return NULL; | 695 default: return NULL; |
| 697 } | 696 } |
| 698 } | 697 } |
| 699 | 698 |
| 700 } } // namespace v8::internal | 699 } } // namespace v8::internal |
| OLD | NEW |