Index: runtime/vm/profiler.cc |
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
index 694d18a30ddbcc17b98d41e5604698cd0d02d5ee..a4e12927e3fd6818125d05c8f046e3070742c807 100644 |
--- a/runtime/vm/profiler.cc |
+++ b/runtime/vm/profiler.cc |
@@ -37,12 +37,15 @@ namespace dart { |
DEFINE_FLAG(bool, trace_profiled_isolates, false, "Trace profiled isolates."); |
DEFINE_FLAG(charp, profile_dir, NULL, |
"Enable writing profile data into specified directory."); |
+DEFINE_FLAG(int, profile_period, 1000, |
+ "Time between profiler samples in microseconds. Minimum 250."); |
bool Profiler::initialized_ = false; |
Monitor* Profiler::monitor_ = NULL; |
SampleBuffer* Profiler::sample_buffer_ = NULL; |
void Profiler::InitOnce() { |
+ const int kMinimumProfilePeriod = 250; |
if (!FLAG_profile) { |
return; |
} |
@@ -52,6 +55,10 @@ void Profiler::InitOnce() { |
sample_buffer_ = new SampleBuffer(); |
NativeSymbolResolver::InitOnce(); |
ThreadInterrupter::InitOnce(); |
+ if (FLAG_profile_period < kMinimumProfilePeriod) { |
+ FLAG_profile_period = kMinimumProfilePeriod; |
+ } |
+ ThreadInterrupter::SetInterruptPeriod(FLAG_profile_period); |
} |