blob: 6c3bcd1a51471fa3c7b4e023691b03e95cda38ea [file] [log] [blame]
[email protected]9e9999d82012-07-30 18:41:531// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]b2a9bbd2011-10-31 22:36:212// 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
[email protected]c014f2b32013-09-03 23:29:1214#include "base/base_export.h"
[email protected]e1a38d602013-07-10 17:50:2215#include "base/profiler/tracked_time.h"
[email protected]8f9a3a52013-06-28 15:14:1816#include "base/time/time.h"
[email protected]b2a9bbd2011-10-31 22:36:2117
18namespace tracked_objects {
19class Location;
20class Births;
21}
22
23namespace base {
24
25// This structure is copied around by value.
26struct BASE_EXPORT TrackingInfo {
[email protected]9e9999d82012-07-30 18:41:5327 TrackingInfo();
[email protected]b2a9bbd2011-10-31 22:36:2128 TrackingInfo(const tracked_objects::Location& posted_from,
29 base::TimeTicks delayed_run_time);
30 ~TrackingInfo();
31
[email protected]e1a38d602013-07-10 17:50:2232 // To avoid conflating our stats with the delay duration in a PostDelayedTask,
33 // we identify such tasks, and replace their post_time with the time they
34 // were scheduled (requested?) to emerge from the delayed task queue. This
35 // means that queuing delay for such tasks will show how long they went
36 // unserviced, after they *could* be serviced. This is the same stat as we
37 // have for non-delayed tasks, and we consistently call it queuing delay.
38 tracked_objects::TrackedTime EffectiveTimePosted() const {
jdduke71fc9b22015-01-09 21:01:3839 return delayed_run_time.is_null()
40 ? time_posted
41 : tracked_objects::TrackedTime(delayed_run_time);
[email protected]e1a38d602013-07-10 17:50:2242 }
43
[email protected]b2a9bbd2011-10-31 22:36:2144 // Record of location and thread that the task came from.
45 tracked_objects::Births* birth_tally;
46
jdduke71fc9b22015-01-09 21:01:3847 // Time when the related task was posted. Note that this value may be empty
48 // if task profiling is disabled, and should only be used in conjunction with
49 // profiling-related reporting.
50 tracked_objects::TrackedTime time_posted;
[email protected]b2a9bbd2011-10-31 22:36:2151
52 // The time when the task should be run.
53 base::TimeTicks delayed_run_time;
54};
55
56} // namespace base
57
58#endif // BASE_TRACKING_INFO_H_