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

Side by Side Diff: test/cctest/test-log.cc

Issue 546089: Fix issue 553: function frame is skipped in profile when compare stub is called. (Closed)
Patch Set: Introduced dedicated log event types, added stuff for DevTools Created 10 years, 11 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
« no previous file with comments | « src/spaces.cc ('k') | test/cctest/test-log-stack-tracer.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of logging functions from log.h 3 // Tests of logging functions from log.h
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #ifdef __linux__ 7 #ifdef __linux__
8 #include <math.h> 8 #include <math.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 struct sigaction sa; 195 struct sigaction sa;
196 sa.sa_sigaction = SigProfSignalHandler; 196 sa.sa_sigaction = SigProfSignalHandler;
197 sigemptyset(&sa.sa_mask); 197 sigemptyset(&sa.sa_mask);
198 sa.sa_flags = SA_SIGINFO; 198 sa.sa_flags = SA_SIGINFO;
199 CHECK_EQ(0, sigaction(SIGPROF, &sa, &old_sigprof_handler)); 199 CHECK_EQ(0, sigaction(SIGPROF, &sa, &old_sigprof_handler));
200 #endif // __linux__ 200 #endif // __linux__
201 201
202 // Force compiler to generate new code by parametrizing source. 202 // Force compiler to generate new code by parametrizing source.
203 EmbeddedVector<char, 100> script_src; 203 EmbeddedVector<char, 100> script_src;
204 i::OS::SNPrintF(script_src, 204 i::OS::SNPrintF(script_src,
205 "for (var i = 0; i < 1000; ++i) { " 205 "function f%d(x) { return %d * x; }"
206 "(function(x) { return %d * x; })(i); }", 206 "for (var i = 0; i < 10000; ++i) { f%d(i); }",
207 log_pos); 207 log_pos, log_pos, log_pos);
208 // Run code for 200 msecs to get some ticks. 208 // Run code for 200 msecs to get some ticks.
209 const double end_time = i::OS::TimeCurrentMillis() + 200; 209 const double end_time = i::OS::TimeCurrentMillis() + 200;
210 while (i::OS::TimeCurrentMillis() < end_time) { 210 while (i::OS::TimeCurrentMillis() < end_time) {
211 CompileAndRunScript(script_src.start()); 211 CompileAndRunScript(script_src.start());
212 // Yield CPU to give Profiler thread a chance to process ticks. 212 // Yield CPU to give Profiler thread a chance to process ticks.
213 i::OS::Sleep(1); 213 i::OS::Sleep(1);
214 } 214 }
215 215
216 Logger::PauseProfiler(v8::PROFILER_MODULE_CPU); 216 Logger::PauseProfiler(v8::PROFILER_MODULE_CPU);
217 CHECK(!LoggerTestHelper::IsSamplerActive()); 217 CHECK(!LoggerTestHelper::IsSamplerActive());
218 218
219 // Wait 50 msecs to allow Profiler thread to process the last 219 // Wait 50 msecs to allow Profiler thread to process the last
220 // tick sample it has got. 220 // tick sample it has got.
221 i::OS::Sleep(50); 221 i::OS::Sleep(50);
222 222
223 // Now we must have compiler and tick records. 223 // Now we must have compiler and tick records.
224 int log_size = GetLogLines(log_pos, &buffer); 224 int log_size = GetLogLines(log_pos, &buffer);
225 printf("log_size: %d\n", log_size); 225 printf("log_size: %d\n", log_size);
226 CHECK_GT(log_size, 0); 226 CHECK_GT(log_size, 0);
227 CHECK_GT(buffer.length(), log_size); 227 CHECK_GT(buffer.length(), log_size);
228 log_pos += log_size; 228 log_pos += log_size;
229 // Check buffer contents. 229 // Check buffer contents.
230 buffer[log_size] = '\0'; 230 buffer[log_size] = '\0';
231 printf("%s", buffer.start());
231 const char* tick = "\ntick,"; 232 const char* tick = "\ntick,";
232 CHECK_NE(NULL, strstr(buffer.start(), code_creation)); 233 CHECK_NE(NULL, strstr(buffer.start(), code_creation));
233 const bool ticks_found = strstr(buffer.start(), tick) != NULL; 234 const bool ticks_found = strstr(buffer.start(), tick) != NULL;
234 CHECK_EQ(was_sigprof_received, ticks_found); 235 CHECK_EQ(was_sigprof_received, ticks_found);
235 236
236 return log_pos; 237 return log_pos;
237 } 238 }
238 239
239 240
240 TEST(ProfLazyMode) { 241 TEST(ProfLazyMode) {
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 // Make sure that all log data is written prior crash due to CHECK failure. 1073 // Make sure that all log data is written prior crash due to CHECK failure.
1073 fflush(stdout); 1074 fflush(stdout);
1074 CHECK(results_equal); 1075 CHECK(results_equal);
1075 1076
1076 env->Exit(); 1077 env->Exit();
1077 Logger::TearDown(); 1078 Logger::TearDown();
1078 i::FLAG_always_compact = saved_always_compact; 1079 i::FLAG_always_compact = saved_always_compact;
1079 } 1080 }
1080 1081
1081 #endif // ENABLE_LOGGING_AND_PROFILING 1082 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | test/cctest/test-log-stack-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698