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

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

Issue 18332004: No need to pass profiles to ProfilerEventsProcessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 // 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 using i::ProfileNode; 44 using i::ProfileNode;
45 using i::ProfilerEventsProcessor; 45 using i::ProfilerEventsProcessor;
46 using i::ScopedVector; 46 using i::ScopedVector;
47 using i::TokenEnumerator; 47 using i::TokenEnumerator;
48 using i::Vector; 48 using i::Vector;
49 49
50 50
51 TEST(StartStop) { 51 TEST(StartStop) {
52 CpuProfilesCollection profiles; 52 CpuProfilesCollection profiles;
53 ProfileGenerator generator(&profiles); 53 ProfileGenerator generator(&profiles);
54 ProfilerEventsProcessor processor(&generator, &profiles); 54 ProfilerEventsProcessor processor(&generator);
55 processor.Start(); 55 processor.Start();
56 processor.Stop(); 56 processor.Stop();
57 processor.Join(); 57 processor.Join();
58 } 58 }
59 59
60 static inline i::Address ToAddress(int n) { 60 static inline i::Address ToAddress(int n) {
61 return reinterpret_cast<i::Address>(n); 61 return reinterpret_cast<i::Address>(n);
62 } 62 }
63 63
64 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc, 64 static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 i::Code* comment_code = CreateCode(&env); 134 i::Code* comment_code = CreateCode(&env);
135 i::Code* args5_code = CreateCode(&env); 135 i::Code* args5_code = CreateCode(&env);
136 i::Code* comment2_code = CreateCode(&env); 136 i::Code* comment2_code = CreateCode(&env);
137 i::Code* moved_code = CreateCode(&env); 137 i::Code* moved_code = CreateCode(&env);
138 i::Code* args3_code = CreateCode(&env); 138 i::Code* args3_code = CreateCode(&env);
139 i::Code* args4_code = CreateCode(&env); 139 i::Code* args4_code = CreateCode(&env);
140 140
141 CpuProfilesCollection* profiles = new CpuProfilesCollection; 141 CpuProfilesCollection* profiles = new CpuProfilesCollection;
142 profiles->StartProfiling("", 1, false); 142 profiles->StartProfiling("", 1, false);
143 ProfileGenerator generator(profiles); 143 ProfileGenerator generator(profiles);
144 ProfilerEventsProcessor processor(&generator, profiles); 144 ProfilerEventsProcessor processor(&generator);
145 processor.Start(); 145 processor.Start();
146 CpuProfiler profiler(isolate, profiles, &generator, &processor); 146 CpuProfiler profiler(isolate, profiles, &generator, &processor);
147 147
148 // Enqueue code creation events. 148 // Enqueue code creation events.
149 const char* aaa_str = "aaa"; 149 const char* aaa_str = "aaa";
150 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( 150 i::Handle<i::String> aaa_name = factory->NewStringFromAscii(
151 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); 151 i::Vector<const char>(aaa_str, i::StrLength(aaa_str)));
152 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); 152 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name);
153 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); 153 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment");
154 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); 154 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 i::Isolate* isolate = i::Isolate::Current(); 195 i::Isolate* isolate = i::Isolate::Current();
196 i::HandleScope scope(isolate); 196 i::HandleScope scope(isolate);
197 197
198 i::Code* frame1_code = CreateCode(&env); 198 i::Code* frame1_code = CreateCode(&env);
199 i::Code* frame2_code = CreateCode(&env); 199 i::Code* frame2_code = CreateCode(&env);
200 i::Code* frame3_code = CreateCode(&env); 200 i::Code* frame3_code = CreateCode(&env);
201 201
202 CpuProfilesCollection* profiles = new CpuProfilesCollection; 202 CpuProfilesCollection* profiles = new CpuProfilesCollection;
203 profiles->StartProfiling("", 1, false); 203 profiles->StartProfiling("", 1, false);
204 ProfileGenerator generator(profiles); 204 ProfileGenerator generator(profiles);
205 ProfilerEventsProcessor processor(&generator, profiles); 205 ProfilerEventsProcessor processor(&generator);
206 processor.Start(); 206 processor.Start();
207 CpuProfiler profiler(isolate, profiles, &generator, &processor); 207 CpuProfiler profiler(isolate, profiles, &generator, &processor);
208 208
209 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); 209 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb");
210 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); 210 profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5);
211 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); 211 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd");
212 212
213 EnqueueTickSampleEvent(&processor, frame1_code->instruction_start()); 213 EnqueueTickSampleEvent(&processor, frame1_code->instruction_start());
214 EnqueueTickSampleEvent( 214 EnqueueTickSampleEvent(
215 &processor, 215 &processor,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 TestSetup test_setup; 265 TestSetup test_setup;
266 LocalContext env; 266 LocalContext env;
267 i::Isolate* isolate = i::Isolate::Current(); 267 i::Isolate* isolate = i::Isolate::Current();
268 i::HandleScope scope(isolate); 268 i::HandleScope scope(isolate);
269 269
270 i::Code* code = CreateCode(&env); 270 i::Code* code = CreateCode(&env);
271 271
272 CpuProfilesCollection* profiles = new CpuProfilesCollection; 272 CpuProfilesCollection* profiles = new CpuProfilesCollection;
273 profiles->StartProfiling("", 1, false); 273 profiles->StartProfiling("", 1, false);
274 ProfileGenerator generator(profiles); 274 ProfileGenerator generator(profiles);
275 ProfilerEventsProcessor processor(&generator, profiles); 275 ProfilerEventsProcessor processor(&generator);
276 processor.Start(); 276 processor.Start();
277 CpuProfiler profiler(isolate, profiles, &generator, &processor); 277 CpuProfiler profiler(isolate, profiles, &generator, &processor);
278 278
279 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); 279 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb");
280 280
281 i::TickSample* sample = processor.TickSampleEvent(); 281 i::TickSample* sample = processor.TickSampleEvent();
282 sample->pc = code->address(); 282 sample->pc = code->address();
283 sample->tos = 0; 283 sample->tos = 0;
284 sample->frames_count = i::TickSample::kMaxFramesCount; 284 sample->frames_count = i::TickSample::kMaxFramesCount;
285 for (int i = 0; i < sample->frames_count; ++i) { 285 for (int i = 0; i < sample->frames_count; ++i) {
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 names[1] = v8::String::New(ProfileGenerator::kProgramEntryName); 996 names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
997 names[2] = v8::String::New("start"); 997 names[2] = v8::String::New("start");
998 // Don't allow |foo| node to be at the top level. 998 // Don't allow |foo| node to be at the top level.
999 CheckChildrenNames(root, names); 999 CheckChildrenNames(root, names);
1000 1000
1001 const v8::CpuProfileNode* startNode = GetChild(root, "start"); 1001 const v8::CpuProfileNode* startNode = GetChild(root, "start");
1002 GetChild(startNode, "foo"); 1002 GetChild(startNode, "foo");
1003 1003
1004 cpu_profiler->DeleteAllCpuProfiles(); 1004 cpu_profiler->DeleteAllCpuProfiles();
1005 } 1005 }
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