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

Unified Diff: src/profile-generator.cc

Issue 259803002: Add timestamps to CPU profile samples. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix race Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profile-generator.h ('k') | src/sampler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index ae37648e5ea99cb1cf754cbafb56c5f020575ce1..2587317c8ae09639323e62995108a74e5d74875c 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -359,9 +359,12 @@ CpuProfile::CpuProfile(const char* title, bool record_samples)
}
-void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {
+void CpuProfile::AddPath(TimeTicks timestamp, const Vector<CodeEntry*>& path) {
ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path);
- if (record_samples_) samples_.Add(top_frame_node);
+ if (record_samples_) {
+ timestamps_.Add(timestamp);
+ samples_.Add(top_frame_node);
+ }
}
@@ -545,13 +548,13 @@ void CpuProfilesCollection::RemoveProfile(CpuProfile* profile) {
void CpuProfilesCollection::AddPathToCurrentProfiles(
- const Vector<CodeEntry*>& path) {
+ TimeTicks timestamp, const Vector<CodeEntry*>& path) {
// As starting / stopping profiles is rare relatively to this
// method, we don't bother minimizing the duration of lock holding,
// e.g. copying contents of the list to a local vector.
current_profiles_semaphore_.Wait();
for (int i = 0; i < current_profiles_.length(); ++i) {
- current_profiles_[i]->AddPath(path);
+ current_profiles_[i]->AddPath(timestamp, path);
}
current_profiles_semaphore_.Signal();
}
@@ -674,7 +677,7 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) {
}
}
- profiles_->AddPathToCurrentProfiles(entries);
+ profiles_->AddPathToCurrentProfiles(sample.timestamp, entries);
}
« no previous file with comments | « src/profile-generator.h ('k') | src/sampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698