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 3 // found in the LICENSE file. 4 5 // This is a simple struct with tracking information that is stored 6 // with a PendingTask (when message_loop is handling the task). 7 // Only the information that is shared with the profiler in tracked_objects 8 // are included in this structure. 9 10 11 #ifndef BASE_TRACKING_INFO_H_ 12 #define BASE_TRACKING_INFO_H_ 13 14 #include "base/profiler/tracked_time.h" 15 #include "base/time/time.h" 16 17 namespace tracked_objects { 18 class Location; 19 class Births; 20 } 21 22 namespace base { 23 24 // This structure is copied around by value. 25 struct BASE_EXPORT TrackingInfo { 26 TrackingInfo(); 27 TrackingInfo(const tracked_objects::Location& posted_from, 28 base::TimeTicks delayed_run_time); 29 ~TrackingInfo(); 30 31 // To avoid conflating our stats with the delay duration in a PostDelayedTask, 32 // we identify such tasks, and replace their post_time with the time they 33 // were scheduled (requested?) to emerge from the delayed task queue. This 34 // means that queuing delay for such tasks will show how long they went 35 // unserviced, after they *could* be serviced. This is the same stat as we 36 // have for non-delayed tasks, and we consistently call it queuing delay. 37 tracked_objects::TrackedTime EffectiveTimePosted() const { 38 return tracked_objects::TrackedTime( 39 delayed_run_time.is_null() ? time_posted : delayed_run_time); 40 } 41 42 // Record of location and thread that the task came from. 43 tracked_objects::Births* birth_tally; 44 45 // Time when the related task was posted. 46 base::TimeTicks time_posted; 47 48 // The time when the task should be run. 49 base::TimeTicks delayed_run_time; 50 }; 51 52 } // namespace base 53 54 #endif // BASE_TRACKING_INFO_H_ 55