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

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

Issue 366883004: Revert "Reland "Linux perf tool support update + refactoring." (r22118)" (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 // TODO(jarin) For now, we disable perf integration on Android because of a
37 // build problem - when building the snapshot with AOSP, librt is not
38 // available, so we cannot use the clock_gettime function. To fix this, we
39 // should thread through the V8_LIBRT_NOT_AVAILABLE flag here and only disable
40 // the perf integration when this flag is present (the perf integration is not
41 // needed when generating snapshot, so it is fine to ifdef it away).
42
43 #if defined(__linux__) && !defined(ANDROID)
44
45 // Linux perf tool logging support
46 class PerfJitLogger : public CodeEventLogger {
47 public:
48 PerfJitLogger();
49 virtual ~PerfJitLogger();
50
51 virtual void CodeMoveEvent(Address from, Address to);
52 virtual void CodeDeleteEvent(Address from);
53 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { }
54 virtual void SnapshotPositionEvent(Address addr, int pos);
55
56 private:
57 uint64_t GetTimestamp();
58 virtual void LogRecordedBuffer(Code* code,
59 SharedFunctionInfo* shared,
60 const char* name,
61 int length);
62
63 // Extension added to V8 log file name to get the low-level log name.
64 static const char kFilenameFormatString[];
65 static const int kFilenameBufferPadding;
66
67 static const char kTraceClockDevice[];
68 static const int kClockInvalid = -1;
69 static const uint64_t kNsecPerSec = 1000000000;
70
71 // File buffer size of the low-level log. We don't use the default to
72 // minimize the associated overhead.
73 static const int kLogBufferSize = 2 * MB;
74
75 void LogWriteBytes(const char* bytes, int size);
76 void LogWriteHeader();
77
78 static const uint32_t kElfMachIA32 = 3;
79 static const uint32_t kElfMachX64 = 62;
80 static const uint32_t kElfMachARM = 40;
81 static const uint32_t kElfMachMIPS = 10;
82
83 uint32_t GetElfMach() {
84 #if V8_TARGET_ARCH_IA32
85 return kElfMachIA32;
86 #elif V8_TARGET_ARCH_X64
87 return kElfMachX64;
88 #elif V8_TARGET_ARCH_ARM
89 return kElfMachARM;
90 #elif V8_TARGET_ARCH_MIPS
91 return kElfMachMIPS;
92 #else
93 UNIMPLEMENTED();
94 return 0;
95 #endif
96 }
97
98 FILE* perf_output_handle_;
99 int clock_fd_;
100 int clock_id_;
101 uint64_t code_index_;
102 };
103
104 #else
105
106 // PerfJitLogger is only implemented on Linux
107 class PerfJitLogger : public CodeEventLogger {
108 public:
109 virtual void CodeMoveEvent(Address from, Address to) {
110 UNIMPLEMENTED();
111 }
112
113 virtual void CodeDeleteEvent(Address from) {
114 UNIMPLEMENTED();
115 }
116
117 virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) {
118 UNIMPLEMENTED();
119 }
120
121 virtual void SnapshotPositionEvent(Address addr, int pos) {
122 UNIMPLEMENTED();
123 }
124
125 virtual void LogRecordedBuffer(Code* code,
126 SharedFunctionInfo* shared,
127 const char* name,
128 int length) {
129 UNIMPLEMENTED();
130 }
131 };
132
133 #endif // defined(__linux__) && !defined(ANDROID)
134
135 } } // namespace v8::internal
136 #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