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

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

Issue 13454002: Allow recording individual samples in addition to the aggregated CPU profiles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 8 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') | test/cctest/test-profile-generator.cc » ('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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 } // namespace 101 } // namespace
102 102
103 TEST(CodeEvents) { 103 TEST(CodeEvents) {
104 InitializeVM(); 104 InitializeVM();
105 i::Isolate* isolate = i::Isolate::Current(); 105 i::Isolate* isolate = i::Isolate::Current();
106 i::Heap* heap = isolate->heap(); 106 i::Heap* heap = isolate->heap();
107 i::Factory* factory = isolate->factory(); 107 i::Factory* factory = isolate->factory();
108 TestSetup test_setup; 108 TestSetup test_setup;
109 CpuProfilesCollection profiles; 109 CpuProfilesCollection profiles;
110 profiles.StartProfiling("", 1); 110 profiles.StartProfiling("", 1, false);
111 ProfileGenerator generator(&profiles); 111 ProfileGenerator generator(&profiles);
112 ProfilerEventsProcessor processor(&generator); 112 ProfilerEventsProcessor processor(&generator);
113 processor.Start(); 113 processor.Start();
114 114
115 // Enqueue code creation events. 115 // Enqueue code creation events.
116 i::HandleScope scope(isolate); 116 i::HandleScope scope(isolate);
117 const char* aaa_str = "aaa"; 117 const char* aaa_str = "aaa";
118 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( 118 i::Handle<i::String> aaa_name = factory->NewStringFromAscii(
119 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); 119 i::Vector<const char>(aaa_str, i::StrLength(aaa_str)));
120 processor.CodeCreateEvent(i::Logger::FUNCTION_TAG, 120 processor.CodeCreateEvent(i::Logger::FUNCTION_TAG,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 162
163 template<typename T> 163 template<typename T>
164 static int CompareProfileNodes(const T* p1, const T* p2) { 164 static int CompareProfileNodes(const T* p1, const T* p2) {
165 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name()); 165 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name());
166 } 166 }
167 167
168 TEST(TickEvents) { 168 TEST(TickEvents) {
169 TestSetup test_setup; 169 TestSetup test_setup;
170 CpuProfilesCollection profiles; 170 CpuProfilesCollection profiles;
171 profiles.StartProfiling("", 1); 171 profiles.StartProfiling("", 1, false);
172 ProfileGenerator generator(&profiles); 172 ProfileGenerator generator(&profiles);
173 ProfilerEventsProcessor processor(&generator); 173 ProfilerEventsProcessor processor(&generator);
174 processor.Start(); 174 processor.Start();
175 175
176 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 176 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
177 "bbb", 177 "bbb",
178 ToAddress(0x1200), 178 ToAddress(0x1200),
179 0x80); 179 0x80);
180 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); 180 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10);
181 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 181 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 CpuProfiler::StopProfiling(""); 226 CpuProfiler::StopProfiling("");
227 CpuProfiler::TearDown(); 227 CpuProfiler::TearDown();
228 } 228 }
229 229
230 230
231 // http://code.google.com/p/v8/issues/detail?id=1398 231 // http://code.google.com/p/v8/issues/detail?id=1398
232 // Long stacks (exceeding max frames limit) must not be erased. 232 // Long stacks (exceeding max frames limit) must not be erased.
233 TEST(Issue1398) { 233 TEST(Issue1398) {
234 TestSetup test_setup; 234 TestSetup test_setup;
235 CpuProfilesCollection profiles; 235 CpuProfilesCollection profiles;
236 profiles.StartProfiling("", 1); 236 profiles.StartProfiling("", 1, false);
237 ProfileGenerator generator(&profiles); 237 ProfileGenerator generator(&profiles);
238 ProfilerEventsProcessor processor(&generator); 238 ProfilerEventsProcessor processor(&generator);
239 processor.Start(); 239 processor.Start();
240 240
241 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 241 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
242 "bbb", 242 "bbb",
243 ToAddress(0x1200), 243 ToAddress(0x1200),
244 0x80); 244 0x80);
245 245
246 i::TickSample* sample = processor.TickSampleEvent(); 246 i::TickSample* sample = processor.TickSampleEvent();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); 393 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
394 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); 394 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
395 const_cast<v8::CpuProfile*>(p2)->Delete(); 395 const_cast<v8::CpuProfile*>(p2)->Delete();
396 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); 396 CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount());
397 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); 397 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2));
398 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); 398 CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3));
399 const_cast<v8::CpuProfile*>(p3)->Delete(); 399 const_cast<v8::CpuProfile*>(p3)->Delete();
400 CHECK_EQ(0, CpuProfiler::GetProfilesCount()); 400 CHECK_EQ(0, CpuProfiler::GetProfilesCount());
401 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); 401 CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3));
402 } 402 }
OLDNEW
« no previous file with comments | « src/profile-generator-inl.h ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698