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

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

Issue 22849002: Rewrite SamplingCircularQueue (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use V8_ALIGNAS from include/v8config.h Created 7 years, 4 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 | « test/cctest/test-circular-queue.cc ('k') | tools/gyp/v8.gyp » ('j') | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 57
58 static inline i::Address ToAddress(int n) { 58 static inline i::Address ToAddress(int n) {
59 return reinterpret_cast<i::Address>(n); 59 return reinterpret_cast<i::Address>(n);
60 } 60 }
61 61
62 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, 62 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc,
63 i::Address frame1, 63 i::Address frame1,
64 i::Address frame2 = NULL, 64 i::Address frame2 = NULL,
65 i::Address frame3 = NULL) { 65 i::Address frame3 = NULL) {
66 i::TickSample* sample = proc->TickSampleEvent(); 66 i::TickSample* sample = proc->StartTickSample();
67 sample->pc = frame1; 67 sample->pc = frame1;
68 sample->tos = frame1; 68 sample->tos = frame1;
69 sample->frames_count = 0; 69 sample->frames_count = 0;
70 if (frame2 != NULL) { 70 if (frame2 != NULL) {
71 sample->stack[0] = frame2; 71 sample->stack[0] = frame2;
72 sample->frames_count = 1; 72 sample->frames_count = 1;
73 } 73 }
74 if (frame3 != NULL) { 74 if (frame3 != NULL) {
75 sample->stack[1] = frame3; 75 sample->stack[1] = frame3;
76 sample->frames_count = 2; 76 sample->frames_count = 2;
77 } 77 }
78 proc->FinishTickSample();
78 } 79 }
79 80
80 namespace { 81 namespace {
81 82
82 class TestSetup { 83 class TestSetup {
83 public: 84 public:
84 TestSetup() 85 TestSetup()
85 : old_flag_prof_browser_mode_(i::FLAG_prof_browser_mode) { 86 : old_flag_prof_browser_mode_(i::FLAG_prof_browser_mode) {
86 i::FLAG_prof_browser_mode = false; 87 i::FLAG_prof_browser_mode = false;
87 } 88 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 CpuProfilesCollection* profiles = new CpuProfilesCollection; 271 CpuProfilesCollection* profiles = new CpuProfilesCollection;
271 profiles->StartProfiling("", 1, false); 272 profiles->StartProfiling("", 1, false);
272 ProfileGenerator generator(profiles); 273 ProfileGenerator generator(profiles);
273 ProfilerEventsProcessor processor(&generator); 274 ProfilerEventsProcessor processor(&generator);
274 processor.Start(); 275 processor.Start();
275 CpuProfiler profiler(isolate, profiles, &generator, &processor); 276 CpuProfiler profiler(isolate, profiles, &generator, &processor);
276 277
277 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); 278 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb");
278 279
279 i::TickSample* sample = processor.TickSampleEvent(); 280 i::TickSample* sample = processor.StartTickSample();
280 sample->pc = code->address(); 281 sample->pc = code->address();
281 sample->tos = 0; 282 sample->tos = 0;
282 sample->frames_count = i::TickSample::kMaxFramesCount; 283 sample->frames_count = i::TickSample::kMaxFramesCount;
283 for (int i = 0; i < sample->frames_count; ++i) { 284 for (int i = 0; i < sample->frames_count; ++i) {
284 sample->stack[i] = code->address(); 285 sample->stack[i] = code->address();
285 } 286 }
287 processor.FinishTickSample();
286 288
287 processor.StopSynchronously(); 289 processor.StopSynchronously();
288 processor.Join(); 290 processor.Join();
289 CpuProfile* profile = profiles->StopProfiling(""); 291 CpuProfile* profile = profiles->StopProfiling("");
290 CHECK_NE(NULL, profile); 292 CHECK_NE(NULL, profile);
291 293
292 int actual_depth = 0; 294 int actual_depth = 0;
293 const ProfileNode* node = profile->top_down()->root(); 295 const ProfileNode* node = profile->top_down()->root();
294 while (node->children()->length() > 0) { 296 while (node->children()->length() > 0) {
295 node = node->children()->last(); 297 node = node->children()->last();
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 CHECK_GE(programNode->GetHitCount(), 3); 1374 CHECK_GE(programNode->GetHitCount(), 3);
1373 1375
1374 const v8::CpuProfileNode* idleNode = 1376 const v8::CpuProfileNode* idleNode =
1375 GetChild(root, ProfileGenerator::kIdleEntryName); 1377 GetChild(root, ProfileGenerator::kIdleEntryName);
1376 CHECK_EQ(0, idleNode->GetChildrenCount()); 1378 CHECK_EQ(0, idleNode->GetChildrenCount());
1377 CHECK_GE(idleNode->GetSelfSamplesCount(), 3); 1379 CHECK_GE(idleNode->GetSelfSamplesCount(), 3);
1378 CHECK_GE(idleNode->GetHitCount(), 3); 1380 CHECK_GE(idleNode->GetHitCount(), 3);
1379 1381
1380 cpu_profiler->DeleteAllCpuProfiles(); 1382 cpu_profiler->DeleteAllCpuProfiles();
1381 } 1383 }
OLDNEW
« no previous file with comments | « test/cctest/test-circular-queue.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698