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

Side by Side Diff: src/perf-jit.h

Issue 1809203007: Linux perf integration with the new support for JIT. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes 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 | « src/log-utils.h ('k') | src/perf-jit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_PERF_JIT_H_
29 #define V8_PERF_JIT_H_
30
31 #include "src/log.h"
32
33 namespace v8 {
34 namespace internal {
35
36 #if V8_OS_LINUX
37
38 // Linux perf tool logging support
39 class PerfJitLogger : public CodeEventLogger {
40 public:
41 PerfJitLogger();
42 virtual ~PerfJitLogger();
43
44 void CodeMoveEvent(AbstractCode* from, Address to) override;
45 void CodeDisableOptEvent(AbstractCode* code,
46 SharedFunctionInfo* shared) override {}
47
48 private:
49 void OpenJitDumpFile();
50 void CloseJitDumpFile();
51 void* OpenMarkerFile(int fd);
52 void CloseMarkerFile(void* marker_address);
53
54 uint64_t GetTimestamp();
55 void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared,
56 const char* name, int length) override;
57
58 // Extension added to V8 log file name to get the low-level log name.
59 static const char kFilenameFormatString[];
60 static const int kFilenameBufferPadding;
61
62 // File buffer size of the low-level log. We don't use the default to
63 // minimize the associated overhead.
64 static const int kLogBufferSize = 2 * MB;
65
66 void LogWriteBytes(const char* bytes, int size);
67 void LogWriteHeader();
68 void LogWriteDebugInfo(Code* code, SharedFunctionInfo* shared);
69
70 static const uint32_t kElfMachIA32 = 3;
71 static const uint32_t kElfMachX64 = 62;
72 static const uint32_t kElfMachARM = 40;
73 static const uint32_t kElfMachMIPS = 10;
74
75 uint32_t GetElfMach() {
76 #if V8_TARGET_ARCH_IA32
77 return kElfMachIA32;
78 #elif V8_TARGET_ARCH_X64
79 return kElfMachX64;
80 #elif V8_TARGET_ARCH_ARM
81 return kElfMachARM;
82 #elif V8_TARGET_ARCH_MIPS
83 return kElfMachMIPS;
84 #else
85 UNIMPLEMENTED();
86 return 0;
87 #endif
88 }
89
90 FILE* perf_output_handle_;
91 uint64_t code_index_;
92 void* marker_address_;
93 };
94
95 #else
96
97 // PerfJitLogger is only implemented on Linux
98 class PerfJitLogger : public CodeEventLogger {
99 public:
100 void CodeMoveEvent(AbstractCode* from, Address to) override {
101 UNIMPLEMENTED();
102 }
103
104 void CodeDisableOptEvent(AbstractCode* code,
105 SharedFunctionInfo* shared) override {
106 UNIMPLEMENTED();
107 }
108
109 void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared,
110 const char* name, int length) override {
111 UNIMPLEMENTED();
112 }
113 };
114
115 #endif // V8_OS_LINUX
116 } // namespace internal
117 } // namespace v8
118 #endif
OLDNEW
« no previous file with comments | « src/log-utils.h ('k') | src/perf-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698