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

Side by Side Diff: cc/debug/rendering_stats.cc

Issue 25353009: telemetry: Refactored rasterize_and_record measurement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made BenchmarkInstrumentation a class. Created 7 years, 2 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
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_instrumentation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "base/values.h" 5 #include "base/values.h"
6 #include "cc/debug/rendering_stats.h" 6 #include "cc/debug/rendering_stats.h"
7 7
8 namespace cc { 8 namespace cc {
9 9
10 MainThreadRenderingStats::MainThreadRenderingStats() 10 MainThreadRenderingStats::MainThreadRenderingStats()
11 : frame_count(0), 11 : frame_count(0),
12 painted_pixel_count(0), 12 painted_pixel_count(0),
13 recorded_pixel_count(0) {} 13 recorded_pixel_count(0) {}
14 14
15 void MainThreadRenderingStats::IssueTraceEvent() const {
16 TRACE_EVENT_INSTANT1("benchmark",
17 "MainThreadRenderingStats::IssueTraceEvent",
18 TRACE_EVENT_SCOPE_THREAD,
19 "data", AsTraceableData());
20 }
21
22 scoped_refptr<base::debug::ConvertableToTraceFormat> 15 scoped_refptr<base::debug::ConvertableToTraceFormat>
23 MainThreadRenderingStats::AsTraceableData() const { 16 MainThreadRenderingStats::AsTraceableData() const {
24 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 17 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
25 record_data->SetInteger("frame_count", frame_count); 18 record_data->SetInteger("frame_count", frame_count);
26 record_data->SetDouble("paint_time", paint_time.InSecondsF()); 19 record_data->SetDouble("paint_time", paint_time.InSecondsF());
27 record_data->SetInteger("painted_pixel_count", painted_pixel_count); 20 record_data->SetInteger("painted_pixel_count", painted_pixel_count);
28 record_data->SetDouble("record_time", record_time.InSecondsF()); 21 record_data->SetDouble("record_time", record_time.InSecondsF());
29 record_data->SetInteger("recorded_pixel_count", recorded_pixel_count); 22 record_data->SetInteger("recorded_pixel_count", recorded_pixel_count);
30 return TracedValue::FromValue(record_data.release()); 23 return TracedValue::FromValue(record_data.release());
31 } 24 }
32 25
33 void MainThreadRenderingStats::Add(const MainThreadRenderingStats& other) { 26 void MainThreadRenderingStats::Add(const MainThreadRenderingStats& other) {
34 frame_count += other.frame_count; 27 frame_count += other.frame_count;
35 paint_time += other.paint_time; 28 paint_time += other.paint_time;
36 painted_pixel_count += other.painted_pixel_count; 29 painted_pixel_count += other.painted_pixel_count;
37 record_time += other.record_time; 30 record_time += other.record_time;
38 recorded_pixel_count += other.recorded_pixel_count; 31 recorded_pixel_count += other.recorded_pixel_count;
39 } 32 }
40 33
41 ImplThreadRenderingStats::ImplThreadRenderingStats() 34 ImplThreadRenderingStats::ImplThreadRenderingStats()
42 : frame_count(0), 35 : frame_count(0),
43 rasterized_pixel_count(0) {} 36 rasterized_pixel_count(0) {}
44 37
45 void ImplThreadRenderingStats::IssueTraceEvent() const {
46 TRACE_EVENT_INSTANT1("benchmark",
47 "ImplThreadRenderingStats::IssueTraceEvent",
48 TRACE_EVENT_SCOPE_THREAD,
49 "data", AsTraceableData());
50 }
51
52 scoped_refptr<base::debug::ConvertableToTraceFormat> 38 scoped_refptr<base::debug::ConvertableToTraceFormat>
53 ImplThreadRenderingStats::AsTraceableData() const { 39 ImplThreadRenderingStats::AsTraceableData() const {
54 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 40 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
55 record_data->SetInteger("frame_count", frame_count); 41 record_data->SetInteger("frame_count", frame_count);
56 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF()); 42 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF());
57 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count); 43 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count);
58 return TracedValue::FromValue(record_data.release()); 44 return TracedValue::FromValue(record_data.release());
59 } 45 }
60 46
61 void ImplThreadRenderingStats::Add(const ImplThreadRenderingStats& other) { 47 void ImplThreadRenderingStats::Add(const ImplThreadRenderingStats& other) {
(...skipping 18 matching lines...) Expand all
80 enumerator->AddInt64("rasterizedPixelCount", 66 enumerator->AddInt64("rasterizedPixelCount",
81 impl_stats.rasterized_pixel_count); 67 impl_stats.rasterized_pixel_count);
82 } 68 }
83 69
84 void RenderingStats::Add(const RenderingStats& other) { 70 void RenderingStats::Add(const RenderingStats& other) {
85 main_stats.Add(other.main_stats); 71 main_stats.Add(other.main_stats);
86 impl_stats.Add(other.impl_stats); 72 impl_stats.Add(other.impl_stats);
87 } 73 }
88 74
89 } // namespace cc 75 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/rendering_stats.h ('k') | cc/debug/rendering_stats_instrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698