michael@0: // Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: // This is a simple struct with tracking information that is stored michael@0: // with a PendingTask (when message_loop is handling the task). michael@0: // Only the information that is shared with the profiler in tracked_objects michael@0: // are included in this structure. michael@0: michael@0: michael@0: #ifndef BASE_TRACKING_INFO_H_ michael@0: #define BASE_TRACKING_INFO_H_ michael@0: michael@0: #include "base/base_export.h" michael@0: #include "base/profiler/tracked_time.h" michael@0: #include "base/time/time.h" michael@0: michael@0: namespace tracked_objects { michael@0: class Location; michael@0: class Births; michael@0: } michael@0: michael@0: namespace base { michael@0: michael@0: // This structure is copied around by value. michael@0: struct BASE_EXPORT TrackingInfo { michael@0: TrackingInfo(); michael@0: TrackingInfo(const tracked_objects::Location& posted_from, michael@0: base::TimeTicks delayed_run_time); michael@0: ~TrackingInfo(); michael@0: michael@0: // To avoid conflating our stats with the delay duration in a PostDelayedTask, michael@0: // we identify such tasks, and replace their post_time with the time they michael@0: // were scheduled (requested?) to emerge from the delayed task queue. This michael@0: // means that queuing delay for such tasks will show how long they went michael@0: // unserviced, after they *could* be serviced. This is the same stat as we michael@0: // have for non-delayed tasks, and we consistently call it queuing delay. michael@0: tracked_objects::TrackedTime EffectiveTimePosted() const { michael@0: return tracked_objects::TrackedTime( michael@0: delayed_run_time.is_null() ? time_posted : delayed_run_time); michael@0: } michael@0: michael@0: // Record of location and thread that the task came from. michael@0: tracked_objects::Births* birth_tally; michael@0: michael@0: // Time when the related task was posted. michael@0: base::TimeTicks time_posted; michael@0: michael@0: // The time when the task should be run. michael@0: base::TimeTicks delayed_run_time; michael@0: }; michael@0: michael@0: } // namespace base michael@0: michael@0: #endif // BASE_TRACKING_INFO_H_