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

Side by Side Diff: cc/debug/worker_thread_cost_tracker.h

Issue 799863004: not for commit/review (thread cost tracker) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « cc/debug/frame_timing_cost_tracker.cc ('k') | cc/debug/worker_thread_cost_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 #ifndef CC_DEBUG_WORKER_THREAD_COST_TRACKER_H_
6 #define CC_DEBUG_WORKER_THREAD_COST_TRACKER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/threading/thread_checker.h"
10 #include "base/time/time.h"
11
12 namespace cc {
13
14 class WorkerThreadCostTracker {
15 public:
16 class Probe {
17 public:
18 Probe(WorkerThreadCostTracker* tracker, int tracked_source_frame_number);
19 ~Probe();
20
21 void Start(int source_frame_number);
22 void Stop();
23
24 private:
25 WorkerThreadCostTracker* tracker_;
26 int tracked_source_frame_number_;
27 base::PlatformThreadId tracker_thread_id_;
28
29 bool started_;
30 base::TimeTicks start_;
31 base::TimeDelta cost_;
32
33 base::ThreadChecker thread_checker_;
34 };
35
36 WorkerThreadCostTracker();
37 ~WorkerThreadCostTracker();
38
39 void set_source_frame_to_track(int source_frame_number) {
40 source_frame_number_ = source_frame_number;
41 }
42 void reset_cost() { cost_ = base::TimeDelta(); }
43 base::TimeDelta get_cost() { return cost_; }
44
45 scoped_ptr<Probe> CreateProbe();
46
47 private:
48 friend class Probe;
49
50 void add_cost(const base::TimeDelta& cost) { cost_ += cost; }
51
52 int source_frame_number_;
53 base::TimeDelta cost_;
54 };
55
56 } // namespace cc
57
58 #endif // CC_DEBUG_WORKER_THREAD_COST_TRACKER_H_
OLDNEW
« no previous file with comments | « cc/debug/frame_timing_cost_tracker.cc ('k') | cc/debug/worker_thread_cost_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698