summaryrefslogtreecommitdiffstats
path: root/base/threading/worker_pool_posix.cc
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-15 23:52:45 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-15 23:52:45 +0000
commit84b57956feca7dc25c01c5b5004f6e7eba99bdcc (patch)
tree013be8da7bbfc600cfde22cb03c11439278fd473 /base/threading/worker_pool_posix.cc
parentea8bc98be00e84fc16c30e0fbc440fe9c283c56c (diff)
downloadchromium_src-84b57956feca7dc25c01c5b5004f6e7eba99bdcc.zip
chromium_src-84b57956feca7dc25c01c5b5004f6e7eba99bdcc.tar.gz
chromium_src-84b57956feca7dc25c01c5b5004f6e7eba99bdcc.tar.bz2
Update task tracking to not depend on message_loop_ singleton
I also did a bunch of cleanup, and transitioned to tracking the duration of a run, rather than the time from posting (construction of a task) to completion of the run. It is less interesting for now to track queueing delay, and we need a focus on task execution time. I left in the hook (API) with the expectation that I'll be extending the tracked_objects code to include this as well. I also landed changes to run in Linux/Mac. The fact that I've punted on shutdown made this landing easy (all code support was previously lost during migration to some flavor of bind support). r=willchan,jam,viettrungluu,ajwong BUG=62728 Review URL: http://codereview.chromium.org/8233037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading/worker_pool_posix.cc')
-rw-r--r--base/threading/worker_pool_posix.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 3a4408c..b6c30e5 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -87,7 +87,15 @@ void WorkerThread::ThreadMain() {
UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run",
"src_file", pending_task.posted_from.file_name(),
"src_func", pending_task.posted_from.function_name());
+
+#if defined(TRACK_ALL_TASK_OBJECTS)
+ TimeTicks start_of_run = tracked_objects::ThreadData::Now();
+#endif // defined(TRACK_ALL_TASK_OBJECTS)
pending_task.task.Run();
+#if defined(TRACK_ALL_TASK_OBJECTS)
+ tracked_objects::ThreadData::TallyADeathIfActive(pending_task.post_births,
+ pending_task.time_posted, TimeTicks::TimeTicks(), start_of_run);
+#endif // defined(TRACK_ALL_TASK_OBJECTS)
}
// The WorkerThread is non-joinable, so it deletes itself.
@@ -113,6 +121,10 @@ PosixDynamicThreadPool::PendingTask::PendingTask(
const base::Closure& task)
: posted_from(posted_from),
task(task) {
+#if defined(TRACK_ALL_TASK_OBJECTS)
+ post_births = tracked_objects::ThreadData::TallyABirthIfActive(posted_from);
+ time_posted = tracked_objects::ThreadData::Now();
+#endif // defined(TRACK_ALL_TASK_OBJECTS)
}
PosixDynamicThreadPool::PendingTask::~PendingTask() {