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

Side by Side Diff: test/cctest/test-profile-generator.cc

Issue 23554002: Remove implementation of CpuProfileNode methods deprecated in v8 3.20 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/profile-generator-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 CHECK_EQ(NULL, helper.Walk(&entry2)); 125 CHECK_EQ(NULL, helper.Walk(&entry2));
126 CHECK_EQ(NULL, helper.Walk(&entry3)); 126 CHECK_EQ(NULL, helper.Walk(&entry3));
127 127
128 CodeEntry* path[] = {NULL, &entry1, NULL, &entry2, NULL, NULL, &entry3, NULL}; 128 CodeEntry* path[] = {NULL, &entry1, NULL, &entry2, NULL, NULL, &entry3, NULL};
129 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0])); 129 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
130 tree.AddPathFromStart(path_vec); 130 tree.AddPathFromStart(path_vec);
131 CHECK_EQ(NULL, helper.Walk(&entry2)); 131 CHECK_EQ(NULL, helper.Walk(&entry2));
132 CHECK_EQ(NULL, helper.Walk(&entry3)); 132 CHECK_EQ(NULL, helper.Walk(&entry3));
133 ProfileNode* node1 = helper.Walk(&entry1); 133 ProfileNode* node1 = helper.Walk(&entry1);
134 CHECK_NE(NULL, node1); 134 CHECK_NE(NULL, node1);
135 CHECK_EQ(0, node1->total_ticks());
136 CHECK_EQ(0, node1->self_ticks()); 135 CHECK_EQ(0, node1->self_ticks());
137 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1)); 136 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
138 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3)); 137 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
139 ProfileNode* node2 = helper.Walk(&entry1, &entry2); 138 ProfileNode* node2 = helper.Walk(&entry1, &entry2);
140 CHECK_NE(NULL, node2); 139 CHECK_NE(NULL, node2);
141 CHECK_NE(node1, node2); 140 CHECK_NE(node1, node2);
142 CHECK_EQ(0, node2->total_ticks());
143 CHECK_EQ(0, node2->self_ticks()); 141 CHECK_EQ(0, node2->self_ticks());
144 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1)); 142 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
145 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2)); 143 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2));
146 ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3); 144 ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3);
147 CHECK_NE(NULL, node3); 145 CHECK_NE(NULL, node3);
148 CHECK_NE(node1, node3); 146 CHECK_NE(node1, node3);
149 CHECK_NE(node2, node3); 147 CHECK_NE(node2, node3);
150 CHECK_EQ(0, node3->total_ticks());
151 CHECK_EQ(1, node3->self_ticks()); 148 CHECK_EQ(1, node3->self_ticks());
152 149
153 tree.AddPathFromStart(path_vec); 150 tree.AddPathFromStart(path_vec);
154 CHECK_EQ(node1, helper.Walk(&entry1)); 151 CHECK_EQ(node1, helper.Walk(&entry1));
155 CHECK_EQ(node2, helper.Walk(&entry1, &entry2)); 152 CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
156 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3)); 153 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
157 CHECK_EQ(0, node1->total_ticks());
158 CHECK_EQ(0, node1->self_ticks()); 154 CHECK_EQ(0, node1->self_ticks());
159 CHECK_EQ(0, node2->total_ticks());
160 CHECK_EQ(0, node2->self_ticks()); 155 CHECK_EQ(0, node2->self_ticks());
161 CHECK_EQ(0, node3->total_ticks());
162 CHECK_EQ(2, node3->self_ticks()); 156 CHECK_EQ(2, node3->self_ticks());
163 157
164 CodeEntry* path2[] = {&entry1, &entry2, &entry2}; 158 CodeEntry* path2[] = {&entry1, &entry2, &entry2};
165 Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0])); 159 Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0]));
166 tree.AddPathFromStart(path2_vec); 160 tree.AddPathFromStart(path2_vec);
167 CHECK_EQ(NULL, helper.Walk(&entry2)); 161 CHECK_EQ(NULL, helper.Walk(&entry2));
168 CHECK_EQ(NULL, helper.Walk(&entry3)); 162 CHECK_EQ(NULL, helper.Walk(&entry3));
169 CHECK_EQ(node1, helper.Walk(&entry1)); 163 CHECK_EQ(node1, helper.Walk(&entry1));
170 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1)); 164 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
171 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3)); 165 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
172 CHECK_EQ(node2, helper.Walk(&entry1, &entry2)); 166 CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
173 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1)); 167 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
174 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3)); 168 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
175 CHECK_EQ(0, node3->total_ticks());
176 CHECK_EQ(2, node3->self_ticks()); 169 CHECK_EQ(2, node3->self_ticks());
177 ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2); 170 ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
178 CHECK_NE(NULL, node4); 171 CHECK_NE(NULL, node4);
179 CHECK_NE(node3, node4); 172 CHECK_NE(node3, node4);
180 CHECK_EQ(0, node4->total_ticks());
181 CHECK_EQ(1, node4->self_ticks()); 173 CHECK_EQ(1, node4->self_ticks());
182 } 174 }
183 175
184 176
185 TEST(ProfileTreeAddPathFromEnd) { 177 TEST(ProfileTreeAddPathFromEnd) {
186 CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); 178 CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
187 CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); 179 CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
188 CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); 180 CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
189 ProfileTree tree; 181 ProfileTree tree;
190 ProfileTreeTestHelper helper(&tree); 182 ProfileTreeTestHelper helper(&tree);
191 CHECK_EQ(NULL, helper.Walk(&entry1)); 183 CHECK_EQ(NULL, helper.Walk(&entry1));
192 CHECK_EQ(NULL, helper.Walk(&entry2)); 184 CHECK_EQ(NULL, helper.Walk(&entry2));
193 CHECK_EQ(NULL, helper.Walk(&entry3)); 185 CHECK_EQ(NULL, helper.Walk(&entry3));
194 186
195 CodeEntry* path[] = {NULL, &entry3, NULL, &entry2, NULL, NULL, &entry1, NULL}; 187 CodeEntry* path[] = {NULL, &entry3, NULL, &entry2, NULL, NULL, &entry1, NULL};
196 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0])); 188 Vector<CodeEntry*> path_vec(path, sizeof(path) / sizeof(path[0]));
197 tree.AddPathFromEnd(path_vec); 189 tree.AddPathFromEnd(path_vec);
198 CHECK_EQ(NULL, helper.Walk(&entry2)); 190 CHECK_EQ(NULL, helper.Walk(&entry2));
199 CHECK_EQ(NULL, helper.Walk(&entry3)); 191 CHECK_EQ(NULL, helper.Walk(&entry3));
200 ProfileNode* node1 = helper.Walk(&entry1); 192 ProfileNode* node1 = helper.Walk(&entry1);
201 CHECK_NE(NULL, node1); 193 CHECK_NE(NULL, node1);
202 CHECK_EQ(0, node1->total_ticks());
203 CHECK_EQ(0, node1->self_ticks()); 194 CHECK_EQ(0, node1->self_ticks());
204 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1)); 195 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
205 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3)); 196 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
206 ProfileNode* node2 = helper.Walk(&entry1, &entry2); 197 ProfileNode* node2 = helper.Walk(&entry1, &entry2);
207 CHECK_NE(NULL, node2); 198 CHECK_NE(NULL, node2);
208 CHECK_NE(node1, node2); 199 CHECK_NE(node1, node2);
209 CHECK_EQ(0, node2->total_ticks());
210 CHECK_EQ(0, node2->self_ticks()); 200 CHECK_EQ(0, node2->self_ticks());
211 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1)); 201 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
212 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2)); 202 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2));
213 ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3); 203 ProfileNode* node3 = helper.Walk(&entry1, &entry2, &entry3);
214 CHECK_NE(NULL, node3); 204 CHECK_NE(NULL, node3);
215 CHECK_NE(node1, node3); 205 CHECK_NE(node1, node3);
216 CHECK_NE(node2, node3); 206 CHECK_NE(node2, node3);
217 CHECK_EQ(0, node3->total_ticks());
218 CHECK_EQ(1, node3->self_ticks()); 207 CHECK_EQ(1, node3->self_ticks());
219 208
220 tree.AddPathFromEnd(path_vec); 209 tree.AddPathFromEnd(path_vec);
221 CHECK_EQ(node1, helper.Walk(&entry1)); 210 CHECK_EQ(node1, helper.Walk(&entry1));
222 CHECK_EQ(node2, helper.Walk(&entry1, &entry2)); 211 CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
223 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3)); 212 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
224 CHECK_EQ(0, node1->total_ticks());
225 CHECK_EQ(0, node1->self_ticks()); 213 CHECK_EQ(0, node1->self_ticks());
226 CHECK_EQ(0, node2->total_ticks());
227 CHECK_EQ(0, node2->self_ticks()); 214 CHECK_EQ(0, node2->self_ticks());
228 CHECK_EQ(0, node3->total_ticks());
229 CHECK_EQ(2, node3->self_ticks()); 215 CHECK_EQ(2, node3->self_ticks());
230 216
231 CodeEntry* path2[] = {&entry2, &entry2, &entry1}; 217 CodeEntry* path2[] = {&entry2, &entry2, &entry1};
232 Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0])); 218 Vector<CodeEntry*> path2_vec(path2, sizeof(path2) / sizeof(path2[0]));
233 tree.AddPathFromEnd(path2_vec); 219 tree.AddPathFromEnd(path2_vec);
234 CHECK_EQ(NULL, helper.Walk(&entry2)); 220 CHECK_EQ(NULL, helper.Walk(&entry2));
235 CHECK_EQ(NULL, helper.Walk(&entry3)); 221 CHECK_EQ(NULL, helper.Walk(&entry3));
236 CHECK_EQ(node1, helper.Walk(&entry1)); 222 CHECK_EQ(node1, helper.Walk(&entry1));
237 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1)); 223 CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
238 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3)); 224 CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
239 CHECK_EQ(node2, helper.Walk(&entry1, &entry2)); 225 CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
240 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1)); 226 CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
241 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3)); 227 CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
242 CHECK_EQ(0, node3->total_ticks());
243 CHECK_EQ(2, node3->self_ticks()); 228 CHECK_EQ(2, node3->self_ticks());
244 ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2); 229 ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
245 CHECK_NE(NULL, node4); 230 CHECK_NE(NULL, node4);
246 CHECK_NE(node3, node4); 231 CHECK_NE(node3, node4);
247 CHECK_EQ(0, node4->total_ticks());
248 CHECK_EQ(1, node4->self_ticks()); 232 CHECK_EQ(1, node4->self_ticks());
249 } 233 }
250 234
251 235
252 TEST(ProfileTreeCalculateTotalTicks) { 236 TEST(ProfileTreeCalculateTotalTicks) {
253 ProfileTree empty_tree; 237 ProfileTree empty_tree;
254 CHECK_EQ(0, empty_tree.root()->total_ticks());
255 CHECK_EQ(0, empty_tree.root()->self_ticks());
256 empty_tree.CalculateTotalTicks();
257 CHECK_EQ(0, empty_tree.root()->total_ticks());
258 CHECK_EQ(0, empty_tree.root()->self_ticks()); 238 CHECK_EQ(0, empty_tree.root()->self_ticks());
259 empty_tree.root()->IncrementSelfTicks(); 239 empty_tree.root()->IncrementSelfTicks();
260 CHECK_EQ(0, empty_tree.root()->total_ticks());
261 CHECK_EQ(1, empty_tree.root()->self_ticks());
262 empty_tree.CalculateTotalTicks();
263 CHECK_EQ(1, empty_tree.root()->total_ticks());
264 CHECK_EQ(1, empty_tree.root()->self_ticks()); 240 CHECK_EQ(1, empty_tree.root()->self_ticks());
265 241
266 CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa"); 242 CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
267 CodeEntry* e1_path[] = {&entry1}; 243 CodeEntry* e1_path[] = {&entry1};
268 Vector<CodeEntry*> e1_path_vec( 244 Vector<CodeEntry*> e1_path_vec(
269 e1_path, sizeof(e1_path) / sizeof(e1_path[0])); 245 e1_path, sizeof(e1_path) / sizeof(e1_path[0]));
270 246
271 ProfileTree single_child_tree; 247 ProfileTree single_child_tree;
272 single_child_tree.AddPathFromStart(e1_path_vec); 248 single_child_tree.AddPathFromStart(e1_path_vec);
273 single_child_tree.root()->IncrementSelfTicks(); 249 single_child_tree.root()->IncrementSelfTicks();
274 CHECK_EQ(0, single_child_tree.root()->total_ticks());
275 CHECK_EQ(1, single_child_tree.root()->self_ticks()); 250 CHECK_EQ(1, single_child_tree.root()->self_ticks());
276 ProfileTreeTestHelper single_child_helper(&single_child_tree); 251 ProfileTreeTestHelper single_child_helper(&single_child_tree);
277 ProfileNode* node1 = single_child_helper.Walk(&entry1); 252 ProfileNode* node1 = single_child_helper.Walk(&entry1);
278 CHECK_NE(NULL, node1); 253 CHECK_NE(NULL, node1);
279 CHECK_EQ(0, node1->total_ticks());
280 CHECK_EQ(1, node1->self_ticks());
281 single_child_tree.CalculateTotalTicks();
282 CHECK_EQ(2, single_child_tree.root()->total_ticks());
283 CHECK_EQ(1, single_child_tree.root()->self_ticks()); 254 CHECK_EQ(1, single_child_tree.root()->self_ticks());
284 CHECK_EQ(1, node1->total_ticks());
285 CHECK_EQ(1, node1->self_ticks()); 255 CHECK_EQ(1, node1->self_ticks());
286 256
287 CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb"); 257 CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
288 CodeEntry* e1_e2_path[] = {&entry1, &entry2}; 258 CodeEntry* e1_e2_path[] = {&entry1, &entry2};
289 Vector<CodeEntry*> e1_e2_path_vec( 259 Vector<CodeEntry*> e1_e2_path_vec(
290 e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0])); 260 e1_e2_path, sizeof(e1_e2_path) / sizeof(e1_e2_path[0]));
291 261
292 ProfileTree flat_tree; 262 ProfileTree flat_tree;
293 ProfileTreeTestHelper flat_helper(&flat_tree); 263 ProfileTreeTestHelper flat_helper(&flat_tree);
294 flat_tree.AddPathFromStart(e1_path_vec); 264 flat_tree.AddPathFromStart(e1_path_vec);
295 flat_tree.AddPathFromStart(e1_path_vec); 265 flat_tree.AddPathFromStart(e1_path_vec);
296 flat_tree.AddPathFromStart(e1_e2_path_vec); 266 flat_tree.AddPathFromStart(e1_e2_path_vec);
297 flat_tree.AddPathFromStart(e1_e2_path_vec); 267 flat_tree.AddPathFromStart(e1_e2_path_vec);
298 flat_tree.AddPathFromStart(e1_e2_path_vec); 268 flat_tree.AddPathFromStart(e1_e2_path_vec);
299 // Results in {root,0,0} -> {entry1,0,2} -> {entry2,0,3} 269 // Results in {root,0,0} -> {entry1,0,2} -> {entry2,0,3}
300 CHECK_EQ(0, flat_tree.root()->total_ticks());
301 CHECK_EQ(0, flat_tree.root()->self_ticks()); 270 CHECK_EQ(0, flat_tree.root()->self_ticks());
302 node1 = flat_helper.Walk(&entry1); 271 node1 = flat_helper.Walk(&entry1);
303 CHECK_NE(NULL, node1); 272 CHECK_NE(NULL, node1);
304 CHECK_EQ(0, node1->total_ticks());
305 CHECK_EQ(2, node1->self_ticks()); 273 CHECK_EQ(2, node1->self_ticks());
306 ProfileNode* node2 = flat_helper.Walk(&entry1, &entry2); 274 ProfileNode* node2 = flat_helper.Walk(&entry1, &entry2);
307 CHECK_NE(NULL, node2); 275 CHECK_NE(NULL, node2);
308 CHECK_EQ(0, node2->total_ticks());
309 CHECK_EQ(3, node2->self_ticks()); 276 CHECK_EQ(3, node2->self_ticks());
310 flat_tree.CalculateTotalTicks();
311 // Must calculate {root,5,0} -> {entry1,5,2} -> {entry2,3,3} 277 // Must calculate {root,5,0} -> {entry1,5,2} -> {entry2,3,3}
312 CHECK_EQ(5, flat_tree.root()->total_ticks());
313 CHECK_EQ(0, flat_tree.root()->self_ticks()); 278 CHECK_EQ(0, flat_tree.root()->self_ticks());
314 CHECK_EQ(5, node1->total_ticks());
315 CHECK_EQ(2, node1->self_ticks()); 279 CHECK_EQ(2, node1->self_ticks());
316 CHECK_EQ(3, node2->total_ticks());
317 CHECK_EQ(3, node2->self_ticks());
318 280
319 CodeEntry* e2_path[] = {&entry2}; 281 CodeEntry* e2_path[] = {&entry2};
320 Vector<CodeEntry*> e2_path_vec( 282 Vector<CodeEntry*> e2_path_vec(
321 e2_path, sizeof(e2_path) / sizeof(e2_path[0])); 283 e2_path, sizeof(e2_path) / sizeof(e2_path[0]));
322 CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc"); 284 CodeEntry entry3(i::Logger::FUNCTION_TAG, "ccc");
323 CodeEntry* e3_path[] = {&entry3}; 285 CodeEntry* e3_path[] = {&entry3};
324 Vector<CodeEntry*> e3_path_vec( 286 Vector<CodeEntry*> e3_path_vec(
325 e3_path, sizeof(e3_path) / sizeof(e3_path[0])); 287 e3_path, sizeof(e3_path) / sizeof(e3_path[0]));
326 288
327 ProfileTree wide_tree; 289 ProfileTree wide_tree;
328 ProfileTreeTestHelper wide_helper(&wide_tree); 290 ProfileTreeTestHelper wide_helper(&wide_tree);
329 wide_tree.AddPathFromStart(e1_path_vec); 291 wide_tree.AddPathFromStart(e1_path_vec);
330 wide_tree.AddPathFromStart(e1_path_vec); 292 wide_tree.AddPathFromStart(e1_path_vec);
331 wide_tree.AddPathFromStart(e1_e2_path_vec); 293 wide_tree.AddPathFromStart(e1_e2_path_vec);
332 wide_tree.AddPathFromStart(e2_path_vec); 294 wide_tree.AddPathFromStart(e2_path_vec);
333 wide_tree.AddPathFromStart(e2_path_vec); 295 wide_tree.AddPathFromStart(e2_path_vec);
334 wide_tree.AddPathFromStart(e2_path_vec); 296 wide_tree.AddPathFromStart(e2_path_vec);
335 wide_tree.AddPathFromStart(e3_path_vec); 297 wide_tree.AddPathFromStart(e3_path_vec);
336 wide_tree.AddPathFromStart(e3_path_vec); 298 wide_tree.AddPathFromStart(e3_path_vec);
337 wide_tree.AddPathFromStart(e3_path_vec); 299 wide_tree.AddPathFromStart(e3_path_vec);
338 wide_tree.AddPathFromStart(e3_path_vec); 300 wide_tree.AddPathFromStart(e3_path_vec);
339 // Results in -> {entry1,0,2} -> {entry2,0,1} 301 // Results in -> {entry1,0,2} -> {entry2,0,1}
340 // {root,0,0} -> {entry2,0,3} 302 // {root,0,0} -> {entry2,0,3}
341 // -> {entry3,0,4} 303 // -> {entry3,0,4}
342 CHECK_EQ(0, wide_tree.root()->total_ticks());
343 CHECK_EQ(0, wide_tree.root()->self_ticks()); 304 CHECK_EQ(0, wide_tree.root()->self_ticks());
344 node1 = wide_helper.Walk(&entry1); 305 node1 = wide_helper.Walk(&entry1);
345 CHECK_NE(NULL, node1); 306 CHECK_NE(NULL, node1);
346 CHECK_EQ(0, node1->total_ticks());
347 CHECK_EQ(2, node1->self_ticks()); 307 CHECK_EQ(2, node1->self_ticks());
348 ProfileNode* node1_2 = wide_helper.Walk(&entry1, &entry2); 308 ProfileNode* node1_2 = wide_helper.Walk(&entry1, &entry2);
349 CHECK_NE(NULL, node1_2); 309 CHECK_NE(NULL, node1_2);
350 CHECK_EQ(0, node1_2->total_ticks());
351 CHECK_EQ(1, node1_2->self_ticks()); 310 CHECK_EQ(1, node1_2->self_ticks());
352 node2 = wide_helper.Walk(&entry2); 311 node2 = wide_helper.Walk(&entry2);
353 CHECK_NE(NULL, node2); 312 CHECK_NE(NULL, node2);
354 CHECK_EQ(0, node2->total_ticks());
355 CHECK_EQ(3, node2->self_ticks()); 313 CHECK_EQ(3, node2->self_ticks());
356 ProfileNode* node3 = wide_helper.Walk(&entry3); 314 ProfileNode* node3 = wide_helper.Walk(&entry3);
357 CHECK_NE(NULL, node3); 315 CHECK_NE(NULL, node3);
358 CHECK_EQ(0, node3->total_ticks());
359 CHECK_EQ(4, node3->self_ticks()); 316 CHECK_EQ(4, node3->self_ticks());
360 wide_tree.CalculateTotalTicks();
361 // Calculates -> {entry1,3,2} -> {entry2,1,1} 317 // Calculates -> {entry1,3,2} -> {entry2,1,1}
362 // {root,10,0} -> {entry2,3,3} 318 // {root,10,0} -> {entry2,3,3}
363 // -> {entry3,4,4} 319 // -> {entry3,4,4}
364 CHECK_EQ(10, wide_tree.root()->total_ticks());
365 CHECK_EQ(0, wide_tree.root()->self_ticks()); 320 CHECK_EQ(0, wide_tree.root()->self_ticks());
366 CHECK_EQ(3, node1->total_ticks());
367 CHECK_EQ(2, node1->self_ticks()); 321 CHECK_EQ(2, node1->self_ticks());
368 CHECK_EQ(1, node1_2->total_ticks());
369 CHECK_EQ(1, node1_2->self_ticks()); 322 CHECK_EQ(1, node1_2->self_ticks());
370 CHECK_EQ(3, node2->total_ticks());
371 CHECK_EQ(3, node2->self_ticks()); 323 CHECK_EQ(3, node2->self_ticks());
372 CHECK_EQ(4, node3->total_ticks());
373 CHECK_EQ(4, node3->self_ticks()); 324 CHECK_EQ(4, node3->self_ticks());
374 } 325 }
375 326
376 327
377 static inline i::Address ToAddress(int n) { 328 static inline i::Address ToAddress(int n) {
378 return reinterpret_cast<i::Address>(n); 329 return reinterpret_cast<i::Address>(n);
379 } 330 }
380 331
381 332
382 TEST(CodeMapAddCode) { 333 TEST(CodeMapAddCode) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 775
825 profiler->processor()->StopSynchronously(); 776 profiler->processor()->StopSynchronously();
826 777
827 CHECK_EQ(1, GetFunctionLineNumber(&env, "foo_at_the_first_line")); 778 CHECK_EQ(1, GetFunctionLineNumber(&env, "foo_at_the_first_line"));
828 CHECK_EQ(0, GetFunctionLineNumber(&env, "lazy_func_at_forth_line")); 779 CHECK_EQ(0, GetFunctionLineNumber(&env, "lazy_func_at_forth_line"));
829 CHECK_EQ(2, GetFunctionLineNumber(&env, "bar_at_the_second_line")); 780 CHECK_EQ(2, GetFunctionLineNumber(&env, "bar_at_the_second_line"));
830 CHECK_EQ(0, GetFunctionLineNumber(&env, "lazy_func_at_6th_line")); 781 CHECK_EQ(0, GetFunctionLineNumber(&env, "lazy_func_at_6th_line"));
831 782
832 profiler->StopProfiling("LineNumber"); 783 profiler->StopProfiling("LineNumber");
833 } 784 }
OLDNEW
« no previous file with comments | « src/profile-generator-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698