1 <?xml version="1.0" encoding="utf-8"?>
   2 <!--
   3  Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 
   6  This code is free software; you can redistribute it and/or modify it
   7  under the terms of the GNU General Public License version 2 only, as
   8  published by the Free Software Foundation.
   9 
  10  This code is distributed in the hope that it will be useful, but WITHOUT
  11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  version 2 for more details (a copy is included in the LICENSE file that
  14  accompanied this code).
  15 
  16  You should have received a copy of the GNU General Public License version
  17  2 along with this work; if not, write to the Free Software Foundation,
  18  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 
  20  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  or visit www.oracle.com if you need additional information or have any
  22  questions.
  23 -->
  24 
  25 <!DOCTYPE types SYSTEM "trace.dtd">
  26 
  27 <!--
  28 
  29 Content types (complex) should create constant pool data
  30 in the recording.
  31 Currently at least, there is _NO_ verification that whatever
  32 writer you have is actually writing correctly. So BE CAREFUL!
  33 
  34 Declared with the 'content_type' tag.
  35 
  36 <type> is the ID type, i.e the integer type that resolves this. Most often
  37 U4 or U8, but for example really small number constants, like GCTYPE uses U1.
  38 
  39 <content-type> is where it gets interesting. 'builtin_type' means we're
  40 defining how we resolve one of the trace built-in types (Class, Thread etc),
  41 jvm_type means defining a new one for our own use.
  42 
  43 Example: (GcMode)
  44 
  45 <content_type id="GCMode" hr_name="GC mode" type="U1" jvm_type="GCMODE">
  46   <value type="UTF8" field="desc" description="Description"/>
  47 </content_type>
  48 
  49 This creates a content type CONTENT_TYPE_GCMODE
  50 The field type referencing it is u1 (U1), and the constant pool struct has one field, the name.
  51 
  52 Before we can use it we need also define a primary field data type:
  53 
  54 <primary_type symbol="GCMODE" datatype="U1" contenttype="NONE"
  55               type="u8" sizeop="sizeof(u1)"/>
  56 
  57 Now we can use the content + data type in declaring event fields.
  58  -->
  59 
  60  <types>
  61   <content_types>
  62     <content_type id="Thread" hr_name="Thread"
  63                   type="U4" builtin_type="OSTHREAD">
  64       <value type="UTF8" field="name" label="Thread name"/>
  65     </content_type>
  66 
  67     <content_type id="VMThread" hr_name="VM Thread"
  68                   type="U8" jvm_type="VMTHREAD">
  69       <value type="OSTHREAD" field="thread" label="VM Thread"/>
  70     </content_type>
  71 
  72     <content_type id="JavaThread" hr_name="Java thread"
  73                   type="U8" builtin_type="JAVALANGTHREAD">
  74       <value type="OSTHREAD" field="thread" label="OS Thread ID"/>
  75       <value type="BYTES64" field="allocInsideTla"
  76              label="Allocated bytes inside TLAs"/>
  77       <value type="BYTES64" field="allocOutsideTla"
  78              label="Allocated bytes outside TLAs"/>
  79       <value type="THREADGROUP" field="group" label="Java Thread Group"/>
  80     </content_type>
  81 
  82     <content_type id="ThreadGroup" hr_name="Thread group"
  83                   type="U4" jvm_type="THREADGROUP">
  84       <value type="THREADGROUP" field="parent" label="Parent"/>
  85       <value type="UTF8" field="name" label="Name"/>
  86     </content_type>
  87 
  88     <content_type id="StackTrace" hr_name="Stacktrace"
  89                   type="U8" builtin_type="STACKTRACE">
  90       <value type="BOOLEAN" field="truncated" label="Truncated"/>
  91       <structarray type="StackFrame" field="frames" label="Stack frames"/>
  92     </content_type>
  93 
  94     <content_type id="Class" hr_name="Java class"
  95                   type="U8" builtin_type="CLASS">
  96       <value type="CLASS" field="loaderClass" label="ClassLoader"/>
  97       <value type="SYMBOL" field="name" label="Name"/>
  98       <value type="SHORT" field="modifiers" label="Access modifiers"/>
  99     </content_type>
 100 
 101     <content_type id="Method" hr_name="Java method"
 102                   type="U8" jvm_type="METHOD">
 103       <value type="CLASS" field="class" label="Class"/>
 104       <value type="SYMBOL" field="name" label="Name"/>
 105       <value type="SYMBOL" field="signature" label="Signature"/>
 106       <value type="SHORT" field="modifiers" label="Access modifiers"/>
 107     </content_type>
 108 
 109     <content_type id="UTFConstant" hr_name="UTF constant"
 110                   type="U8" jvm_type="SYMBOL">
 111       <value type="UTF8" field="utf8" label="UTF8 data"/>
 112     </content_type>
 113 
 114     <content_type id="ThreadState" hr_name="Java Thread State"
 115                   type="U2" jvm_type="THREADSTATE">
 116       <value type="UTF8" field="name" label="Name"/>
 117     </content_type>
 118 
 119     <content_type id="FrameType" hr_name="Frame type"
 120                   type="U1" jvm_type="FRAMETYPE">
 121       <value type="UTF8" field="desc" label="Description"/>
 122     </content_type>
 123 
 124     <struct_type id="StackFrame">
 125       <value type="METHOD" field="method" label="Java Method"/>
 126       <value type="INTEGER" field="line" label="Line number"/>
 127       <value type="FRAMETYPE" field="type" label="Frame type"/>
 128     </struct_type>
 129 
 130     <content_type id="GCName" hr_name="GC Name"
 131                   type="U1" jvm_type="GCNAME">
 132       <value type="UTF8" field="name" label="name" />
 133     </content_type>
 134 
 135     <content_type id="GCCause" hr_name="GC Cause"
 136                   type="U2" jvm_type="GCCAUSE">
 137       <value type="UTF8" field="cause" label="cause" />
 138     </content_type>
 139 
 140     <content_type id="GCWhen" hr_name="GC When"
 141                   type="U1" jvm_type="GCWHEN">
 142       <value type="UTF8" field="when" label="when" />
 143     </content_type>
 144 
 145     <content_type id="G1YCType" hr_name="G1 YC Type"
 146                   type="U1" jvm_type="G1YCTYPE">
 147       <value type="UTF8" field="type" label="type" />
 148     </content_type>
 149 
 150     <content_type id="ReferenceType" hr_name="Reference Type"
 151                   type="U1" jvm_type="REFERENCETYPE">
 152       <value type="UTF8" field="type" label="type" />
 153     </content_type>
 154 
 155     <content_type id="NARROW_OOP_MODE" hr_name="Narrow Oop Mode"
 156                   type="U1" jvm_type="NARROWOOPMODE">
 157       <value type="UTF8" field="mode" label="mode" />
 158     </content_type>
 159 
 160     <content_type id="VMOperationType" hr_name="VM Operation Type"
 161                   type="U2" jvm_type="VMOPERATIONTYPE">
 162       <value type="UTF8" field="type" label="type" />
 163     </content_type>
 164 
 165     <content_type id="CompilerPhaseType" hr_name="Compiler Phase Type"
 166                   type="U1" jvm_type="COMPILERPHASETYPE">
 167       <value type="UTF8" field="phase" label="phase" />
 168     </content_type>
 169 
 170   </content_types>
 171 
 172 
 173   <primary_types>
 174     <!--
 175       - primary_type takes these attributes:
 176       -   symbol      INTEGER, LONG etc
 177       -   datatype    The trace datatype, see enum DataType
 178       -   contenttype Either resolved content type or the semantic meaning
 179       -   type        The actual type as used in structures etc
 180       -   sizeop      A function/macro that can be applied on a single
 181       -               struct value of type "type" and yield the factual byte
 182       -               size we need to write.  The % is replaced by the value
 183       -->
 184 
 185     <!-- SIGNED 64bit -->
 186     <primary_type symbol="LONG" datatype="LONG" contenttype="NONE"
 187                   type="s8" sizeop="sizeof(s8)"/>
 188 
 189     <!-- UNSIGNED 64bit -->
 190     <primary_type symbol="ULONG" datatype="U8" contenttype="NONE"
 191                   type="u8" sizeop="sizeof(u8)"/>
 192 
 193     <!-- SIGNED 32bit -->
 194     <primary_type symbol="INTEGER" datatype="INT" contenttype="NONE"
 195                   type="s4" sizeop="sizeof(s4)"/>
 196 
 197     <!-- UNSIGNED 32bit -->
 198     <primary_type symbol="UINT" datatype="U4" contenttype="NONE"
 199                   type="unsigned" sizeop="sizeof(unsigned)"/>
 200 
 201     <!-- UNSIGNED 16bit -->
 202     <primary_type symbol="USHORT" datatype="U2" contenttype="NONE"
 203                   type="u2" sizeop="sizeof(u2)"/>
 204 
 205     <!--  SIGNED 16bit -->
 206     <primary_type symbol="SHORT" datatype="SHORT" contenttype="NONE"
 207                   type="s2" sizeop="sizeof(s2)"/>
 208 
 209     <!--  SIGNED 8bit -->
 210     <primary_type symbol="BYTE" datatype="BYTE" contenttype="NONE"
 211                   type="s1" sizeop="sizeof(s1)"/>
 212 
 213     <!--  UNSIGNED 8bit -->
 214     <primary_type symbol="UBYTE" datatype="U1" contenttype="NONE"
 215                   type="u1" sizeop="sizeof(u1)"/>
 216 
 217     <!--  float 32bit -->
 218     <primary_type symbol="FLOAT" datatype="FLOAT" contenttype="NONE"
 219                   type="float" sizeop="sizeof(float)"/>
 220 
 221     <!--  float 64bit -->
 222     <primary_type symbol="DOUBLE" datatype="DOUBLE" contenttype="NONE"
 223                   type="double" sizeop="sizeof(double)"/>
 224 
 225     <!-- boolean type (1-byte) -->
 226     <primary_type symbol="BOOLEAN" datatype="BOOLEAN" contenttype="NONE"
 227                   type="bool" sizeop="1"/>
 228 
 229     <!-- 32-bit unsigned integer, SEMANTIC value BYTES -->
 230     <primary_type symbol="BYTES" datatype="U4" contenttype="BYTES"
 231                   type="u4" sizeop="sizeof(u4)"/>
 232 
 233     <primary_type symbol="IOBYTES" datatype="U4" contenttype="BYTES"
 234                   type="u4" sizeop="sizeof(u4)"/>
 235 
 236     <!-- 64-bit unsigned integer, SEMANTIC value BYTES -->
 237     <primary_type symbol="BYTES64" datatype="U8" contenttype="BYTES"
 238                   type="u8" sizeop="sizeof(u8)"/>
 239 
 240     <!-- 64-bit unsigned integer, SEMANTIC value ABSOLUTE MILLISECONDS -->
 241     <primary_type symbol="EPOCHMILLIS" datatype="LONG" contenttype="EPOCHMILLIS"
 242                   type="s8" sizeop="sizeof(s8)"/>
 243 
 244     <!-- 64-bit unsigned integer, SEMANTIC value RELATIVE MILLISECONDS -->
 245     <primary_type symbol="MILLIS" datatype="LONG" contenttype="MILLIS"
 246                   type="s8" sizeop="sizeof(s8)"/>
 247 
 248     <!-- 64-bit unsigned integer, SEMANTIC value RELATIVE NANOSECONDS -->
 249     <primary_type symbol="NANOS" datatype="LONG" contenttype="NANOS"
 250                   type="s8" sizeop="sizeof(s8)"/>
 251 
 252     <!-- 64-bit signed integer, SEMANTIC value ABSOLUTE TICKS -->
 253     <primary_type symbol="TICKS" datatype="LONG" contenttype="TICKS"
 254                   type="s8" sizeop="sizeof(s8)"/>
 255 
 256     <!-- 64-bit signed integer, SEMANTIC value RELATIVE TICKS -->
 257     <primary_type symbol="RELATIVE_TICKS" datatype="LONG" contenttype="TICKS"
 258                   type="s8" sizeop="sizeof(s8)"/>
 259 
 260     <!-- 64-bit unsigned integer, SEMANTIC value ADDRESS (mem loc) -->
 261     <primary_type symbol="ADDRESS" datatype="U8" contenttype="ADDRESS"
 262                   type="u8" sizeop="sizeof(u8)"/>
 263 
 264     <!-- 32-bit float, SEMANTIC value PERCENTAGE (0.0-1.0) -->
 265     <primary_type symbol="PERCENT" datatype="FLOAT" contenttype="PERCENTAGE"
 266                   type="float" sizeop="sizeof(float)"/>
 267 
 268     <!-- UTF-encoded string, max length 64k -->
 269     <primary_type symbol="UTF8" datatype="UTF8" contenttype="NONE"
 270                   type="const char *" sizeop="sizeof_utf(%)"/>
 271 
 272     <!-- UTF-16 encoded (Unicode) string, max length maxjuint -->
 273     <primary_type symbol="STRING" datatype="STRING" contenttype="NONE"
 274                   type="TraceUnicodeString*" sizeop="sizeof_unicode(%)"/>
 275 
 276     <!-- Symbol* constant. Note that this may currently ONLY be used by
 277           classes, methods fields.  This restriction might be lifted. -->
 278     <primary_type symbol="SYMBOL" datatype="U8" contenttype="SYMBOL"
 279                   type="Symbol *" sizeop="sizeof(u8)"/>
 280 
 281     <!-- A Klass *. The actual class is marked as "used" and will
 282          eventually be written into the recording constant pool -->
 283     <primary_type symbol="CLASS" datatype="U8" contenttype="CLASS"
 284                   type="Klass *" sizeop="sizeof(u8)"/>
 285 
 286     <!-- A Method *. The method is marked as "used" and will eventually be
 287          written into the recording constant pool. -->
 288     <primary_type symbol="METHOD" datatype="U8" contenttype="METHOD"
 289                   type="Method *" sizeop="sizeof(u8)"/>
 290 
 291     <!--  The type for stacktraces in the recording. Shoudl not be used by
 292           events explicitly -->
 293     <primary_type symbol="STACKTRACE" datatype="U8" contenttype="STACKTRACE"
 294                   type="u8" sizeop="sizeof(u8)"/>
 295 
 296     <!-- OS Thread ID -->
 297     <primary_type symbol="OSTHREAD" datatype="U4" contenttype="OSTHREAD"
 298                   type="u4" sizeop="sizeof(u4)"/>
 299 
 300     <!-- VM Thread ID Note: changed from U2 to U8 for hotspot -->
 301     <primary_type symbol="VMTHREAD" datatype="U8" contenttype="VMTHREAD"
 302                   type="u8"  sizeop="sizeof(u8)"/>
 303 
 304     <!-- Java Thread ID -->
 305     <primary_type symbol="JAVALANGTHREAD" datatype="LONG"
 306                   contenttype="JAVALANGTHREAD" type="s8"
 307                   sizeop="sizeof(s8)"/>
 308 
 309     <!-- Threadgroup THIS TYPE MAY NOT BE USED IN NORMAL EVENTS (ATM). Only
 310           for thread constant pool // KK TODO: u8 should be ObjectP -->
 311     <primary_type symbol="THREADGROUP" datatype="U4" contenttype="THREADGROUP"
 312                   type="u8"
 313                   sizeop="sizeof(u4)"/>
 314 
 315     <!-- FRAMETYPE enum -->
 316     <primary_type symbol="FRAMETYPE" datatype="U1" contenttype="FRAMETYPE"
 317                   type="u1" sizeop="sizeof(u1)"/>
 318 
 319     <!-- THREADSTATE enum -->
 320     <primary_type symbol="THREADSTATE" datatype="U2" contenttype="THREADSTATE"
 321                   type="u2" sizeop="sizeof(u2)"/>
 322 
 323     <!-- GCName -->
 324     <primary_type symbol="GCNAME" datatype="U1" contenttype="GCNAME"
 325                   type="u1" sizeop="sizeof(u1)" />
 326 
 327     <!-- GCCAUSE -->
 328     <primary_type symbol="GCCAUSE" datatype="U2" contenttype="GCCAUSE"
 329                   type="u2" sizeop="sizeof(u2)" />
 330 
 331     <!-- GCWHEN -->
 332     <primary_type symbol="GCWHEN" datatype="U1" contenttype="GCWHEN"
 333                   type="u1" sizeop="sizeof(u1)" />
 334 
 335     <!-- G1YCType -->
 336     <primary_type symbol="G1YCTYPE" datatype="U1" contenttype="G1YCTYPE"
 337                   type="u1" sizeop="sizeof(u1)" />
 338 
 339     <!-- REFERENCETYPE -->
 340     <primary_type symbol="REFERENCETYPE" datatype="U1"
 341                   contenttype="REFERENCETYPE" type="u1" sizeop="sizeof(u1)" />
 342 
 343     <!-- NARROWOOPMODE -->
 344     <primary_type symbol="NARROWOOPMODE" datatype="U1"
 345                   contenttype="NARROWOOPMODE" type="u1" sizeop="sizeof(u1)" />
 346 
 347     <!-- COMPILERPHASETYPE -->
 348     <primary_type symbol="COMPILERPHASETYPE" datatype="U1"
 349                   contenttype="COMPILERPHASETYPE" type="u1" sizeop="sizeof(u1)" />
 350 
 351     <!-- VMOPERATIONTYPE -->
 352     <primary_type symbol="VMOPERATIONTYPE" datatype="U2" contenttype="VMOPERATIONTYPE"
 353                   type="u2" sizeop="sizeof(u2)" />
 354 
 355   </primary_types>
 356 </types>