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; |