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

Unified Diff: runtime/vm/profiler.cc

Issue 1541893002: Support narrowing a cpu profile to a given time window (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « runtime/vm/profiler.h ('k') | runtime/vm/profiler_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index ff0139352ea39069273b0c5a90167f2d4809a135..4d30ba4c129f3a804e671f055e72b44f8baa75e8 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -296,6 +296,18 @@ bool ReturnAddressLocator::LocateReturnAddress(uword* return_address) {
#endif
+bool SampleFilter::TimeFilterSample(Sample* sample) {
+ if ((time_origin_micros_ == -1) ||
+ (time_extent_micros_ == -1)) {
+ // No time filter passed in, always pass.
+ return true;
+ }
+ const int64_t timestamp = sample->timestamp();
+ int64_t delta = timestamp - time_origin_micros_;
+ return (delta >= 0) && (delta < time_extent_micros_);
+}
+
+
ClearProfileVisitor::ClearProfileVisitor(Isolate* isolate)
: SampleVisitor(isolate) {
}
@@ -1208,6 +1220,10 @@ ProcessedSampleBuffer* SampleBuffer::BuildProcessedSampleBuffer(
// No frames.
continue;
}
+ if (!filter->TimeFilterSample(sample)) {
+ // Did not pass time filter.
+ continue;
+ }
if (!filter->FilterSample(sample)) {
// Did not pass filter.
continue;
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/profiler_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698