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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 10825022: Support profiling of tasks run as sequenced_tasks (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/tracking_info.h » ('j') | base/tracking_info.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.cc
===================================================================
--- base/threading/sequenced_worker_pool.cc (revision 148495)
+++ base/threading/sequenced_worker_pool.cc (working copy)
@@ -35,16 +35,21 @@
namespace {
-struct SequencedTask {
+struct SequencedTask : public TrackingInfo {
akalin 2012/07/27 17:45:39 any particular reason for using inheritance? Why
jar (doing other things) 2012/07/27 18:15:46 First note that TrackingInfo is also a struct.
akalin 2012/07/27 20:18:18 Doing it as a separate CL sgtm.
SequencedTask()
: sequence_token_id(0),
shutdown_behavior(SequencedWorkerPool::BLOCK_SHUTDOWN) {}
+ explicit SequencedTask(const tracked_objects::Location& from_here)
+ : base::TrackingInfo(from_here, TimeTicks()),
+ sequence_token_id(0),
+ shutdown_behavior(SequencedWorkerPool::BLOCK_SHUTDOWN) {}
+
~SequencedTask() {}
int sequence_token_id;
SequencedWorkerPool::WorkerShutdown shutdown_behavior;
- tracked_objects::Location location;
+ tracked_objects::Location posted_from;
akalin 2012/07/27 17:45:39 what's the difference between this and time_posted
jar (doing other things) 2012/07/27 18:15:46 This change was a name change only (in this file),
jbates 2012/07/27 19:54:10 Btw, I'll use this posted_from for tracing these t
akalin 2012/07/27 20:18:18 I'm okay with ripping it out in a separate CL if n
jar (doing other things) 2012/07/27 21:52:29 Although task doesn't appear to directly save it..
Closure task;
};
@@ -481,10 +486,10 @@
WorkerShutdown shutdown_behavior,
const tracked_objects::Location& from_here,
const Closure& task) {
- SequencedTask sequenced;
+ SequencedTask sequenced(from_here);
sequenced.sequence_token_id = sequence_token.id_;
sequenced.shutdown_behavior = shutdown_behavior;
- sequenced.location = from_here;
+ sequenced.posted_from = from_here;
sequenced.task = task;
int create_thread_id = 0;
@@ -614,8 +619,14 @@
this_worker->set_running_sequence(
SequenceToken(task.sequence_token_id));
+ tracked_objects::TrackedTime start_time =
+ tracked_objects::ThreadData::NowForStartOfRun(task.birth_tally);
jbates 2012/07/27 19:54:10 nit: one more space on indent
jar (doing other things) 2012/07/27 21:52:29 Done.
+
task.task.Run();
+ tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(task,
+ start_time, tracked_objects::ThreadData::NowForEndOfRun());
+
this_worker->set_running_sequence(SequenceToken());
// Make sure our task is erased outside the lock for the same reason
« no previous file with comments | « no previous file | base/tracking_info.h » ('j') | base/tracking_info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698