Switch CPU profile start/stop markers to monotonic time.

LOG=N
BUG=363976
R=bmeurer@chromium.org, yurys@chromium.org

Review URL: https://codereview.chromium.org/243033002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20866 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
alph@chromium.org 2014-04-19 14:33:18 +00:00
parent 3416e7bc49
commit b97a2a2585
4 changed files with 13 additions and 14 deletions

View File

@ -118,14 +118,15 @@ class V8_EXPORT CpuProfile {
const CpuProfileNode* GetSample(int index) const;
/**
* Returns time when the profile recording started (in microseconds
* since the Epoch).
* Returns time when the profile recording was started (in microseconds)
* since some unspecified starting point.
*/
int64_t GetStartTime() const;
/**
* Returns time when the profile recording was stopped (in microseconds
* since the Epoch).
* Returns time when the profile recording was stopped (in microseconds)
* since some unspecified starting point. The point is however equal to the
* starting point used by GetStartTime.
*/
int64_t GetEndTime() const;

View File

@ -7084,13 +7084,13 @@ const CpuProfileNode* CpuProfile::GetSample(int index) const {
int64_t CpuProfile::GetStartTime() const {
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
return (profile->start_time() - i::Time::UnixEpoch()).InMicroseconds();
return (profile->start_time() - i::TimeTicks()).InMicroseconds();
}
int64_t CpuProfile::GetEndTime() const {
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
return (profile->end_time() - i::Time::UnixEpoch()).InMicroseconds();
return (profile->end_time() - i::TimeTicks()).InMicroseconds();
}

View File

@ -355,8 +355,7 @@ void ProfileTree::TraverseDepthFirst(Callback* callback) {
CpuProfile::CpuProfile(const char* title, bool record_samples)
: title_(title),
record_samples_(record_samples),
start_time_(Time::NowFromSystemTime()) {
timer_.Start();
start_time_(TimeTicks::HighResolutionNow()) {
}
@ -367,7 +366,7 @@ void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {
void CpuProfile::CalculateTotalTicksAndSamplingRate() {
end_time_ = start_time_ + timer_.Elapsed();
end_time_ = TimeTicks::HighResolutionNow();
}

View File

@ -208,8 +208,8 @@ class CpuProfile {
int samples_count() const { return samples_.length(); }
ProfileNode* sample(int index) const { return samples_.at(index); }
Time start_time() const { return start_time_; }
Time end_time() const { return end_time_; }
TimeTicks start_time() const { return start_time_; }
TimeTicks end_time() const { return end_time_; }
void UpdateTicksScale();
@ -218,9 +218,8 @@ class CpuProfile {
private:
const char* title_;
bool record_samples_;
Time start_time_;
Time end_time_;
ElapsedTimer timer_;
TimeTicks start_time_;
TimeTicks end_time_;
List<ProfileNode*> samples_;
ProfileTree top_down_;