src/share/vm/trace/traceEventClasses.xsl
Print this page
rev 5685 : 8028128: Add a type safe alternative for working with counter based data
Reviewed-by:
@@ -38,10 +38,11 @@
#include "memory/resourceArea.hpp"
#include "tracefiles/traceTypes.hpp"
#include "trace/traceEvent.hpp"
#include "utilities/macros.hpp"
+#include "utilities/ticks.hpp"
#if INCLUDE_TRACE
#include "trace/traceStream.hpp"
@@ -53,12 +54,12 @@
#else
class TraceEvent {
public:
TraceEvent() {}
- void set_starttime(jlong time) const {}
- void set_endtime(jlong time) const {}
+ void set_starttime(const Ticks& time) {}
+ void set_endtime(const Ticks& time) {}
bool should_commit() const { return false; }
void commit() const {}
};
<xsl:apply-templates select="trace/events/struct" mode="empty"/>
@@ -168,27 +169,27 @@
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
-
<xsl:template match="value[@type='TICKS']" mode="write-setters">
#if INCLUDE_TRACE
- <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
+<xsl:value-of select="concat(' void set_', @field, '(const Ticks& time) { _', @field, ' = time; }')"/>
#else
- <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
+<xsl:value-of select="concat(' void set_', @field, '(const Ticks& ignore) {}')"/>
#endif
</xsl:template>
-<xsl:template match="value[@type='RELATIVE_TICKS']" mode="write-setters">
+<xsl:template match="value[@type='TICKSPAN']" mode="write-setters">
#if INCLUDE_TRACE
- <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
+ <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& time) { _', @field, ' = time; }')"/>
#else
- <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
+ <xsl:value-of select="concat(' void set_', @field, '(const Tickspan& ignore) {}')"/>
#endif
</xsl:template>
+
<xsl:template match="value" mode="write-fields">
<xsl:variable name="type" select="@type"/>
<xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
<xsl:value-of select="concat(' ', $wt, ' _', @field, ';')"/>
<xsl:if test="position() != last()">
@@ -224,11 +225,21 @@
</xsl:template>
<xsl:template match="value" mode="write-data">
<xsl:variable name="type" select="@type"/>
<xsl:variable name="wt" select="//primary_type[@symbol=$type]/@writetype"/>
+ <xsl:choose>
+ <xsl:when test="@type='TICKSPAN'">
+ <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, '.value());')"/>
+ </xsl:when>
+ <xsl:when test="@type='TICKS'">
+ <xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, '.value());')"/>
+ </xsl:when>
+ <xsl:otherwise>
<xsl:value-of select="concat(' ts.print_val("', @label, '", _', @field, ');')"/>
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:if test="position() != last()">
<xsl:text>
ts.print(", ");
</xsl:text>
</xsl:if>