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="Class" hr_name="Java class"
  89                   type="U8" builtin_type="CLASS">
  90       <value type="CLASS" field="loaderClass" label="ClassLoader"/>
  91       <value type="SYMBOL" field="name" label="Name"/>
  92       <value type="SHORT" field="modifiers" label="Access modifiers"/>
  93     </content_type>
  94 
  95     <content_type id="Method" hr_name="Java method"
  96                   type="U8" jvm_type="METHOD">
  97       <value type="CLASS" field="class" label="Class"/>
  98       <value type="SYMBOL" field="name" label="Name"/>
  99       <value type="SYMBOL" field="signature" label="Signature"/>
 100       <value type="SHORT" field="modifiers" label="Access modifiers"/>
 101     </content_type>
 102 
 103     <content_type id="UTFConstant" hr_name="UTF constant"
 104                   type="U8" jvm_type="SYMBOL">
 105       <value type="UTF8" field="utf8" label="UTF8 data"/>
 106     </content_type>
 107 
 108     <content_type id="ThreadState" hr_name="Java Thread State"
 109                   type="U2" jvm_type="THREADSTATE">
 110       <value type="UTF8" field="name" label="Name"/>
 111     </content_type>
 112 
 113     <content_type id="GCName" hr_name="GC Name"
 114                   type="U1" jvm_type="GCNAME">
 115       <value type="UTF8" field="name" label="name" />
 116     </content_type>
 117 
 118     <content_type id="GCCause" hr_name="GC Cause"
 119                   type="U2" jvm_type="GCCAUSE">
 120       <value type="UTF8" field="cause" label="cause" />
 121     </content_type>
 122 
 123     <content_type id="GCWhen" hr_name="GC When"
 124                   type="U1" jvm_type="GCWHEN">
 125       <value type="UTF8" field="when" label="when" />
 126     </content_type>
 127 
 128     <content_type id="G1YCType" hr_name="G1 YC Type"
 129                   type="U1" jvm_type="G1YCTYPE">
 130       <value type="UTF8" field="type" label="type" />
 131     </content_type>
 132 
 133     <content_type id="GCThresholdUpdater" hr_name="GC Treshold Updater"
 134                   type="U1" jvm_type="GCTHRESHOLDUPDATER">
 135       <value type="UTF8" field="updater" label="updater" />
 136     </content_type>
 137 
 138     <content_type id="ReferenceType" hr_name="Reference Type"
 139                   type="U1" jvm_type="REFERENCETYPE">
 140       <value type="UTF8" field="type" label="type" />
 141     </content_type>
 142 
 143     <content_type id="MetadataType" hr_name="Metadata Type"
 144                   type="U1" jvm_type="METADATATYPE">
 145       <value type="UTF8" field="type" label="type" />
 146     </content_type>
 147 
 148     <content_type id="MetaspaceObjectType" hr_name="Metaspace Object Type"
 149                   type="U1" jvm_type="METASPACEOBJTYPE">
 150       <value type="UTF8" field="type" label="type" />
 151     </content_type>
 152 
 153     <content_type id="NARROW_OOP_MODE" hr_name="Narrow Oop Mode"
 154                   type="U1" jvm_type="NARROWOOPMODE">
 155       <value type="UTF8" field="mode" label="mode" />
 156     </content_type>
 157 
 158     <content_type id="VMOperationType" hr_name="VM Operation Type"
 159                   type="U2" jvm_type="VMOPERATIONTYPE">
 160       <value type="UTF8" field="type" label="type" />
 161     </content_type>
 162 
 163     <content_type id="CompilerPhaseType" hr_name="Compiler Phase Type"
 164                   type="U1" jvm_type="COMPILERPHASETYPE">
 165       <value type="UTF8" field="phase" label="phase" />
 166     </content_type>
 167 
 168     <content_type id="FlagValueOrigin" hr_name="Flag Value Origin"
 169                   type="U1" jvm_type="FLAGVALUEORIGIN">
 170       <value type="UTF8" field="origin" label="origin" />
 171     </content_type>
 172 
 173   </content_types>
 174 
 175 
 176   <primary_types>
 177     <!--
 178       - primary_type takes these attributes:
 179       -   symbol      INTEGER, LONG etc
 180       -   datatype    The trace datatype, see enum DataType
 181       -   contenttype Either resolved content type or the semantic meaning
 182       -   type        The actual type as used in structures etc
 183       -   sizeop      A function/macro that can be applied on a single
 184       -               struct value of type "type" and yield the factual byte
 185       -               size we need to write.  The % is replaced by the value
 186       -->
 187 
 188     <!-- SIGNED 64bit -->
 189     <primary_type symbol="LONG" datatype="LONG" contenttype="NONE"
 190                   type="s8" sizeop="sizeof(s8)"/>
 191 
 192     <!-- UNSIGNED 64bit -->
 193     <primary_type symbol="ULONG" datatype="U8" contenttype="NONE"
 194                   type="u8" sizeop="sizeof(u8)"/>
 195 
 196     <!-- SIGNED 32bit -->
 197     <primary_type symbol="INTEGER" datatype="INT" contenttype="NONE"
 198                   type="s4" sizeop="sizeof(s4)"/>
 199 
 200     <!-- UNSIGNED 32bit -->
 201     <primary_type symbol="UINT" datatype="U4" contenttype="NONE"
 202                   type="unsigned" sizeop="sizeof(unsigned)"/>
 203 
 204     <!-- UNSIGNED 16bit -->
 205     <primary_type symbol="USHORT" datatype="U2" contenttype="NONE"
 206                   type="u2" sizeop="sizeof(u2)"/>
 207 
 208     <!--  SIGNED 16bit -->
 209     <primary_type symbol="SHORT" datatype="SHORT" contenttype="NONE"
 210                   type="s2" sizeop="sizeof(s2)"/>
 211 
 212     <!--  SIGNED 8bit -->
 213     <primary_type symbol="BYTE" datatype="BYTE" contenttype="NONE"
 214                   type="s1" sizeop="sizeof(s1)"/>
 215 
 216     <!--  UNSIGNED 8bit -->
 217     <primary_type symbol="UBYTE" datatype="U1" contenttype="NONE"
 218                   type="u1" sizeop="sizeof(u1)"/>
 219 
 220     <!--  float 32bit -->
 221     <primary_type symbol="FLOAT" datatype="FLOAT" contenttype="NONE"
 222                   type="float" sizeop="sizeof(float)"/>
 223 
 224     <!--  float 64bit -->
 225     <primary_type symbol="DOUBLE" datatype="DOUBLE" contenttype="NONE"
 226                   type="double" sizeop="sizeof(double)"/>
 227 
 228     <!-- boolean type (1-byte) -->
 229     <primary_type symbol="BOOLEAN" datatype="BOOLEAN" contenttype="NONE"
 230                   type="bool" sizeop="1"/>
 231 
 232     <!-- 32-bit unsigned integer, SEMANTIC value BYTES -->
 233     <primary_type symbol="BYTES" datatype="U4" contenttype="BYTES"
 234                   type="u4" sizeop="sizeof(u4)"/>
 235 
 236     <primary_type symbol="IOBYTES" datatype="U4" contenttype="BYTES"
 237                   type="u4" sizeop="sizeof(u4)"/>
 238 
 239     <!-- 64-bit unsigned integer, SEMANTIC value BYTES -->
 240     <primary_type symbol="BYTES64" datatype="U8" contenttype="BYTES"
 241                   type="u8" sizeop="sizeof(u8)"/>
 242 
 243     <!-- 64-bit unsigned integer, SEMANTIC value ABSOLUTE MILLISECONDS -->
 244     <primary_type symbol="EPOCHMILLIS" datatype="LONG" contenttype="EPOCHMILLIS"
 245                   type="s8" sizeop="sizeof(s8)"/>
 246 
 247     <!-- 64-bit unsigned integer, SEMANTIC value RELATIVE MILLISECONDS -->
 248     <primary_type symbol="MILLIS" datatype="LONG" contenttype="MILLIS"
 249                   type="s8" sizeop="sizeof(s8)"/>
 250 
 251     <!-- 64-bit unsigned integer, SEMANTIC value RELATIVE NANOSECONDS -->
 252     <primary_type symbol="NANOS" datatype="LONG" contenttype="NANOS"
 253                   type="s8" sizeop="sizeof(s8)"/>
 254 
 255     <!-- 64-bit signed integer, SEMANTIC value TICKS -->
 256     <primary_type symbol="TICKS" datatype="LONG" contenttype="TICKS"
 257                   type="Ticks" sizeop="sizeof(s8)"/>
 258 
 259     <!-- 64-bit signed integer, SEMANTIC value TICKS duration -->
 260     <primary_type symbol="TICKSPAN" datatype="LONG" contenttype="TICKS"
 261                   type="Tickspan" sizeop="sizeof(s8)"/>
 262 
 263     <!-- 64-bit unsigned integer, SEMANTIC value ADDRESS (mem loc) -->
 264     <primary_type symbol="ADDRESS" datatype="U8" contenttype="ADDRESS"
 265                   type="u8" sizeop="sizeof(u8)"/>
 266 
 267     <!-- 32-bit float, SEMANTIC value PERCENTAGE (0.0-1.0) -->
 268     <primary_type symbol="PERCENT" datatype="FLOAT" contenttype="PERCENTAGE"
 269                   type="float" sizeop="sizeof(float)"/>
 270 
 271     <!-- UTF-encoded string, max length 64k -->
 272     <primary_type symbol="UTF8" datatype="UTF8" contenttype="NONE"
 273                   type="const char *" sizeop="sizeof_utf(%)"/>
 274 
 275     <!-- UTF-16 encoded (Unicode) string, max length maxjuint -->
 276     <primary_type symbol="STRING" datatype="STRING" contenttype="NONE"
 277                   type="TraceUnicodeString*" sizeop="sizeof_unicode(%)"/>
 278 
 279     <!-- Symbol* constant. Note that this may currently ONLY be used by
 280           classes, methods fields.  This restriction might be lifted. -->
 281     <primary_type symbol="SYMBOL" datatype="U8" contenttype="SYMBOL"
 282                   type="Symbol *" sizeop="sizeof(u8)"/>
 283 
 284     <!-- A Klass *. The actual class is marked as "used" and will
 285          eventually be written into the recording constant pool -->
 286     <primary_type symbol="CLASS" datatype="U8" contenttype="CLASS"
 287                   type="Klass *" sizeop="sizeof(u8)"/>
 288 
 289     <!-- A Method *. The method is marked as "used" and will eventually be
 290          written into the recording constant pool. -->
 291     <primary_type symbol="METHOD" datatype="U8" contenttype="METHOD"
 292                   type="Method *" sizeop="sizeof(u8)"/>
 293 
 294     <!--  The type for stacktraces in the recording. Shoudl not be used by
 295           events explicitly -->
 296     <primary_type symbol="STACKTRACE" datatype="U8" contenttype="STACKTRACE"
 297                   type="u8" sizeop="sizeof(u8)"/>
 298 
 299     <!-- OS Thread ID -->
 300     <primary_type symbol="OSTHREAD" datatype="U4" contenttype="OSTHREAD"
 301                   type="u4" sizeop="sizeof(u4)"/>
 302 
 303     <!-- VM Thread ID Note: changed from U2 to U8 for hotspot -->
 304     <primary_type symbol="VMTHREAD" datatype="U8" contenttype="VMTHREAD"
 305                   type="u8"  sizeop="sizeof(u8)"/>
 306 
 307     <!-- Java Thread ID -->
 308     <primary_type symbol="JAVALANGTHREAD" datatype="LONG"
 309                   contenttype="JAVALANGTHREAD" type="s8"
 310                   sizeop="sizeof(s8)"/>
 311 
 312     <!-- Threadgroup THIS TYPE MAY NOT BE USED IN NORMAL EVENTS (ATM). Only
 313           for thread constant pool // KK TODO: u8 should be ObjectP -->
 314     <primary_type symbol="THREADGROUP" datatype="U4" contenttype="THREADGROUP"
 315                   type="u8"
 316                   sizeop="sizeof(u4)"/>
 317 
 318     <!-- FRAMETYPE enum -->
 319     <primary_type symbol="FRAMETYPE" datatype="U1" contenttype="FRAMETYPE"
 320                   type="u1" sizeop="sizeof(u1)"/>
 321 
 322     <!-- THREADSTATE enum -->
 323     <primary_type symbol="THREADSTATE" datatype="U2" contenttype="THREADSTATE"
 324                   type="u2" sizeop="sizeof(u2)"/>
 325 
 326     <!-- GCName -->
 327     <primary_type symbol="GCNAME" datatype="U1" contenttype="GCNAME"
 328                   type="u1" sizeop="sizeof(u1)" />
 329 
 330     <!-- GCCAUSE -->
 331     <primary_type symbol="GCCAUSE" datatype="U2" contenttype="GCCAUSE"
 332                   type="u2" sizeop="sizeof(u2)" />
 333 
 334     <!-- GCWHEN -->
 335     <primary_type symbol="GCWHEN" datatype="U1" contenttype="GCWHEN"
 336                   type="u1" sizeop="sizeof(u1)" />
 337 
 338     <!-- G1YCType -->
 339     <primary_type symbol="G1YCTYPE" datatype="U1" contenttype="G1YCTYPE"
 340                   type="u1" sizeop="sizeof(u1)" />
 341 
 342     <!-- GCTHRESHOLDUPDATER -->
 343     <primary_type symbol="GCTHRESHOLDUPDATER" datatype="U1" contenttype="GCTHRESHOLDUPDATER"
 344                   type="u1" sizeop="sizeof(u1)" />
 345 
 346     <!-- REFERENCETYPE -->
 347     <primary_type symbol="REFERENCETYPE" datatype="U1"
 348                   contenttype="REFERENCETYPE" type="u1" sizeop="sizeof(u1)" />
 349 
 350     <!-- METADATATYPE -->
 351     <primary_type symbol="METADATATYPE" datatype="U1"
 352                   contenttype="METADATATYPE" type="u1" sizeop="sizeof(u1)" />
 353 
 354     <!-- METADATAOBJTYPE -->
 355     <primary_type symbol="METASPACEOBJTYPE" datatype="U1"
 356                   contenttype="METASPACEOBJTYPE" type="u1" sizeop="sizeof(u1)" />
 357 
 358     <!-- NARROWOOPMODE -->
 359     <primary_type symbol="NARROWOOPMODE" datatype="U1"
 360                   contenttype="NARROWOOPMODE" type="u1" sizeop="sizeof(u1)" />
 361 
 362     <!-- COMPILERPHASETYPE -->
 363     <primary_type symbol="COMPILERPHASETYPE" datatype="U1"
 364                   contenttype="COMPILERPHASETYPE" type="u1" sizeop="sizeof(u1)" />
 365 
 366     <!-- VMOPERATIONTYPE -->
 367     <primary_type symbol="VMOPERATIONTYPE" datatype="U2" contenttype="VMOPERATIONTYPE"
 368                   type="u2" sizeop="sizeof(u2)" />
 369                   
 370     <!-- FLAGVALUEORIGIN -->
 371     <primary_type symbol="FLAGVALUEORIGIN" datatype="U1"
 372                   contenttype="FLAGVALUEORIGIN" type="u1" sizeop="sizeof(u1)" />
 373 
 374   </primary_types>
 375 </types>