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

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

Issue 337093005: Revert 22098 "Linux perf tool support update + refactoring." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/log.cc ('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 2014 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/v8.h"
32
33 namespace v8 {
34 namespace internal {
35
36 #ifdef __linux__
37
38 // Linux perf tool logging support
39 class PerfJitLogger : public CodeEventLogger {
40 public:
41 PerfJitLogger();
42 virtual ~PerfJitLogger();
43
44 virtual void CodeMoveEvent(Address from, Address to);
45 virtual void CodeDeleteEvent(Address from);
46 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { }
47 virtual void SnapshotPositionEvent(Address addr, int pos);
48
49 private:
50 uint64_t GetTimestamp();
51 virtual void LogRecordedBuffer(Code* code,
52 SharedFunctionInfo* shared,
53 const char* name,
54 int length);
55
56 // Extension added to V8 log file name to get the low-level log name.
57 static const char kFilenameFormatString[];
58 static const int kFilenameBufferPadding;
59
60 static const char kTraceClockDevice[];
61 static const int kClockInvalid = -1;
62 static const uint64_t kNsecPerSec = 1000000000;
63
64 // File buffer size of the low-level log. We don't use the default to
65 // minimize the associated overhead.
66 static const int kLogBufferSize = 2 * MB;
67
68 void LogWriteBytes(const char* bytes, int size);
69 void LogWriteHeader();
70
71 static const uint32_t kElfMachIA32 = 3;
72 static const uint32_t kElfMachX64 = 62;
73 static const uint32_t kElfMachARM = 40;
74 static const uint32_t kElfMachMIPS = 10;
75
76 uint32_t GetElfMach() {
77 #if V8_TARGET_ARCH_IA32
78 return kElfMachIA32;
79 #elif V8_TARGET_ARCH_X64
80 return kElfMachX64;
81 #elif V8_TARGET_ARCH_ARM
82 return kElfMachARM;
83 #elif V8_TARGET_ARCH_MIPS
84 return kElfMachMIPS;
85 #else
86 UNIMPLEMENTED();
87 return 0;
88 #endif
89 }
90
91 FILE* perf_output_handle_;
92 int clock_fd_;
93 int clock_id_;
94 uint64_t code_index_;
95 };
96
97 #else
98
99 // PerfJitLogger is only implemented on Linux
100 class PerfJitLogger : public CodeEventLogger {
101 public:
102 virtual void CodeMoveEvent(Address from, Address to) {
103 UNIMPLEMENTED();
104 }
105
106 virtual void CodeDeleteEvent(Address from) {
107 UNIMPLEMENTED();
108 }
109
110 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) {
111 UNIMPLEMENTED();
112 }
113
114 virtual void SnapshotPositionEvent(Address addr, int pos) {
115 UNIMPLEMENTED();
116 }
117
118 virtual void LogRecordedBuffer(Code* code,
119 SharedFunctionInfo* shared,
120 const char* name,
121 int length) {
122 UNIMPLEMENTED();
123 }
124 };
125
126 #endif // defined(__linux__)
127
128 } } // namespace v8::internal
129 #endif
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/perf-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698