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

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

Issue 115918: Use uint in ProfLazyMode test when measuring time delta. (Closed)
Patch Set: Created 11 years, 6 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 | « no previous file | 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 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 buffer[map_log_size] = '\0'; 159 buffer[map_log_size] = '\0';
160 const char* code_creation = "\ncode-creation,"; // eq. to /^code-creation,/ 160 const char* code_creation = "\ncode-creation,"; // eq. to /^code-creation,/
161 CHECK_NE(NULL, strstr(buffer.start(), code_creation)); 161 CHECK_NE(NULL, strstr(buffer.start(), code_creation));
162 162
163 // Force compiler to generate new code by parametrizing source. 163 // Force compiler to generate new code by parametrizing source.
164 EmbeddedVector<char, 100> script_src; 164 EmbeddedVector<char, 100> script_src;
165 i::OS::SNPrintF(script_src, 165 i::OS::SNPrintF(script_src,
166 "for (var i = 0; i < 1000; ++i) { " 166 "for (var i = 0; i < 1000; ++i) { "
167 "(function(x) { return %d * x; })(i); }", 167 "(function(x) { return %d * x; })(i); }",
168 log_pos); 168 log_pos);
169 // Run code for 200 msecs to get some ticks. 169 // Run code for 200 msecs to get some ticks. Use uint to always have
170 const int64_t started_us = i::OS::Ticks(); 170 // non-negative delta.
171 while (i::OS::Ticks() - started_us < 200 * 1000) { 171 const uint64_t started_us = i::OS::Ticks();
172 uint64_t delta;
173 while ((delta = i::OS::Ticks() - started_us) < 200 * 1000) {
William Hesse 2009/05/29 12:19:49 The condition should really be (ended_us = ticks()
William Hesse 2009/05/29 12:55:32 Actually, we don't really understand what is going
172 CompileAndRunScript(script_src.start()); 174 CompileAndRunScript(script_src.start());
173 } 175 }
174 176
175 Logger::PauseProfiler(); 177 Logger::PauseProfiler();
176 CHECK(!LoggerTestHelper::IsSamplerActive()); 178 CHECK(!LoggerTestHelper::IsSamplerActive());
177 179
178 // Now we must have compiler and tick records. 180 // Now we must have compiler and tick records.
179 int log_size = GetLogLines(log_pos, &buffer); 181 int log_size = GetLogLines(log_pos, &buffer);
180 printf("log_size: %d\n", log_size); 182 printf("log_size: %d\n", log_size);
181 CHECK_GT(log_size, 0); 183 CHECK_GT(log_size, 0);
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 // Make sure that all log data is written prior crash due to CHECK failure. 701 // Make sure that all log data is written prior crash due to CHECK failure.
700 fflush(stdout); 702 fflush(stdout);
701 CHECK(results_equal); 703 CHECK(results_equal);
702 704
703 env->Exit(); 705 env->Exit();
704 Logger::TearDown(); 706 Logger::TearDown();
705 i::FLAG_always_compact = saved_always_compact; 707 i::FLAG_always_compact = saved_always_compact;
706 } 708 }
707 709
708 #endif // ENABLE_LOGGING_AND_PROFILING 710 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698