OLD | NEW |
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 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #include "log.h" | 9 #include "log.h" |
10 #include "cctest.h" | 10 #include "cctest.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 buffer[map_log_size] = '\0'; | 158 buffer[map_log_size] = '\0'; |
159 const char* code_creation = "\ncode-creation,"; // eq. to /^code-creation,/ | 159 const char* code_creation = "\ncode-creation,"; // eq. to /^code-creation,/ |
160 CHECK_NE(NULL, strstr(buffer.start(), code_creation)); | 160 CHECK_NE(NULL, strstr(buffer.start(), code_creation)); |
161 | 161 |
162 // Force compiler to generate new code by parametrizing source. | 162 // Force compiler to generate new code by parametrizing source. |
163 EmbeddedVector<char, 100> script_src; | 163 EmbeddedVector<char, 100> script_src; |
164 i::OS::SNPrintF(script_src, | 164 i::OS::SNPrintF(script_src, |
165 "for (var i = 0; i < 1000; ++i) { " | 165 "for (var i = 0; i < 1000; ++i) { " |
166 "(function(x) { return %d * x; })(i); }", | 166 "(function(x) { return %d * x; })(i); }", |
167 log_pos); | 167 log_pos); |
168 // Run code for 100 msecs to get some ticks. | 168 // Run code for 200 msecs to get some ticks. |
169 const int64_t started_us = i::OS::Ticks(); | 169 const int64_t started_us = i::OS::Ticks(); |
170 while (i::OS::Ticks() - started_us < 100 * 1000) { | 170 while (i::OS::Ticks() - started_us < 200 * 1000) { |
171 CompileAndRunScript(script_src.start()); | 171 CompileAndRunScript(script_src.start()); |
172 } | 172 } |
173 | 173 |
174 Logger::PauseProfiler(); | 174 Logger::PauseProfiler(); |
175 CHECK(!LoggerTestHelper::IsSamplerActive()); | 175 CHECK(!LoggerTestHelper::IsSamplerActive()); |
176 | 176 |
177 // Now we must have compiler and tick records. | 177 // Now we must have compiler and tick records. |
178 int log_size = GetLogLines(log_pos, &buffer); | 178 int log_size = GetLogLines(log_pos, &buffer); |
179 printf("log_size: %d\n", log_size); | 179 printf("log_size: %d\n", log_size); |
180 CHECK_GT(log_size, 0); | 180 CHECK_GT(log_size, 0); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // Make sure that all log data is written prior crash due to CHECK failure. | 698 // Make sure that all log data is written prior crash due to CHECK failure. |
699 fflush(stdout); | 699 fflush(stdout); |
700 CHECK(results_equal); | 700 CHECK(results_equal); |
701 | 701 |
702 env->Exit(); | 702 env->Exit(); |
703 Logger::TearDown(); | 703 Logger::TearDown(); |
704 i::FLAG_always_compact = saved_always_compact; | 704 i::FLAG_always_compact = saved_always_compact; |
705 } | 705 } |
706 | 706 |
707 #endif // ENABLE_LOGGING_AND_PROFILING | 707 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |