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

Unified Diff: runtime/vm/thread_pool.cc

Issue 2582543003: Update GC stats, ThreadPool, Timer and ScopedTimer to use monotonic time. (Closed)
Patch Set: . Created 4 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/scope_timer.h ('k') | runtime/vm/thread_pool_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_pool.cc
diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc
index 40ca9d57ec344bd7763db51a9c4a53ab695dd953..8377894d7e8be75143ab373a83df6090c710c690 100644
--- a/runtime/vm/thread_pool.cc
+++ b/runtime/vm/thread_pool.cc
@@ -11,8 +11,8 @@
namespace dart {
DEFINE_FLAG(int,
- worker_timeout_millis,
- 5000,
+ worker_timeout_micros,
+ 5000000,
Cutch 2016/12/15 22:59:24 consider keeping the command line flag backwards c
rmacnak 2016/12/15 23:11:27 Done.
"Free workers when they have been idle for this amount of time.");
ThreadPool::ThreadPool()
@@ -370,18 +370,18 @@ void ThreadPool::Worker::SetTask(Task* task) {
static int64_t ComputeTimeout(int64_t idle_start) {
- if (FLAG_worker_timeout_millis <= 0) {
+ if (FLAG_worker_timeout_micros <= 0) {
// No timeout.
return 0;
} else {
- int64_t waited = OS::GetCurrentTimeMillis() - idle_start;
- if (waited >= FLAG_worker_timeout_millis) {
+ int64_t waited = OS::GetCurrentMonotonicMicros() - idle_start;
+ if (waited >= FLAG_worker_timeout_micros) {
// We must have gotten a spurious wakeup just before we timed
// out. Give the worker one last desperate chance to live. We
// are merciful.
return 1;
} else {
- return FLAG_worker_timeout_millis - waited;
+ return FLAG_worker_timeout_micros - waited;
}
}
}
@@ -408,9 +408,9 @@ bool ThreadPool::Worker::Loop() {
}
ASSERT(!done_);
pool_->SetIdleAndReapExited(this);
- idle_start = OS::GetCurrentTimeMillis();
+ idle_start = OS::GetCurrentMonotonicMicros();
while (true) {
- Monitor::WaitResult result = ml.Wait(ComputeTimeout(idle_start));
+ Monitor::WaitResult result = ml.WaitMicros(ComputeTimeout(idle_start));
if (task_ != NULL) {
// We've found a task. Process it, regardless of whether the
// worker is done_.
« no previous file with comments | « runtime/vm/scope_timer.h ('k') | runtime/vm/thread_pool_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698