1 <?xml version="1.0" encoding="utf-8"?>
   2 <!--
   3  Copyright (c) 2012, 2016, 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="STRING" 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="U8" builtin_type="THREAD">
  64       <value type="STRING" field="osName" label="OS Thread Name"/>
  65       <value type="LONG" field="osThreadId" label="OS Thread Id"/>
  66       <value type="STRING" field="javaName" label="Java Thread Name"/>
  67       <value type="LONG" field="javaThreadId" label="Java Thread Id"/>
  68       <value type="THREADGROUP" field="group" label="Java Thread Group"/>
  69     </content_type>
  70 
  71     <content_type id="ThreadGroup" hr_name="Thread Group"
  72                   type="U8" jvm_type="THREADGROUP">
  73       <value type="THREADGROUP" field="parent" label="Parent"/>
  74       <value type="STRING" field="name" label="Name"/>
  75     </content_type>
  76 
  77     <content_type id="Class" hr_name="Java Class"
  78                   type="U8" builtin_type="CLASS">
  79       <value type="CLASSLOADER" field="classLoader" label="Class Loader"/>
  80       <value type="SYMBOL" field="name" label="Name"/>
  81       <value type="PACKAGE" field="package" label="Package"/>
  82       <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
  83     </content_type>
  84 
  85     <content_type id="ClassLoader" hr_name="Java Class Loader"
  86                   type="U8" jvm_type="CLASSLOADER">
  87       <value type="CLASS" field="type" label="Type"/>
  88       <value type="SYMBOL" field="name" label="Name"/>
  89     </content_type>
  90 
  91     <content_type id="Method" hr_name="Java Method"
  92                   type="U8" jvm_type="METHOD">
  93       <value type="CLASS" field="type" label="Type"/>
  94       <value type="SYMBOL" field="name" label="Name"/>
  95       <value type="SYMBOL" field="descriptor" label="Descriptor"/>
  96       <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
  97       <value type="BOOLEAN" field="hidden" label="Hidden"/>
  98     </content_type>
  99 
 100     <content_type id="Symbol" hr_name="Symbol"
 101                   type="U8" jvm_type="SYMBOL">
 102       <value type="STRING" field="string" label="String"/>
 103     </content_type>
 104 
 105     <content_type id="ThreadState" hr_name="Java Thread State"
 106                   type="U8" jvm_type="THREADSTATE">
 107       <value type="STRING" field="name" label="Name"/>
 108     </content_type>
 109 
 110     <content_type id="GCName" hr_name="GC Name"
 111                   type="U8" jvm_type="GCNAME">
 112       <value type="STRING" field="name" label="Name" />
 113     </content_type>
 114 
 115     <content_type id="GCCause" hr_name="GC Cause"
 116                   type="U8" jvm_type="GCCAUSE">
 117       <value type="STRING" field="cause" label="Cause" />
 118     </content_type>
 119 
 120     <content_type id="GCWhen" hr_name="GC When"
 121                   type="U8" jvm_type="GCWHEN">
 122       <value type="STRING" field="when" label="When" />
 123     </content_type>
 124 
 125     <content_type id="G1HeapRegionType" hr_name="G1 Heap Region Type"
 126                   type="U8" jvm_type="G1HEAPREGIONTYPE">
 127       <value type="STRING" field="type" label="Type" />
 128     </content_type>
 129     
 130     <content_type id="G1YCType" hr_name="G1 YC Type"
 131                   type="U8" jvm_type="G1YCTYPE">
 132       <value type="STRING" field="type" label="Type" />
 133     </content_type>
 134 
 135     <content_type id="GCThresholdUpdater" hr_name="GC Threshold Updater"
 136                   type="U8" jvm_type="GCTHRESHOLDUPDATER">
 137       <value type="STRING" field="updater" label="Updater" />
 138     </content_type>
 139 
 140     <content_type id="ReferenceType" hr_name="Reference Type"
 141                   type="U8" jvm_type="REFERENCETYPE">
 142       <value type="STRING" field="type" label="Type" />
 143     </content_type>
 144 
 145     <content_type id="MetadataType" hr_name="Metadata Type"
 146                   type="U8" jvm_type="METADATATYPE">
 147       <value type="STRING" field="type" label="Type" />
 148     </content_type>
 149 
 150     <content_type id="MetaspaceObjectType" hr_name="Metaspace Object Type"
 151                   type="U8" jvm_type="METASPACEOBJTYPE">
 152       <value type="STRING" field="type" label="Type" />
 153     </content_type>
 154 
 155     <content_type id="NarrowOopMode" hr_name="Narrow Oop Mode"
 156                   type="U8" jvm_type="NARROWOOPMODE">
 157       <value type="STRING" field="mode" label="Mode" />
 158     </content_type>
 159 
 160     <content_type id="VMOperationType" hr_name="VM Operation Type"
 161                   type="U8" jvm_type="VMOPERATIONTYPE">
 162       <value type="STRING" field="type" label="Type" />
 163     </content_type>
 164 
 165     <content_type id="CompilerPhaseType" hr_name="Compiler Phase Type"
 166                   type="U8" jvm_type="COMPILERPHASETYPE">
 167       <value type="STRING" field="phase" label="Phase" />
 168     </content_type>
 169 
 170     <content_type id="FlagValueOrigin" hr_name="Flag Value Origin"
 171                   type="U8" jvm_type="FLAGVALUEORIGIN">
 172       <value type="STRING" field="origin" label="Origin" />
 173     </content_type>
 174 
 175     <content_type id="CodeBlobType" hr_name="Code Blob Type"
 176                   type="U8" jvm_type="CODEBLOBTYPE">
 177       <value type="STRING" field="type" label="Type" />
 178     </content_type>
 179 
 180     <content_type id="InflateCause" hr_name="Inflation Cause"
 181                   type="U8" jvm_type="INFLATECAUSE">
 182       <value type="STRING" field="cause" label="Cause" />
 183     </content_type>
 184 
 185     <content_type id="Module" hr_name="Module"
 186                   type="U8" jvm_type="MODULE">
 187       <value type="SYMBOL" field="name" label="Name"/>
 188       <value type="SYMBOL" field="version" label="Version"/>
 189       <value type="SYMBOL" field="location" label="Location"/>
 190       <value type="CLASSLOADER" field="classLoader" label="Class Loader"/>
 191     </content_type>
 192 
 193     <content_type id="Package" hr_name="Package"
 194                   type="U8" jvm_type="PACKAGE">
 195       <value type="SYMBOL" field="name" label="Name"/>
 196       <value type="MODULE" field="module" label="Module"/>
 197       <value type="BOOLEAN" field="exported" label="Exported"/>
 198     </content_type>
 199   </content_types>
 200 
 201 
 202   <primary_types>
 203     <!--
 204       - primary_type takes these attributes:
 205       -   symbol      INTEGER, LONG etc
 206       -   datatype    The trace datatype, see enum DataType
 207       -   contenttype Either resolved content type or the semantic meaning
 208       -   type        The actual type as used in structures etc
 209       -   sizeop      A function/macro that can be applied on a single
 210       -               struct value of type "type" and yield the factual byte
 211       -               size we need to write.  The % is replaced by the value
 212       -->
 213 
 214     <!-- SIGNED 64bit -->
 215     <primary_type symbol="LONG" datatype="LONG" contenttype="NONE"
 216                   type="s8" sizeop="sizeof(s8)"/>
 217 
 218     <!-- UNSIGNED 64bit -->
 219     <primary_type symbol="ULONG" datatype="U8" contenttype="NONE"
 220                   type="u8" sizeop="sizeof(u8)"/>
 221 
 222     <!-- SIGNED 32bit -->
 223     <primary_type symbol="INTEGER" datatype="INT" contenttype="NONE"
 224                   type="s4" sizeop="sizeof(s4)"/>
 225 
 226     <!-- UNSIGNED 32bit -->
 227     <primary_type symbol="UINT" datatype="U4" contenttype="NONE"
 228                   type="unsigned" sizeop="sizeof(unsigned)"/>
 229 
 230     <!-- UNSIGNED 16bit -->
 231     <primary_type symbol="USHORT" datatype="U2" contenttype="NONE"
 232                   type="u2" sizeop="sizeof(u2)"/>
 233 
 234     <!--  SIGNED 16bit -->
 235     <primary_type symbol="SHORT" datatype="SHORT" contenttype="NONE"
 236                   type="s2" sizeop="sizeof(s2)"/>
 237 
 238     <!--  SIGNED 8bit -->
 239     <primary_type symbol="BYTE" datatype="BYTE" contenttype="NONE"
 240                   type="s1" sizeop="sizeof(s1)"/>
 241 
 242     <!--  UNSIGNED 8bit -->
 243     <primary_type symbol="UBYTE" datatype="U1" contenttype="NONE"
 244                   type="u1" sizeop="sizeof(u1)"/>
 245 
 246     <!--  float 32bit -->
 247     <primary_type symbol="FLOAT" datatype="FLOAT" contenttype="NONE"
 248                   type="float" sizeop="sizeof(float)"/>
 249 
 250     <!--  float 64bit -->
 251     <primary_type symbol="DOUBLE" datatype="DOUBLE" contenttype="NONE"
 252                   type="double" sizeop="sizeof(double)"/>
 253 
 254     <!-- boolean type (1-byte) -->
 255     <primary_type symbol="BOOLEAN" datatype="BOOLEAN" contenttype="NONE"
 256                   type="bool" sizeop="1"/>
 257 
 258     <!-- 32-bit unsigned integer, SEMANTIC value BYTES -->
 259     <primary_type symbol="BYTES" datatype="U8" contenttype="BYTES"
 260                   type="u8" sizeop="sizeof(u8)"/>
 261 
 262     <primary_type symbol="IOBYTES" datatype="U8" contenttype="BYTES"
 263                   type="u8" sizeop="sizeof(u8)"/>
 264 
 265     <!-- 64-bit unsigned integer, SEMANTIC value BYTES -->
 266     <primary_type symbol="BYTES64" datatype="U8" contenttype="BYTES"
 267                   type="u8" sizeop="sizeof(u8)"/>
 268 
 269     <!-- 64-bit unsigned integer, SEMANTIC value ABSOLUTE MILLISECONDS -->
 270     <primary_type symbol="EPOCHMILLIS" datatype="LONG" contenttype="EPOCHMILLIS"
 271                   type="s8" sizeop="sizeof(s8)"/>
 272 
 273     <!-- 64-bit unsigned integer, SEMANTIC value RELATIVE MILLISECONDS -->
 274     <primary_type symbol="MILLIS" datatype="LONG" contenttype="MILLIS"
 275                   type="s8" sizeop="sizeof(s8)"/>
 276 
 277     <!-- 64-bit unsigned integer, SEMANTIC value RELATIVE NANOSECONDS -->
 278     <primary_type symbol="NANOS" datatype="LONG" contenttype="NANOS"
 279                   type="s8" sizeop="sizeof(s8)"/>
 280 
 281     <!-- 64-bit signed integer, SEMANTIC value TICKS -->
 282     <primary_type symbol="TICKS" datatype="LONG" contenttype="TICKS"
 283                   type="Ticks" sizeop="sizeof(s8)"/>
 284 
 285     <!-- 64-bit signed integer, SEMANTIC value TICKS duration -->
 286     <primary_type symbol="TICKSPAN" datatype="LONG" contenttype="TICKS"
 287                   type="Tickspan" sizeop="sizeof(s8)"/>
 288 
 289     <!-- 64-bit unsigned integer, SEMANTIC value ADDRESS (mem loc) -->
 290     <primary_type symbol="ADDRESS" datatype="U8" contenttype="ADDRESS"
 291                   type="u8" sizeop="sizeof(u8)"/>
 292 
 293     <!-- 32-bit float, SEMANTIC value PERCENTAGE (0.0-1.0) -->
 294     <primary_type symbol="PERCENTAGE" datatype="FLOAT" contenttype="PERCENTAGE"
 295                   type="float" sizeop="sizeof(float)"/>
 296 
 297     <!-- STRING is a virtual type - depending on encoding
 298          it will have polymorphic content -->
 299     <primary_type symbol="STRING" datatype="STRING" contenttype="NONE"
 300                   type="const char*" sizeop="sizeof_utf(%)"/>
 301 
 302     <!-- Symbol* constant. Note that this may currently ONLY be used by
 303           classes, methods fields.  This restriction might be lifted. -->
 304     <primary_type symbol="SYMBOL" datatype="U8" contenttype="SYMBOL"
 305                   type="const Symbol*" sizeop="sizeof(u8)"/>
 306 
 307     <!-- A Klass *. The actual class is marked as "used" and will
 308          eventually be written into the recording constant pool -->
 309     <primary_type symbol="CLASS" datatype="U8" contenttype="CLASS"
 310                   type="const Klass*" sizeop="sizeof(u8)"/>
 311 
 312     <primary_type symbol="CLASSLOADER" datatype="U8" contenttype="CLASSLOADER"
 313               type="const ClassLoaderData*" sizeop="sizeof(u8)"/>
 314 
 315     <primary_type symbol="MODULE" datatype="U8" contenttype="MODULE"
 316                   type="const ModuleEntry*" sizeop="sizeof(u8)"/>
 317 
 318     <primary_type symbol="PACKAGE" datatype="U8" contenttype="PACKAGE"
 319                   type="const PackageEntry*" sizeop="sizeof(u8)"/>
 320 
 321     <!-- A Method *. The method is marked as "used" and will eventually be
 322          written into the recording constant pool. -->
 323     <primary_type symbol="METHOD" datatype="U8" contenttype="METHOD"
 324                   type="const Method*" sizeop="sizeof(u8)"/>
 325 
 326     <!--  The type for stacktraces in the recording. Shoudl not be used by
 327           events explicitly -->
 328     <primary_type symbol="STACKTRACE" datatype="U8" contenttype="STACKTRACE"
 329                   type="u8" sizeop="sizeof(u8)"/>
 330 
 331     <!-- Thread ID -->
 332     <primary_type symbol="THREAD" datatype="U8" contenttype="THREAD"
 333                   type="u8" sizeop="sizeof(u8)"/>
 334 
 335     <!-- Threadgroup THIS TYPE MAY NOT BE USED IN NORMAL EVENTS (ATM). Only
 336           for thread constant pool // KK TODO: u8 should be ObjectP -->
 337     <primary_type symbol="THREADGROUP" datatype="U8" contenttype="THREADGROUP"
 338                   type="u8" sizeop="sizeof(u8)"/>
 339 
 340     <!-- FRAMETYPE enum -->
 341     <primary_type symbol="FRAMETYPE" datatype="U8" contenttype="FRAMETYPE"
 342                   type="u8" sizeop="sizeof(u8)"/>
 343 
 344     <!-- THREADSTATE enum -->
 345     <primary_type symbol="THREADSTATE" datatype="U8" contenttype="THREADSTATE"
 346                   type="u8" sizeop="sizeof(u8)"/>
 347 
 348     <!-- GCName -->
 349     <primary_type symbol="GCNAME" datatype="U8" contenttype="GCNAME"
 350                   type="u8" sizeop="sizeof(u8)" />
 351 
 352     <!-- GCCAUSE -->
 353     <primary_type symbol="GCCAUSE" datatype="U8" contenttype="GCCAUSE"
 354                   type="u8" sizeop="sizeof(u8)" />
 355 
 356     <!-- GCWHEN -->
 357     <primary_type symbol="GCWHEN" datatype="U8" contenttype="GCWHEN"
 358                   type="u8" sizeop="sizeof(u8)" />
 359 
 360     <!-- G1HEAPREGIONTYPE -->
 361     <primary_type symbol="G1HEAPREGIONTYPE" datatype="U8" contenttype="G1HEAPREGIONTYPE"
 362                   type="u8" sizeop="sizeof(u8)" />
 363 
 364     <!-- G1YCType -->
 365     <primary_type symbol="G1YCTYPE" datatype="U8" contenttype="G1YCTYPE"
 366                   type="u8" sizeop="sizeof(u8)" />
 367 
 368     <!-- GCTHRESHOLDUPDATER -->
 369     <primary_type symbol="GCTHRESHOLDUPDATER" datatype="U8" contenttype="GCTHRESHOLDUPDATER"
 370                   type="u8" sizeop="sizeof(u8)" />
 371 
 372     <!-- REFERENCETYPE -->
 373     <primary_type symbol="REFERENCETYPE" datatype="U8" contenttype="REFERENCETYPE"
 374                   type="u8" sizeop="sizeof(u8)" />
 375 
 376     <!-- METADATATYPE -->
 377     <primary_type symbol="METADATATYPE" datatype="U8" contenttype="METADATATYPE"
 378                   type="u8" sizeop="sizeof(u8)" />
 379 
 380     <!-- METADATAOBJTYPE -->
 381     <primary_type symbol="METASPACEOBJTYPE" datatype="U8" contenttype="METASPACEOBJTYPE"
 382                   type="u8" sizeop="sizeof(u8)" />
 383 
 384     <!-- NARROWOOPMODE -->
 385     <primary_type symbol="NARROWOOPMODE" datatype="U8" contenttype="NARROWOOPMODE"
 386                   type="u8" sizeop="sizeof(u8)" />
 387 
 388     <!-- COMPILERPHASETYPE -->
 389     <primary_type symbol="COMPILERPHASETYPE" datatype="U8" contenttype="COMPILERPHASETYPE"
 390                   type="u8" sizeop="sizeof(u8)" />
 391 
 392     <!-- VMOPERATIONTYPE -->
 393     <primary_type symbol="VMOPERATIONTYPE" datatype="U8" contenttype="VMOPERATIONTYPE"
 394                   type="u8" sizeop="sizeof(u8)" />
 395                   
 396     <!-- FLAGVALUEORIGIN -->
 397     <primary_type symbol="FLAGVALUEORIGIN" datatype="U8" contenttype="FLAGVALUEORIGIN"
 398                   type="u8" sizeop="sizeof(u8)" />
 399                   
 400     <!-- CODEBLOBTYPE -->
 401     <primary_type symbol="CODEBLOBTYPE" datatype="U8" contenttype="CODEBLOBTYPE"
 402                   type="u8" sizeop="sizeof(u8)" />
 403 
 404     <!-- INFLATECAUSE -->
 405     <primary_type symbol="INFLATECAUSE" datatype="U8" contenttype="INFLATECAUSE"
 406                   type="u8" sizeop="sizeof(u8)" />
 407   </primary_types>
 408 </types>