OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 void AppendByte(char c) { | 117 void AppendByte(char c) { |
118 if (utf8_pos_ >= kUtf8BufferSize) return; | 118 if (utf8_pos_ >= kUtf8BufferSize) return; |
119 utf8_buffer_[utf8_pos_++] = c; | 119 utf8_buffer_[utf8_pos_++] = c; |
120 } | 120 } |
121 | 121 |
122 void AppendInt(int n) { | 122 void AppendInt(int n) { |
123 Vector<char> buffer(utf8_buffer_ + utf8_pos_, | 123 Vector<char> buffer(utf8_buffer_ + utf8_pos_, |
124 kUtf8BufferSize - utf8_pos_); | 124 kUtf8BufferSize - utf8_pos_); |
125 int size = OS::SNPrintF(buffer, "%d", n); | 125 int size = SNPrintF(buffer, "%d", n); |
126 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { | 126 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { |
127 utf8_pos_ += size; | 127 utf8_pos_ += size; |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 void AppendHex(uint32_t n) { | 131 void AppendHex(uint32_t n) { |
132 Vector<char> buffer(utf8_buffer_ + utf8_pos_, | 132 Vector<char> buffer(utf8_buffer_ + utf8_pos_, |
133 kUtf8BufferSize - utf8_pos_); | 133 kUtf8BufferSize - utf8_pos_); |
134 int size = OS::SNPrintF(buffer, "%x", n); | 134 int size = SNPrintF(buffer, "%x", n); |
135 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { | 135 if (size > 0 && utf8_pos_ + size <= kUtf8BufferSize) { |
136 utf8_pos_ += size; | 136 utf8_pos_ += size; |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 const char* get() { return utf8_buffer_; } | 140 const char* get() { return utf8_buffer_; } |
141 int size() const { return utf8_pos_; } | 141 int size() const { return utf8_pos_; } |
142 | 142 |
143 private: | 143 private: |
144 static const int kUtf8BufferSize = 512; | 144 static const int kUtf8BufferSize = 512; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 252 |
253 const char PerfBasicLogger::kFilenameFormatString[] = "/tmp/perf-%d.map"; | 253 const char PerfBasicLogger::kFilenameFormatString[] = "/tmp/perf-%d.map"; |
254 // Extra space for the PID in the filename | 254 // Extra space for the PID in the filename |
255 const int PerfBasicLogger::kFilenameBufferPadding = 16; | 255 const int PerfBasicLogger::kFilenameBufferPadding = 16; |
256 | 256 |
257 PerfBasicLogger::PerfBasicLogger() | 257 PerfBasicLogger::PerfBasicLogger() |
258 : perf_output_handle_(NULL) { | 258 : perf_output_handle_(NULL) { |
259 // Open the perf JIT dump file. | 259 // Open the perf JIT dump file. |
260 int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding; | 260 int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding; |
261 ScopedVector<char> perf_dump_name(bufferSize); | 261 ScopedVector<char> perf_dump_name(bufferSize); |
262 int size = OS::SNPrintF( | 262 int size = SNPrintF( |
263 perf_dump_name, | 263 perf_dump_name, |
264 kFilenameFormatString, | 264 kFilenameFormatString, |
265 OS::GetCurrentProcessId()); | 265 OS::GetCurrentProcessId()); |
266 CHECK_NE(size, -1); | 266 CHECK_NE(size, -1); |
267 perf_output_handle_ = OS::FOpen(perf_dump_name.start(), OS::LogFileOpenMode); | 267 perf_output_handle_ = OS::FOpen(perf_dump_name.start(), OS::LogFileOpenMode); |
268 CHECK_NE(perf_output_handle_, NULL); | 268 CHECK_NE(perf_output_handle_, NULL); |
269 setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize); | 269 setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize); |
270 } | 270 } |
271 | 271 |
272 | 272 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 const char PerfJitLogger::kFilenameFormatString[] = "/tmp/jit-%d.dump"; | 376 const char PerfJitLogger::kFilenameFormatString[] = "/tmp/jit-%d.dump"; |
377 | 377 |
378 // Extra padding for the PID in the filename | 378 // Extra padding for the PID in the filename |
379 const int PerfJitLogger::kFilenameBufferPadding = 16; | 379 const int PerfJitLogger::kFilenameBufferPadding = 16; |
380 | 380 |
381 PerfJitLogger::PerfJitLogger() | 381 PerfJitLogger::PerfJitLogger() |
382 : perf_output_handle_(NULL) { | 382 : perf_output_handle_(NULL) { |
383 // Open the perf JIT dump file. | 383 // Open the perf JIT dump file. |
384 int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding; | 384 int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding; |
385 ScopedVector<char> perf_dump_name(bufferSize); | 385 ScopedVector<char> perf_dump_name(bufferSize); |
386 int size = OS::SNPrintF( | 386 int size = SNPrintF( |
387 perf_dump_name, | 387 perf_dump_name, |
388 kFilenameFormatString, | 388 kFilenameFormatString, |
389 OS::GetCurrentProcessId()); | 389 OS::GetCurrentProcessId()); |
390 CHECK_NE(size, -1); | 390 CHECK_NE(size, -1); |
391 perf_output_handle_ = OS::FOpen(perf_dump_name.start(), OS::LogFileOpenMode); | 391 perf_output_handle_ = OS::FOpen(perf_dump_name.start(), OS::LogFileOpenMode); |
392 CHECK_NE(perf_output_handle_, NULL); | 392 CHECK_NE(perf_output_handle_, NULL); |
393 setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize); | 393 setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize); |
394 | 394 |
395 LogWriteHeader(); | 395 LogWriteHeader(); |
396 } | 396 } |
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 if (jit_logger_) { | 2119 if (jit_logger_) { |
2120 removeCodeEventListener(jit_logger_); | 2120 removeCodeEventListener(jit_logger_); |
2121 delete jit_logger_; | 2121 delete jit_logger_; |
2122 jit_logger_ = NULL; | 2122 jit_logger_ = NULL; |
2123 } | 2123 } |
2124 | 2124 |
2125 return log_->Close(); | 2125 return log_->Close(); |
2126 } | 2126 } |
2127 | 2127 |
2128 } } // namespace v8::internal | 2128 } } // namespace v8::internal |
OLD | NEW |