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

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

Issue 5537001: New Heap Profiler: add API method for finding a graph node by id. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 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 | Annotate | Revision Log
« src/profile-generator.cc ('K') | « src/profile-generator.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 "snapshot.h" 9 #include "snapshot.h"
10 #include "string-stream.h" 10 #include "string-stream.h"
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 1186
1187 const v8::HeapSnapshot* snapshot = 1187 const v8::HeapSnapshot* snapshot =
1188 v8::HeapProfiler::TakeSnapshot( 1188 v8::HeapProfiler::TakeSnapshot(
1189 v8::String::New("agg"), v8::HeapSnapshot::kAggregated); 1189 v8::String::New("agg"), v8::HeapSnapshot::kAggregated);
1190 TestJSONStream stream; 1190 TestJSONStream stream;
1191 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON); 1191 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON);
1192 CHECK_GT(stream.size(), 0); 1192 CHECK_GT(stream.size(), 0);
1193 CHECK_EQ(1, stream.eos_signaled()); 1193 CHECK_EQ(1, stream.eos_signaled());
1194 } 1194 }
1195 1195
1196
1197 TEST(HeapSnapshotGetNodeById) {
1198 v8::HandleScope scope;
1199 LocalContext env;
1200
1201 const v8::HeapSnapshot* snapshot =
1202 v8::HeapProfiler::TakeSnapshot(v8::String::New("id"));
1203 const v8::HeapGraphNode* root = snapshot->GetRoot();
1204 CHECK_EQ(root, snapshot->GetNodeById(root->GetId()));
1205 for (int i = 0, count = root->GetChildrenCount(); i < count; ++i) {
1206 const v8::HeapGraphEdge* prop = root->GetChild(i);
1207 CHECK_EQ(
1208 prop->GetToNode(), snapshot->GetNodeById(prop->GetToNode()->GetId()));
1209 }
1210 // Check a big id, which should not exist yet.
1211 CHECK_EQ(NULL, snapshot->GetNodeById(0x1000000UL));
1212 }
1213
1196 #endif // ENABLE_LOGGING_AND_PROFILING 1214 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« src/profile-generator.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698