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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 247001: Heap profiler: aggregate retainers count of equivalent clusters. (Closed)
Patch Set: Created 11 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
« no previous file with comments | « src/heap-profiler.cc ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests for heap profiler 3 // Tests for heap profiler
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #include "v8.h" 7 #include "v8.h"
8 #include "heap-profiler.h" 8 #include "heap-profiler.h"
9 #include "string-stream.h" 9 #include "string-stream.h"
10 #include "cctest.h" 10 #include "cctest.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 RetainerHeapProfile ret_profile; 316 RetainerHeapProfile ret_profile;
317 i::AssertNoAllocation no_alloc; 317 i::AssertNoAllocation no_alloc;
318 i::HeapIterator iterator; 318 i::HeapIterator iterator;
319 while (iterator.has_next()) { 319 while (iterator.has_next()) {
320 i::HeapObject* obj = iterator.next(); 320 i::HeapObject* obj = iterator.next();
321 ret_profile.CollectStats(obj); 321 ret_profile.CollectStats(obj);
322 } 322 }
323 RetainerProfilePrinter printer; 323 RetainerProfilePrinter printer;
324 ret_profile.DebugPrintStats(&printer); 324 ret_profile.DebugPrintStats(&printer);
325 CHECK_EQ("(global property);1,B;2,C;2", printer.GetRetainers("A")); 325 const char* retainers_of_a = printer.GetRetainers("A");
326 // The order of retainers is unspecified, so we check string length, and
327 // verify each retainer separately.
328 CHECK_EQ(static_cast<int>(strlen("(global property);1,B;2,C;2")),
329 static_cast<int>(strlen(retainers_of_a)));
330 CHECK(strstr(retainers_of_a, "(global property);1") != NULL);
331 CHECK(strstr(retainers_of_a, "B;2") != NULL);
332 CHECK(strstr(retainers_of_a, "C;2") != NULL);
326 CHECK_EQ("(global property);2", printer.GetRetainers("B")); 333 CHECK_EQ("(global property);2", printer.GetRetainers("B"));
327 CHECK_EQ("(global property);1", printer.GetRetainers("C")); 334 CHECK_EQ("(global property);1", printer.GetRetainers("C"));
328 } 335 }
329 336
330 #endif // ENABLE_LOGGING_AND_PROFILING 337 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698