4141N/A<?xml version="1.0" encoding="utf-8"?>
4141N/A<!--
4141N/A Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4141N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4141N/A
4141N/A This code is free software; you can redistribute it and/or modify it
4141N/A under the terms of the GNU General Public License version 2 only, as
4141N/A published by the Free Software Foundation.
4141N/A
4141N/A This code is distributed in the hope that it will be useful, but WITHOUT
4141N/A ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4141N/A FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4141N/A version 2 for more details (a copy is included in the LICENSE file that
4141N/A accompanied this code).
4141N/A
4141N/A You should have received a copy of the GNU General Public License version
4141N/A 2 along with this work; if not, write to the Free Software Foundation,
4141N/A Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4141N/A
4141N/A Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4141N/A or visit www.oracle.com if you need additional information or have any
4141N/A questions.
4141N/A-->
4141N/A
4141N/A<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4141N/A<xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
4141N/A<xsl:import href="xsl_util.xsl"/>
4141N/A
4141N/A<xsl:template match="/">
4141N/A <xsl:call-template name="file-header"/>
4141N/A
4141N/A#ifndef TRACEFILES_TRACEEVENTCLASSES_HPP
4141N/A#define TRACEFILES_TRACEEVENTCLASSES_HPP
4141N/A
4141N/A// On purpose outside the INCLUDE_TRACE
4141N/A// Some parts of traceEvent.hpp are used outside of
4141N/A// INCLUDE_TRACE
4141N/A
4194N/A#include "memory/resourceArea.hpp"
4423N/A#include "runtime/handles.inline.hpp"
4141N/A#include "tracefiles/traceTypes.hpp"
4141N/A#include "trace/traceEvent.hpp"
4141N/A
4141N/A#if INCLUDE_TRACE
4141N/A
4141N/A#include "trace/traceStream.hpp"
4141N/A#include "utilities/ostream.hpp"
4141N/A
4141N/A <xsl:apply-templates select="trace/events/struct" mode="trace"/>
4141N/A <xsl:apply-templates select="trace/events/event" mode="trace"/>
4141N/A
4141N/A#else
4141N/A
4141N/Aclass TraceEvent {
4141N/Apublic:
4141N/A TraceEvent() {}
4141N/A void set_starttime(jlong time) const {}
4141N/A void set_endtime(jlong time) const {}
4141N/A bool should_commit() const { return false; }
4141N/A void commit() const {}
4141N/A};
4141N/A
4141N/A <xsl:apply-templates select="trace/events/struct" mode="empty"/>
4141N/A <xsl:apply-templates select="trace/events/event" mode="empty"/>
4141N/A
4141N/A#endif
4141N/A
4141N/A#endif
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="struct" mode="trace">
4141N/Astruct TraceStruct<xsl:value-of select="@id"/>
4141N/A{
4141N/Aprivate:
4141N/A<xsl:apply-templates select="value" mode="write-fields"/>
4141N/Apublic:
4141N/A<xsl:apply-templates select="value" mode="write-setters"/>
4141N/A
4141N/A void writeStruct(TraceStream&amp; ts) {
4141N/A<xsl:apply-templates select="value" mode="write-data"/>
4141N/A }
4141N/A};
4141N/A
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="struct" mode="empty">
4141N/Astruct TraceStruct<xsl:value-of select="@id"/>
4141N/A{
4141N/Apublic:
4141N/A<xsl:apply-templates select="value" mode="write-empty-setters"/>
4141N/A};
4141N/A</xsl:template>
4141N/A
4141N/A
4141N/A<xsl:template match="event" mode="empty">
4141N/A <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent')"/>
4141N/A{
4141N/A public:
4141N/A<xsl:value-of select="concat(' Event', @id, '(bool ignore=true) {}')"/>
4141N/A<xsl:text>
4141N/A</xsl:text>
4141N/A
4141N/A<xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-empty-setters"/>
4141N/A};
4141N/A
4141N/A</xsl:template>
4141N/A
4141N/A
4141N/A<xsl:template match="event" mode="trace">
4141N/A <xsl:value-of select="concat('class Event', @id, ' : public TraceEvent&lt;Event', @id, '&gt;')"/>
4141N/A{
4141N/A public:
4141N/A static const bool hasThread = <xsl:value-of select="@has_thread"/>;
4141N/A static const bool hasStackTrace = <xsl:value-of select="@has_stacktrace"/>;
4141N/A static const bool isInstant = <xsl:value-of select="@is_instant"/>;
4141N/A static const bool isRequestable = <xsl:value-of select="@is_requestable"/>;
4141N/A static const TraceEventId eventId = <xsl:value-of select="concat('Trace', @id, 'Event')"/>;
4141N/A
4141N/A private:
4141N/A<xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-fields"/>
4141N/A
4501N/A void writeEventContent(void) {
4501N/A TraceStream ts(*tty);
4501N/A ts.print("<xsl:value-of select="@label"/>: [");
4501N/A<xsl:apply-templates select="value|structvalue" mode="write-data"/>
4501N/A ts.print("]\n");
4501N/A }
4501N/A
4141N/A public:
4141N/A<xsl:apply-templates select="value|structvalue|transition_value|relation" mode="write-setters"/>
4141N/A
4141N/A bool should_write(void) {
4141N/A return true;
4141N/A }
4141N/A<xsl:text>
4141N/A
4141N/A</xsl:text>
4141N/A <xsl:value-of select="concat(' Event', @id, '(EventStartTime timing=TIMED) : TraceEvent&lt;Event', @id, '&gt;(timing) {}', $newline)"/>
4141N/A void writeEvent(void) {
4194N/A ResourceMark rm;
4423N/A HandleMark hm;
4501N/A if (UseLockedTracing) {
4501N/A ttyLocker lock;
4501N/A writeEventContent();
4501N/A } else {
4501N/A writeEventContent();
4501N/A }
4141N/A }
4501N/A
4141N/A};
4141N/A
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="value|transition_value|relation" mode="write-empty-setters">
4141N/A <xsl:param name="cls"/>
4141N/A <xsl:variable name="type" select="@type"/>
4141N/A <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
4141N/A <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' value) { }')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="structvalue" mode="write-empty-setters">
4141N/A <xsl:param name="cls"/>
4141N/A <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '&amp; value) { }')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A
4141N/A<xsl:template match="value[@type='TICKS']" mode="write-setters">
4141N/A#if INCLUDE_TRACE
4141N/A <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
4141N/A#else
4141N/A <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
4141N/A#endif
4141N/A</xsl:template>
4141N/A
4177N/A<xsl:template match="value[@type='RELATIVE_TICKS']" mode="write-setters">
4177N/A#if INCLUDE_TRACE
4177N/A <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
4177N/A#else
4177N/A <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
4177N/A#endif
4177N/A</xsl:template>
4177N/A
4141N/A<xsl:template match="value" mode="write-fields">
4141N/A <xsl:variable name="type" select="@type"/>
4141N/A <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
4141N/A <xsl:value-of select="concat(' ', $wt, ' _', @field, ';')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="structvalue" mode="write-fields">
4141N/A <xsl:value-of select="concat(' TraceStruct', @type, ' _', @field, ';')"/>
4141N/A <xsl:text>
4141N/A</xsl:text>
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="value|transition_value|relation" mode="write-setters">
4141N/A <xsl:param name="cls"/>
4141N/A <xsl:variable name="type" select="@type"/>
4141N/A <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
4141N/A <xsl:value-of select="concat(' void set_', @field, '(', $wt, ' value) { this->_', @field, ' = value; }')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="structvalue" mode="write-setters">
4141N/A <xsl:param name="cls"/>
4141N/A <xsl:value-of select="concat(' void set_', @field, '(const TraceStruct', @type, '&amp; value) { this->_', @field, ' = value; }')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="value" mode="write-data">
4141N/A <xsl:variable name="type" select="@type"/>
4141N/A <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@writetype"/>
4141N/A <xsl:value-of select="concat(' ts.print_val(&quot;', @label, '&quot;, _', @field, ');')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A ts.print(", ");
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A<xsl:template match="structvalue" mode="write-data">
4141N/A <xsl:value-of select="concat(' _', @field, '.writeStruct(ts);')"/>
4141N/A <xsl:if test="position() != last()">
4141N/A <xsl:text>
4141N/A ts.print(", ");
4141N/A</xsl:text>
4141N/A </xsl:if>
4141N/A</xsl:template>
4141N/A
4141N/A</xsl:stylesheet>