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

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

Issue 23468021: move HEAP to /test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/cctest.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 using i::ProfileGenerator; 42 using i::ProfileGenerator;
43 using i::ProfileNode; 43 using i::ProfileNode;
44 using i::ProfilerEventsProcessor; 44 using i::ProfilerEventsProcessor;
45 using i::ScopedVector; 45 using i::ScopedVector;
46 using i::SmartPointer; 46 using i::SmartPointer;
47 using i::TimeDelta; 47 using i::TimeDelta;
48 using i::Vector; 48 using i::Vector;
49 49
50 50
51 TEST(StartStop) { 51 TEST(StartStop) {
52 CpuProfilesCollection profiles; 52 i::Isolate* isolate = CcTest::i_isolate();
53 CpuProfilesCollection profiles(isolate->heap());
53 ProfileGenerator generator(&profiles); 54 ProfileGenerator generator(&profiles);
54 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( 55 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
55 &generator, NULL, TimeDelta::FromMicroseconds(100))); 56 &generator, NULL, TimeDelta::FromMicroseconds(100)));
56 processor->Start(); 57 processor->Start();
57 processor->StopSynchronously(); 58 processor->StopSynchronously();
58 } 59 }
59 60
60 61
61 static inline i::Address ToAddress(int n) { 62 static inline i::Address ToAddress(int n) {
62 return reinterpret_cast<i::Address>(n); 63 return reinterpret_cast<i::Address>(n);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 i::HandleScope scope(isolate); 134 i::HandleScope scope(isolate);
134 135
135 i::Code* aaa_code = CreateCode(&env); 136 i::Code* aaa_code = CreateCode(&env);
136 i::Code* comment_code = CreateCode(&env); 137 i::Code* comment_code = CreateCode(&env);
137 i::Code* args5_code = CreateCode(&env); 138 i::Code* args5_code = CreateCode(&env);
138 i::Code* comment2_code = CreateCode(&env); 139 i::Code* comment2_code = CreateCode(&env);
139 i::Code* moved_code = CreateCode(&env); 140 i::Code* moved_code = CreateCode(&env);
140 i::Code* args3_code = CreateCode(&env); 141 i::Code* args3_code = CreateCode(&env);
141 i::Code* args4_code = CreateCode(&env); 142 i::Code* args4_code = CreateCode(&env);
142 143
143 CpuProfilesCollection* profiles = new CpuProfilesCollection; 144 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
144 profiles->StartProfiling("", 1, false); 145 profiles->StartProfiling("", 1, false);
145 ProfileGenerator generator(profiles); 146 ProfileGenerator generator(profiles);
146 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( 147 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
147 &generator, NULL, TimeDelta::FromMicroseconds(100))); 148 &generator, NULL, TimeDelta::FromMicroseconds(100)));
148 processor->Start(); 149 processor->Start();
149 CpuProfiler profiler(isolate, profiles, &generator, *processor); 150 CpuProfiler profiler(isolate, profiles, &generator, *processor);
150 151
151 // Enqueue code creation events. 152 // Enqueue code creation events.
152 const char* aaa_str = "aaa"; 153 const char* aaa_str = "aaa";
153 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( 154 i::Handle<i::String> aaa_name = factory->NewStringFromAscii(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 TEST(TickEvents) { 196 TEST(TickEvents) {
196 TestSetup test_setup; 197 TestSetup test_setup;
197 LocalContext env; 198 LocalContext env;
198 i::Isolate* isolate = i::Isolate::Current(); 199 i::Isolate* isolate = i::Isolate::Current();
199 i::HandleScope scope(isolate); 200 i::HandleScope scope(isolate);
200 201
201 i::Code* frame1_code = CreateCode(&env); 202 i::Code* frame1_code = CreateCode(&env);
202 i::Code* frame2_code = CreateCode(&env); 203 i::Code* frame2_code = CreateCode(&env);
203 i::Code* frame3_code = CreateCode(&env); 204 i::Code* frame3_code = CreateCode(&env);
204 205
205 CpuProfilesCollection* profiles = new CpuProfilesCollection; 206 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
206 profiles->StartProfiling("", 1, false); 207 profiles->StartProfiling("", 1, false);
207 ProfileGenerator generator(profiles); 208 ProfileGenerator generator(profiles);
208 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( 209 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
209 &generator, NULL, TimeDelta::FromMicroseconds(100))); 210 &generator, NULL, TimeDelta::FromMicroseconds(100)));
210 processor->Start(); 211 processor->Start();
211 CpuProfiler profiler(isolate, profiles, &generator, *processor); 212 CpuProfiler profiler(isolate, profiles, &generator, *processor);
212 213
213 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); 214 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb");
214 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); 215 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5);
215 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); 216 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // http://code.google.com/p/v8/issues/detail?id=1398 265 // http://code.google.com/p/v8/issues/detail?id=1398
265 // Long stacks (exceeding max frames limit) must not be erased. 266 // Long stacks (exceeding max frames limit) must not be erased.
266 TEST(Issue1398) { 267 TEST(Issue1398) {
267 TestSetup test_setup; 268 TestSetup test_setup;
268 LocalContext env; 269 LocalContext env;
269 i::Isolate* isolate = i::Isolate::Current(); 270 i::Isolate* isolate = i::Isolate::Current();
270 i::HandleScope scope(isolate); 271 i::HandleScope scope(isolate);
271 272
272 i::Code* code = CreateCode(&env); 273 i::Code* code = CreateCode(&env);
273 274
274 CpuProfilesCollection* profiles = new CpuProfilesCollection; 275 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
275 profiles->StartProfiling("", 1, false); 276 profiles->StartProfiling("", 1, false);
276 ProfileGenerator generator(profiles); 277 ProfileGenerator generator(profiles);
277 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( 278 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
278 &generator, NULL, TimeDelta::FromMicroseconds(100))); 279 &generator, NULL, TimeDelta::FromMicroseconds(100)));
279 processor->Start(); 280 processor->Start();
280 CpuProfiler profiler(isolate, profiles, &generator, *processor); 281 CpuProfiler profiler(isolate, profiles, &generator, *processor);
281 282
282 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); 283 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb");
283 284
284 i::TickSample* sample = processor->StartTickSample(); 285 i::TickSample* sample = processor->StartTickSample();
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 CHECK_EQ(0, programNode->GetChildrenCount()); 1373 CHECK_EQ(0, programNode->GetChildrenCount());
1373 CHECK_GE(programNode->GetHitCount(), 3); 1374 CHECK_GE(programNode->GetHitCount(), 3);
1374 1375
1375 const v8::CpuProfileNode* idleNode = 1376 const v8::CpuProfileNode* idleNode =
1376 GetChild(root, ProfileGenerator::kIdleEntryName); 1377 GetChild(root, ProfileGenerator::kIdleEntryName);
1377 CHECK_EQ(0, idleNode->GetChildrenCount()); 1378 CHECK_EQ(0, idleNode->GetChildrenCount());
1378 CHECK_GE(idleNode->GetHitCount(), 3); 1379 CHECK_GE(idleNode->GetHitCount(), 3);
1379 1380
1380 cpu_profiler->DeleteAllCpuProfiles(); 1381 cpu_profiler->DeleteAllCpuProfiles();
1381 } 1382 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.h ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698