Print this page
rev 6909 : 8065361: Fixup headers and definitions for INCLUDE_TRACE
Reviewed-by: sla, stefank
Split |
Split |
Close |
Expand all |
Collapse all |
--- old/hotspot/src/share/vm/trace/traceEventClasses.xsl
+++ new/hotspot/src/share/vm/trace/traceEventClasses.xsl
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <!--
3 3 Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
4 4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 5
6 6 This code is free software; you can redistribute it and/or modify it
7 7 under the terms of the GNU General Public License version 2 only, as
8 8 published by the Free Software Foundation.
9 9
10 10 This code is distributed in the hope that it will be useful, but WITHOUT
11 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 13 version 2 for more details (a copy is included in the LICENSE file that
14 14 accompanied this code).
15 15
16 16 You should have received a copy of the GNU General Public License version
17 17 2 along with this work; if not, write to the Free Software Foundation,
18 18 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 19
20 20 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 21 or visit www.oracle.com if you need additional information or have any
22 22 questions.
23 23 -->
24 24
25 25 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
26 26 <xsl:import href="xsl_util.xsl"/>
27 27 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
28 28
29 29 <xsl:template match="/">
30 30 <xsl:call-template name="file-header"/>
31 31
32 32 #ifndef TRACEFILES_TRACEEVENTCLASSES_HPP
33 33 #define TRACEFILES_TRACEEVENTCLASSES_HPP
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
34 34
35 35 // On purpose outside the INCLUDE_TRACE
36 36 // Some parts of traceEvent.hpp are used outside of
37 37 // INCLUDE_TRACE
38 38
39 39 #include "memory/resourceArea.hpp"
40 40 #include "tracefiles/traceTypes.hpp"
41 41 #include "trace/traceEvent.hpp"
42 42 #include "utilities/macros.hpp"
43 43 #include "utilities/ticks.hpp"
44 -
45 44 #if INCLUDE_TRACE
46 -
47 -
48 45 #include "trace/traceStream.hpp"
49 46 #include "utilities/ostream.hpp"
50 47
51 48 <xsl:apply-templates select="trace/events/struct" mode="trace"/>
52 49 <xsl:apply-templates select="trace/events/event" mode="trace"/>
53 50
54 -#else
51 +#else // !INCLUDE_TRACE
55 52
56 53 class TraceEvent {
57 54 public:
58 55 TraceEvent() {}
59 56 void set_starttime(const Ticks& time) {}
60 57 void set_endtime(const Ticks& time) {}
61 58 bool should_commit() const { return false; }
62 59 void commit() const {}
63 60 };
64 61
65 62 <xsl:apply-templates select="trace/events/struct" mode="empty"/>
66 63 <xsl:apply-templates select="trace/events/event" mode="empty"/>
67 64
68 -#endif
69 -
70 -#endif
65 +#endif // INCLUDE_TRACE
66 +#endif // TRACEFILES_TRACEEVENTCLASSES_HPP
71 67 </xsl:template>
72 68
73 69 <xsl:template match="struct" mode="trace">
74 70 struct TraceStruct<xsl:value-of select="@id"/>
75 71 {
76 72 private:
77 73 <xsl:apply-templates select="value" mode="write-fields"/>
78 74 public:
79 75 <xsl:apply-templates select="value" mode="write-setters"/>
80 76
81 77 void writeStruct(TraceStream& ts) {
82 78 <xsl:apply-templates select="value" mode="write-data"/>
83 79 }
84 80 };
85 81
86 82 </xsl:template>
87 83
88 84 <xsl:template match="struct" mode="empty">
89 85 struct TraceStruct<xsl:value-of select="@id"/>
90 86 {
91 87 public:
92 88 <xsl:apply-templates select="value" mode="write-empty-setters"/>
93 89 };
94 90 </xsl:template>
95 91
96 92
97 93 <xsl:template match="event" mode="empty">
98 94 <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent')"/>
99 95 {
100 96 public:
101 97 <xsl:value-of select="concat(' Event', @id, '(bool ignore=true) {}')"/>
102 98 <xsl:text>
103 99 </xsl:text>
104 100
105 101 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-empty-setters"/>
106 102 };
107 103
108 104 </xsl:template>
109 105
110 106
111 107 <xsl:template match="event" mode="trace">
112 108 <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent<Event', @id, '>')"/>
113 109 {
114 110 public:
115 111 static const bool hasThread = <xsl:value-of select="@has_thread"/>;
116 112 static const bool hasStackTrace = <xsl:value-of select="@has_stacktrace"/>;
117 113 static const bool isInstant = <xsl:value-of select="@is_instant"/>;
118 114 static const bool isRequestable = <xsl:value-of select="@is_requestable"/>;
119 115 static const TraceEventId eventId = <xsl:value-of select="concat('Trace', @id, 'Event')"/>;
120 116
121 117 private:
122 118 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-fields"/>
123 119
124 120 void writeEventContent(void) {
125 121 TraceStream ts(*tty);
126 122 ts.print("<xsl:value-of select="@label"/>: [");
127 123 <xsl:apply-templates select="value|structvalue" mode="write-data"/>
128 124 ts.print("]\n");
129 125 }
130 126
131 127 public:
132 128 <xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-setters"/>
133 129
134 130 bool should_write(void) {
135 131 return true;
136 132 }
137 133 <xsl:text>
138 134
139 135 </xsl:text>
140 136 <xsl:value-of select="concat(' Event', @id, '(EventStartTime timing=TIMED) : TraceEvent<Event', @id, '>(timing) {}', $newline)"/>
141 137 void writeEvent(void) {
142 138 ResourceMark rm;
143 139 if (UseLockedTracing) {
144 140 ttyLocker lock;
145 141 writeEventContent();
146 142 } else {
147 143 writeEventContent();
148 144 }
149 145 }
150 146 };
151 147
152 148 </xsl:template>
153 149
154 150 <xsl:template match="value|transition_value|relation" mode="write-empty-setters">
155 151 <xsl:param name="cls"/>
156 152 <xsl:variable name="type" select="@type"/>
157 153 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
158 154 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' value) { }')"/>
159 155 <xsl:if test="position() != last()">
160 156 <xsl:text>
161 157 </xsl:text>
162 158 </xsl:if>
163 159 </xsl:template>
164 160
165 161 <xsl:template match="structvalue" mode="write-empty-setters">
166 162 <xsl:param name="cls"/>
167 163 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& value) { }')"/>
168 164 <xsl:if test="position() != last()">
169 165 <xsl:text>
170 166 </xsl:text>
171 167 </xsl:if>
172 168 </xsl:template>
173 169
174 170 <xsl:template match="value[@type='TICKS']" mode="write-setters">
175 171 #if INCLUDE_TRACE
176 172 <xsl:value-of select="concat(' void set_', @field, '(const Ticks& time) { _', @field, ' = time; }')"/>
177 173 #else
178 174 <xsl:value-of select="concat(' void set_', @field, '(const Ticks& ignore) {}')"/>
179 175 #endif
180 176 </xsl:template>
181 177
182 178 <xsl:template match="value[@type='TICKSPAN']" mode="write-setters">
183 179 #if INCLUDE_TRACE
184 180 <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& time) { _', @field, ' = time; }')"/>
185 181 #else
186 182 <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& ignore) {}')"/>
187 183 #endif
188 184 </xsl:template>
189 185
190 186
191 187 <xsl:template match="value" mode="write-fields">
192 188 <xsl:variable name="type" select="@type"/>
193 189 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
194 190 <xsl:value-of select="concat(' ', $wt, ' _', @field, ';')"/>
195 191 <xsl:if test="position() != last()">
196 192 <xsl:text>
197 193 </xsl:text>
198 194 </xsl:if>
199 195 </xsl:template>
200 196
201 197 <xsl:template match="structvalue" mode="write-fields">
202 198 <xsl:value-of select="concat(' TraceStruct', @type, ' _', @field, ';')"/>
203 199 <xsl:text>
204 200 </xsl:text>
205 201 </xsl:template>
206 202
207 203 <xsl:template match="value|transition_value|relation" mode="write-setters">
208 204 <xsl:param name="cls"/>
209 205 <xsl:variable name="type" select="@type"/>
210 206 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
211 207 <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' value) { this->_', @field, ' = value; }')"/>
212 208 <xsl:if test="position() != last()">
213 209 <xsl:text>
214 210 </xsl:text>
215 211 </xsl:if>
216 212 </xsl:template>
217 213
218 214 <xsl:template match="structvalue" mode="write-setters">
219 215 <xsl:param name="cls"/>
220 216 <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '& value) { this->_', @field, ' = value; }')"/>
221 217 <xsl:if test="position() != last()">
222 218 <xsl:text>
223 219 </xsl:text>
224 220 </xsl:if>
225 221 </xsl:template>
226 222
227 223 <xsl:template match="value" mode="write-data">
228 224 <xsl:variable name="type" select="@type"/>
229 225 <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@writetype"/>
230 226 <xsl:choose>
231 227 <xsl:when test="@type='TICKSPAN'">
232 228 <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, '.value());')"/>
233 229 </xsl:when>
234 230 <xsl:when test="@type='TICKS'">
235 231 <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, '.value());')"/>
236 232 </xsl:when>
237 233 <xsl:otherwise>
238 234 <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, ');')"/>
239 235 </xsl:otherwise>
240 236 </xsl:choose>
241 237 <xsl:if test="position() != last()">
242 238 <xsl:text>
243 239 ts.print(", ");
244 240 </xsl:text>
245 241 </xsl:if>
246 242 </xsl:template>
247 243
248 244 <xsl:template match="structvalue" mode="write-data">
249 245 <xsl:value-of select="concat(' _', @field, '.writeStruct(ts);')"/>
250 246 <xsl:if test="position() != last()">
251 247 <xsl:text>
252 248 ts.print(", ");
253 249 </xsl:text>
254 250 </xsl:if>
255 251 </xsl:template>
256 252
257 253 </xsl:stylesheet>
↓ open down ↓ |
177 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX