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

Side by Side Diff: base/threading/worker_pool_posix.cc

Issue 1851233002: Reland of [tracing] Adding task information to heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove event from sequenced_worker_pool.cc Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « base/debug/task_annotator.h ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/worker_pool_posix.h" 5 #include "base/threading/worker_pool_posix.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 g_worker_pool_running_on_this_thread.Get().Set(true); 79 g_worker_pool_running_on_this_thread.Get().Set(true);
80 const std::string name = base::StringPrintf("%s/%d", name_prefix_.c_str(), 80 const std::string name = base::StringPrintf("%s/%d", name_prefix_.c_str(),
81 PlatformThread::CurrentId()); 81 PlatformThread::CurrentId());
82 // Note |name.c_str()| must remain valid for for the whole life of the thread. 82 // Note |name.c_str()| must remain valid for for the whole life of the thread.
83 PlatformThread::SetName(name); 83 PlatformThread::SetName(name);
84 84
85 for (;;) { 85 for (;;) {
86 PendingTask pending_task = pool_->WaitForTask(); 86 PendingTask pending_task = pool_->WaitForTask();
87 if (pending_task.task.is_null()) 87 if (pending_task.task.is_null())
88 break; 88 break;
89 TRACE_EVENT2("toplevel", "WorkerThread::ThreadMain::Run", 89 TRACE_TASK_EXECUTION("WorkerThread::ThreadMain::Run", pending_task);
90 "src_file", pending_task.posted_from.file_name(),
91 "src_func", pending_task.posted_from.function_name());
92 90
93 tracked_objects::TaskStopwatch stopwatch; 91 tracked_objects::TaskStopwatch stopwatch;
94 stopwatch.Start(); 92 stopwatch.Start();
95 pending_task.task.Run(); 93 pending_task.task.Run();
96 stopwatch.Stop(); 94 stopwatch.Stop();
97 95
98 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( 96 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking(
99 pending_task.birth_tally, pending_task.time_posted, stopwatch); 97 pending_task.birth_tally, pending_task.time_posted, stopwatch);
100 } 98 }
101 99
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return PendingTask(FROM_HERE, base::Closure()); 185 return PendingTask(FROM_HERE, base::Closure());
188 } 186 }
189 } 187 }
190 188
191 PendingTask pending_task = pending_tasks_.front(); 189 PendingTask pending_task = pending_tasks_.front();
192 pending_tasks_.pop(); 190 pending_tasks_.pop();
193 return pending_task; 191 return pending_task;
194 } 192 }
195 193
196 } // namespace base 194 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/task_annotator.h ('k') | base/threading/worker_pool_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698