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

Side by Side Diff: base/tracking_info.h

Issue 18083015: Add queued_time_ms trace for events in message loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Naming etc Created 7 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 unified diff | Download patch
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 // This is a simple struct with tracking information that is stored 5 // This is a simple struct with tracking information that is stored
6 // with a PendingTask (when message_loop is handling the task). 6 // with a PendingTask (when message_loop is handling the task).
7 // Only the information that is shared with the profiler in tracked_objects 7 // Only the information that is shared with the profiler in tracked_objects
8 // are included in this structure. 8 // are included in this structure.
9 9
10 10
11 #ifndef BASE_TRACKING_INFO_H_ 11 #ifndef BASE_TRACKING_INFO_H_
12 #define BASE_TRACKING_INFO_H_ 12 #define BASE_TRACKING_INFO_H_
13 13
14 #include "base/profiler/tracked_time.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 16
16 namespace tracked_objects { 17 namespace tracked_objects {
17 class Location; 18 class Location;
18 class Births; 19 class Births;
19 } 20 }
20 21
21 namespace base { 22 namespace base {
22 23
23 // This structure is copied around by value. 24 // This structure is copied around by value.
24 struct BASE_EXPORT TrackingInfo { 25 struct BASE_EXPORT TrackingInfo {
25 TrackingInfo(); 26 TrackingInfo();
26 TrackingInfo(const tracked_objects::Location& posted_from, 27 TrackingInfo(const tracked_objects::Location& posted_from,
27 base::TimeTicks delayed_run_time); 28 base::TimeTicks delayed_run_time);
28 ~TrackingInfo(); 29 ~TrackingInfo();
29 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 TimeTicks EffectiveTimePosted() const {
38 return delayed_run_time.is_null() ? time_posted : delayed_run_time;
39 }
40
41 tracked_objects::Duration DurationSinceEffectiveTimePosted() const {
42 return tracked_objects::TrackedTime::Now() -
43 tracked_objects::TrackedTime(EffectiveTimePosted());
jar (doing other things) 2013/07/08 23:14:19 Now that you're always converting to TrackedTime()
44 }
45
30 // Record of location and thread that the task came from. 46 // Record of location and thread that the task came from.
31 tracked_objects::Births* birth_tally; 47 tracked_objects::Births* birth_tally;
32 48
33 // Time when the related task was posted. 49 // Time when the related task was posted.
34 base::TimeTicks time_posted; 50 base::TimeTicks time_posted;
35 51
36 // The time when the task should be run. 52 // The time when the task should be run.
37 base::TimeTicks delayed_run_time; 53 base::TimeTicks delayed_run_time;
38 }; 54 };
39 55
40 } // namespace base 56 } // namespace base
41 57
42 #endif // BASE_TRACKING_INFO_H_ 58 #endif // BASE_TRACKING_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698