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

Side by Side Diff: chrome/browser/task_profiler/task_profiler_data_serializer_unittest.cc

Issue 1104053004: Cleanup: removing unused descendants information from tracked objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isherman@ comments Created 5 years, 7 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 #include <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 23 matching lines...) Expand all
34 } // anonymous namespace 34 } // anonymous namespace
35 35
36 // Tests the JSON serialization format for profiled process data. 36 // Tests the JSON serialization format for profiled process data.
37 TEST(TaskProfilerDataSerializerTest, SerializeProcessDataToJson) { 37 TEST(TaskProfilerDataSerializerTest, SerializeProcessDataToJson) {
38 { 38 {
39 // Empty data. 39 // Empty data.
40 tracked_objects::ProcessDataPhaseSnapshot process_data_phase; 40 tracked_objects::ProcessDataPhaseSnapshot process_data_phase;
41 int process_type = content::PROCESS_TYPE_BROWSER; 41 int process_type = content::PROCESS_TYPE_BROWSER;
42 ExpectSerialization(process_data_phase, 239, process_type, 42 ExpectSerialization(process_data_phase, 239, process_type,
43 "{" 43 "{"
44 "\"descendants\":["
45 "],"
46 "\"list\":[" 44 "\"list\":["
47 "]," 45 "],"
48 "\"process_id\":239," 46 "\"process_id\":239,"
49 "\"process_type\":\"Browser\"" 47 "\"process_type\":\"Browser\""
50 "}"); 48 "}");
51 } 49 }
52 50
53 { 51 {
54 // Non-empty data. 52 // Non-empty data.
55 tracked_objects::ProcessDataPhaseSnapshot process_data_phase; 53 tracked_objects::ProcessDataPhaseSnapshot process_data_phase;
(...skipping 29 matching lines...) Expand all
85 process_data_phase.tasks.back().birth = child; 83 process_data_phase.tasks.back().birth = child;
86 process_data_phase.tasks.back().death_data.count = 41; 84 process_data_phase.tasks.back().death_data.count = 41;
87 process_data_phase.tasks.back().death_data.run_duration_max = 205; 85 process_data_phase.tasks.back().death_data.run_duration_max = 205;
88 process_data_phase.tasks.back().death_data.run_duration_sample = 203; 86 process_data_phase.tasks.back().death_data.run_duration_sample = 203;
89 process_data_phase.tasks.back().death_data.run_duration_sum = 2017; 87 process_data_phase.tasks.back().death_data.run_duration_sum = 2017;
90 process_data_phase.tasks.back().death_data.queue_duration_max = 2053; 88 process_data_phase.tasks.back().death_data.queue_duration_max = 2053;
91 process_data_phase.tasks.back().death_data.queue_duration_sample = 2013; 89 process_data_phase.tasks.back().death_data.queue_duration_sample = 2013;
92 process_data_phase.tasks.back().death_data.queue_duration_sum = 2079; 90 process_data_phase.tasks.back().death_data.queue_duration_sum = 2079;
93 process_data_phase.tasks.back().death_thread_name = "PAC thread #3"; 91 process_data_phase.tasks.back().death_thread_name = "PAC thread #3";
94 92
95 // Add a parent-child pair.
96 process_data_phase.descendants.push_back(
97 tracked_objects::ParentChildPairSnapshot());
98 process_data_phase.descendants.back().parent = parent;
99 process_data_phase.descendants.back().child = child;
100
101 int process_type = content::PROCESS_TYPE_RENDERER; 93 int process_type = content::PROCESS_TYPE_RENDERER;
102 ExpectSerialization(process_data_phase, 239, process_type, 94 ExpectSerialization(process_data_phase, 239, process_type,
103 "{" 95 "{"
104 "\"descendants\":["
105 "{"
106 "\"child_location\":{"
107 "\"file_name\":\"path/to/bar.cc\","
108 "\"function_name\":\"FizzBoom\","
109 "\"line_number\":433"
110 "},"
111 "\"child_thread\":\"Chrome_IOThread\","
112 "\"parent_location\":{"
113 "\"file_name\":\"path/to/foo.cc\","
114 "\"function_name\":\"WhizBang\","
115 "\"line_number\":101"
116 "},"
117 "\"parent_thread\":\"CrBrowserMain\""
118 "}"
119 "],"
120 "\"list\":[{" 96 "\"list\":[{"
121 "\"birth_location\":{" 97 "\"birth_location\":{"
122 "\"file_name\":\"path/to/foo.cc\"," 98 "\"file_name\":\"path/to/foo.cc\","
123 "\"function_name\":\"WhizBang\"," 99 "\"function_name\":\"WhizBang\","
124 "\"line_number\":101" 100 "\"line_number\":101"
125 "}," 101 "},"
126 "\"birth_thread\":\"CrBrowserMain\"," 102 "\"birth_thread\":\"CrBrowserMain\","
127 "\"death_data\":{" 103 "\"death_data\":{"
128 "\"count\":37," 104 "\"count\":37,"
129 "\"queue_ms\":79," 105 "\"queue_ms\":79,"
(...skipping 20 matching lines...) Expand all
150 "\"run_ms_max\":205," 126 "\"run_ms_max\":205,"
151 "\"run_ms_sample\":203" 127 "\"run_ms_sample\":203"
152 "}," 128 "},"
153 "\"death_thread\":\"PAC thread #3\"" 129 "\"death_thread\":\"PAC thread #3\""
154 "}]," 130 "}],"
155 "\"process_id\":239," 131 "\"process_id\":239,"
156 "\"process_type\":\"Tab\"" 132 "\"process_type\":\"Tab\""
157 "}"); 133 "}");
158 } 134 }
159 } 135 }
OLDNEW
« no previous file with comments | « chrome/browser/task_profiler/task_profiler_data_serializer.cc ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698