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

Side by Side Diff: src/log.cc

Issue 1885033005: Portable Linux perf map formatting. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment added. Created 4 years, 8 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 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 "src/log.h" 5 #include "src/log.h"
6 6
7 #include <cstdarg> 7 #include <cstdarg>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 void PerfBasicLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*, 278 void PerfBasicLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*,
279 const char* name, int length) { 279 const char* name, int length) {
280 if (FLAG_perf_basic_prof_only_functions && 280 if (FLAG_perf_basic_prof_only_functions &&
281 (code->kind() != AbstractCode::FUNCTION && 281 (code->kind() != AbstractCode::FUNCTION &&
282 code->kind() != AbstractCode::INTERPRETED_FUNCTION && 282 code->kind() != AbstractCode::INTERPRETED_FUNCTION &&
283 code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) { 283 code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) {
284 return; 284 return;
285 } 285 }
286 286
287 base::OS::FPrint(perf_output_handle_, "%p %x %.*s\n", 287 // Linux perf expects hex literals without a leading 0x, while some
288 code->instruction_start(), code->instruction_size(), length, 288 // implementations of printf might prepend one when using the %p format
289 name); 289 // for pointers, leading to wrongly formatted JIT symbols maps.
290 //
291 // Instead, we use V8PRIxPTR format string and cast pointer to uintpr_t,
292 // so that we have control over the exact output format.
293 base::OS::FPrint(perf_output_handle_, "%" V8PRIxPTR " %x %.*s\n",
294 reinterpret_cast<uintptr_t>(code->instruction_start()),
295 code->instruction_size(), length, name);
290 } 296 }
291 297
292 // Low-level logging support. 298 // Low-level logging support.
293 #define LL_LOG(Call) if (ll_logger_) ll_logger_->Call; 299 #define LL_LOG(Call) if (ll_logger_) ll_logger_->Call;
294 300
295 class LowLevelLogger : public CodeEventLogger { 301 class LowLevelLogger : public CodeEventLogger {
296 public: 302 public:
297 explicit LowLevelLogger(const char* file_name); 303 explicit LowLevelLogger(const char* file_name);
298 ~LowLevelLogger() override; 304 ~LowLevelLogger() override;
299 305
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 removeCodeEventListener(jit_logger_); 1854 removeCodeEventListener(jit_logger_);
1849 delete jit_logger_; 1855 delete jit_logger_;
1850 jit_logger_ = NULL; 1856 jit_logger_ = NULL;
1851 } 1857 }
1852 1858
1853 return log_->Close(); 1859 return log_->Close();
1854 } 1860 }
1855 1861
1856 } // namespace internal 1862 } // namespace internal
1857 } // namespace v8 1863 } // namespace v8
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