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

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

Issue 7046001: Fix bug with long stack traces truncation in DevTools CPU profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/cpu-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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of profiles generator and utilities. 3 // Tests of profiles generator and utilities.
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 "cpu-profiler-inl.h" 8 #include "cpu-profiler-inl.h"
9 #include "cctest.h" 9 #include "cctest.h"
10 #include "../include/v8-profiler.h" 10 #include "../include/v8-profiler.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 TestSetup test_setup; 231 TestSetup test_setup;
232 CpuProfiler::Setup(); 232 CpuProfiler::Setup();
233 CpuProfiler::StartProfiling("1"); 233 CpuProfiler::StartProfiling("1");
234 CpuProfiler::StopProfiling("2"); 234 CpuProfiler::StopProfiling("2");
235 CpuProfiler::StartProfiling("1"); 235 CpuProfiler::StartProfiling("1");
236 CpuProfiler::StopProfiling(""); 236 CpuProfiler::StopProfiling("");
237 CpuProfiler::TearDown(); 237 CpuProfiler::TearDown();
238 } 238 }
239 239
240 240
241 // http://code.google.com/p/v8/issues/detail?id=1398
242 // Long stacks (exceeding max frames limit) must not be erased.
243 TEST(Issue1398) {
244 TestSetup test_setup;
245 CpuProfilesCollection profiles;
246 profiles.StartProfiling("", 1);
247 ProfileGenerator generator(&profiles);
248 ProfilerEventsProcessor processor(i::Isolate::Current(), &generator);
249 processor.Start();
250 while (!processor.running()) {
Vitaly Repeshko 2011/05/19 11:31:01 ProfilerEventsProcessor sets "running" to true in
251 i::Thread::YieldCPU();
252 }
253
254 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
255 "bbb",
256 ToAddress(0x1200),
257 0x80);
258
259 i::TickSample* sample = processor.TickSampleEvent();
260 sample->pc = ToAddress(0x1200);
261 sample->tos = 0;
262 sample->frames_count = i::TickSample::kMaxFramesCount;
263 for (int i = 0; i < sample->frames_count; ++i) {
264 sample->stack[i] = ToAddress(0x1200);
265 }
266
267 processor.Stop();
268 processor.Join();
269 CpuProfile* profile =
270 profiles.StopProfiling(TokenEnumerator::kNoSecurityToken, "", 1);
271 CHECK_NE(NULL, profile);
272
273 int actual_depth = 0;
274 const ProfileNode* node = profile->top_down()->root();
275 while (node->children()->length() > 0) {
276 node = node->children()->last();
277 ++actual_depth;
278 }
279
280 CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth); // +1 for PC.
281 }
282
283
241 TEST(DeleteAllCpuProfiles) { 284 TEST(DeleteAllCpuProfiles) {
242 InitializeVM(); 285 InitializeVM();
243 TestSetup test_setup; 286 TestSetup test_setup;
244 CpuProfiler::Setup(); 287 CpuProfiler::Setup();
245 CHECK_EQ(0, CpuProfiler::GetProfilesCount()); 288 CHECK_EQ(0, CpuProfiler::GetProfilesCount());
246 CpuProfiler::DeleteAllProfiles(); 289 CpuProfiler::DeleteAllProfiles();
247 CHECK_EQ(0, CpuProfiler::GetProfilesCount()); 290 CHECK_EQ(0, CpuProfiler::GetProfilesCount());
248 291
249 CpuProfiler::StartProfiling("1"); 292 CpuProfiler::StartProfiling("1");
250 CpuProfiler::StopProfiling("1"); 293 CpuProfiler::StopProfiling("1");
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 const_cast<v8::CpuProfile*>(p2)->Delete(); 408 const_cast<v8::CpuProfile*>(p2)->Delete();
366 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); 409 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
367 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); 410 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
368 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); 411 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
369 const_cast<v8::CpuProfile*>(p3)->Delete(); 412 const_cast<v8::CpuProfile*>(p3)->Delete();
370 CHECK_EQ(0, CpuProfiler::GetProfilesCount()); 413 CHECK_EQ(0, CpuProfiler::GetProfilesCount());
371 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); 414 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3));
372 } 415 }
373 416
374 #endif // ENABLE_LOGGING_AND_PROFILING 417 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698