1 /*
   2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
   3  *
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * The contents of this file are subject to the terms of either the Universal Permissive License
   7  * v 1.0 as shown at http://oss.oracle.com/licenses/upl
   8  *
   9  * or the following license:
  10  *
  11  * Redistribution and use in source and binary forms, with or without modification, are permitted
  12  * provided that the following conditions are met:
  13  *
  14  * 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  15  * and the following disclaimer.
  16  *
  17  * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
  18  * conditions and the following disclaimer in the documentation and/or other materials provided with
  19  * the distribution.
  20  *
  21  * 3. Neither the name of the copyright holder nor the names of its contributors may be used to
  22  * endorse or promote products derived from this software without specific prior written permission.
  23  *
  24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  26  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
  31  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32  */
  33 package org.openjdk.jmc.flightrecorder.jdk;
  34 
  35 import static org.openjdk.jmc.common.item.Attribute.attr;
  36 import static org.openjdk.jmc.common.unit.UnitLookup.ADDRESS;
  37 import static org.openjdk.jmc.common.unit.UnitLookup.CLASS;
  38 import static org.openjdk.jmc.common.unit.UnitLookup.CLASS_LOADER;
  39 import static org.openjdk.jmc.common.unit.UnitLookup.FLAG;
  40 import static org.openjdk.jmc.common.unit.UnitLookup.LABELED_IDENTIFIER;
  41 import static org.openjdk.jmc.common.unit.UnitLookup.MEMORY;
  42 import static org.openjdk.jmc.common.unit.UnitLookup.METHOD;
  43 import static org.openjdk.jmc.common.unit.UnitLookup.NUMBER;
  44 import static org.openjdk.jmc.common.unit.UnitLookup.OLD_OBJECT;
  45 import static org.openjdk.jmc.common.unit.UnitLookup.PERCENTAGE;
  46 import static org.openjdk.jmc.common.unit.UnitLookup.PLAIN_TEXT;
  47 import static org.openjdk.jmc.common.unit.UnitLookup.THREAD;
  48 import static org.openjdk.jmc.common.unit.UnitLookup.TIMESPAN;
  49 import static org.openjdk.jmc.common.unit.UnitLookup.TIMESTAMP;
  50 import static org.openjdk.jmc.common.unit.UnitLookup.UNKNOWN;
  51 
  52 import java.util.List;
  53 
  54 import org.openjdk.jmc.common.IDisplayable;
  55 import org.openjdk.jmc.common.IMCClassLoader;
  56 import org.openjdk.jmc.common.IMCFrame;
  57 import org.openjdk.jmc.common.IMCMethod;
  58 import org.openjdk.jmc.common.IMCModule;
  59 import org.openjdk.jmc.common.IMCOldObject;
  60 import org.openjdk.jmc.common.IMCOldObjectGcRoot;
  61 import org.openjdk.jmc.common.IMCPackage;
  62 import org.openjdk.jmc.common.IMCStackTrace;
  63 import org.openjdk.jmc.common.IMCThread;
  64 import org.openjdk.jmc.common.IMCThreadGroup;
  65 import org.openjdk.jmc.common.IMCType;
  66 import org.openjdk.jmc.common.item.Attribute;
  67 import org.openjdk.jmc.common.item.IAttribute;
  68 import org.openjdk.jmc.common.item.IMemberAccessor;
  69 import org.openjdk.jmc.common.item.IType;
  70 import org.openjdk.jmc.common.unit.ContentType;
  71 import org.openjdk.jmc.common.unit.IQuantity;
  72 import org.openjdk.jmc.common.unit.UnitLookup;
  73 import org.openjdk.jmc.common.util.FormatToolkit;
  74 import org.openjdk.jmc.common.util.LabeledIdentifier;
  75 import org.openjdk.jmc.common.util.MCClassLoader;
  76 import org.openjdk.jmc.flightrecorder.JfrAttributes;
  77 import org.openjdk.jmc.flightrecorder.jdk.messages.internal.Messages;
  78 
  79 /**
  80  * Various attributes based on JDK flight recorder data.
  81  */
  82 public final class JdkAttributes {
  83 
  84         public static final IAttribute<String> EVENT_THREAD_NAME = Attribute
  85                         .canonicalize(new Attribute<String>("(thread).name", Messages.getString(Messages.ATTR_EVENT_THREAD_NAME), //$NON-NLS-1$
  86                                         Messages.getString(Messages.ATTR_EVENT_THREAD_NAME_DESC), PLAIN_TEXT) {
  87                                 @Override
  88                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
  89                                         final IMemberAccessor<IMCThread, U> accessor = JfrAttributes.EVENT_THREAD.getAccessor(type);
  90                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
  91                                                 @Override
  92                                                 public String getMember(U i) {
  93                                                         IMCThread thread = accessor.getMember(i);
  94                                                         return thread == null ? null : thread.getThreadName();
  95                                                 }
  96                                         };
  97                                 }
  98                         });
  99         public static final IAttribute<String> EVENT_THREAD_GROUP_NAME = Attribute.canonicalize(
 100                         new Attribute<String>("(thread).groupName", Messages.getString(Messages.ATTR_EVENT_THREAD_GROUP), //$NON-NLS-1$
 101                                         Messages.getString(Messages.ATTR_EVENT_THREAD_GROUP_DESC), PLAIN_TEXT) {
 102                                 @Override
 103                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 104                                         final IMemberAccessor<IMCThread, U> accessor = JfrAttributes.EVENT_THREAD.getAccessor(type);
 105                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 106                                                 @Override
 107                                                 public String getMember(U i) {
 108                                                         IMCThread thread = accessor.getMember(i);
 109                                                         if (thread != null) {
 110                                                                 IMCThreadGroup group = thread.getThreadGroup();
 111                                                                 if (group != null) {
 112                                                                         return group.getName();
 113                                                                 }
 114                                                         }
 115                                                         return null;
 116                                                 }
 117                                         };
 118                                 }
 119                         });
 120         public static final IAttribute<IQuantity> EVENT_THREAD_ID = Attribute.canonicalize(
 121                         new Attribute<IQuantity>("(thread).javaThreadId", Messages.getString(Messages.ATTR_EVENT_THREAD_ID), //$NON-NLS-1$
 122                                         Messages.getString(Messages.ATTR_EVENT_THREAD_ID_DESC), NUMBER) {
 123                                 @Override
 124                                 public <U> IMemberAccessor<IQuantity, U> customAccessor(IType<U> type) {
 125                                         final IMemberAccessor<IMCThread, U> accessor = JfrAttributes.EVENT_THREAD.getAccessor(type);
 126                                         return accessor == null ? null : new IMemberAccessor<IQuantity, U>() {
 127                                                 @Override
 128                                                 public IQuantity getMember(U i) {
 129                                                         IMCThread thread = accessor.getMember(i);
 130                                                         return (thread == null || thread.getThreadId() == null) ? null
 131                                                                         : UnitLookup.NUMBER_UNITY.quantity(thread.getThreadId());
 132                                                 }
 133                                         };
 134                                 }
 135                         });
 136 
 137         public static final IAttribute<String> STACK_TRACE_STRING = Attribute.canonicalize(
 138                         new Attribute<String>("(stackTrace).string", Messages.getString(Messages.ATTR_STACK_TRACE_STRING), //$NON-NLS-1$
 139                                         Messages.getString(Messages.ATTR_STACK_TRACE_STRING_DESC), UnitLookup.PLAIN_TEXT) {
 140                                 @Override
 141                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 142                                         final IMemberAccessor<IMCStackTrace, U> accessor = JfrAttributes.EVENT_STACKTRACE.getAccessor(type);
 143                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 144                                                 @Override
 145                                                 public String getMember(U i) {
 146                                                         IMCStackTrace trace = accessor.getMember(i);
 147                                                         // Using default formatting
 148                                                         return trace == null ? null : FormatToolkit.getHumanReadable(trace, "", "", null); //$NON-NLS-1$ //$NON-NLS-2$
 149                                                 }
 150                                         };
 151                                 }
 152                         });
 153 
 154         public static final IAttribute<IMCFrame> STACK_TRACE_TOP_FRAME = Attribute.canonicalize(
 155                         new Attribute<IMCFrame>("(stackTrace).topframe", Messages.getString(Messages.ATTR_STACK_TRACE_FRAME), //$NON-NLS-1$
 156                                         Messages.getString(Messages.ATTR_STACK_TRACE_FRAME_DESC), UnitLookup.STACKTRACE_FRAME) {
 157                                 @Override
 158                                 public <U> IMemberAccessor<IMCFrame, U> customAccessor(IType<U> type) {
 159                                         final IMemberAccessor<IMCStackTrace, U> accessor = JfrAttributes.EVENT_STACKTRACE.getAccessor(type);
 160                                         return accessor == null ? null : new IMemberAccessor<IMCFrame, U>() {
 161                                                 @Override
 162                                                 public IMCFrame getMember(U i) {
 163                                                         IMCStackTrace trace = accessor.getMember(i);
 164                                                         // FIXME: Fix train wreck to avoid NPEs and IndexOutOfBoundsException
 165                                                         return trace == null || trace.getFrames().isEmpty() ? null : trace.getFrames().get(0);
 166                                                 }
 167                                         };
 168                                 }
 169                         });
 170 
 171         public static final IAttribute<String> STACK_TRACE_TOP_PACKAGE = Attribute.canonicalize(
 172                         new Attribute<String>("(stackTrace).topPackage", Messages.getString(Messages.ATTR_STACK_TRACE_PACKAGE), //$NON-NLS-1$
 173                                         Messages.getString(Messages.ATTR_STACK_TRACE_PACKAGE_DESC), PLAIN_TEXT) {
 174                                 @Override
 175                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 176                                         final IMemberAccessor<IMCType, U> accessor = STACK_TRACE_TOP_CLASS.getAccessor(type);
 177                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 178                                                 @Override
 179                                                 public String getMember(U i) {
 180                                                         IMCType type = accessor.getMember(i);
 181                                                         return type == null ? null : FormatToolkit.getPackage(type.getPackage());
 182                                                 }
 183                                         };
 184                                 }
 185                         });
 186 
 187         public static final IAttribute<IMCType> STACK_TRACE_TOP_CLASS = Attribute.canonicalize(
 188                         new Attribute<IMCType>("(stackTrace).topClass", Messages.getString(Messages.ATTR_STACK_TRACE_CLASS), //$NON-NLS-1$
 189                                         Messages.getString(Messages.ATTR_STACK_TRACE_CLASS_DESC), CLASS) {
 190                                 @Override
 191                                 public <U> IMemberAccessor<IMCType, U> customAccessor(IType<U> type) {
 192                                         final IMemberAccessor<IMCMethod, U> accessor = STACK_TRACE_TOP_METHOD.getAccessor(type);
 193                                         return accessor == null ? null : new IMemberAccessor<IMCType, U>() {
 194                                                 @Override
 195                                                 public IMCType getMember(U i) {
 196                                                         IMCMethod method = accessor.getMember(i);
 197                                                         return method == null ? null : method.getType();
 198                                                 }
 199                                         };
 200                                 }
 201                         });
 202         public static final IAttribute<String> STACK_TRACE_TOP_CLASS_STRING = Attribute.canonicalize(
 203                         new Attribute<String>("(stackTrace).topClass.string", Messages.getString(Messages.ATTR_STACK_TRACE_CLASS), //$NON-NLS-1$
 204                                         Messages.getString(Messages.ATTR_STACK_TRACE_CLASS_DESC), PLAIN_TEXT) {
 205                                 @Override
 206                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 207                                         final IMemberAccessor<IMCType, U> accessor = STACK_TRACE_TOP_CLASS.getAccessor(type);
 208                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 209                                                 @Override
 210                                                 public String getMember(U i) {
 211                                                         IMCType type = accessor.getMember(i);
 212                                                         return type == null ? null : type.getFullName();
 213                                                 }
 214                                         };
 215                                 }
 216                         });
 217         public static final IAttribute<IMCMethod> STACK_TRACE_TOP_METHOD = Attribute.canonicalize(
 218                         new Attribute<IMCMethod>("(stackTrace).topMethod", Messages.getString(Messages.ATTR_STACK_TRACE_METHOD), //$NON-NLS-1$
 219                                         Messages.getString(Messages.ATTR_STACK_TRACE_METHOD_DESC), UnitLookup.METHOD) {
 220                                 @Override
 221                                 public <U> IMemberAccessor<IMCMethod, U> customAccessor(IType<U> type) {
 222                                         final IMemberAccessor<IMCFrame, U> accessor = STACK_TRACE_TOP_FRAME.getAccessor(type);
 223                                         return accessor == null ? null : new IMemberAccessor<IMCMethod, U>() {
 224                                                 @Override
 225                                                 public IMCMethod getMember(U i) {
 226                                                         IMCFrame frame = accessor.getMember(i);
 227                                                         return frame == null ? null : frame.getMethod();
 228                                                 }
 229                                         };
 230                                 }
 231                         });
 232         public static final IAttribute<String> STACK_TRACE_TOP_METHOD_STRING = Attribute.canonicalize(
 233                         new Attribute<String>("(stackTrace).topMethodString", Messages.getString(Messages.ATTR_STACK_TRACE_METHOD), //$NON-NLS-1$
 234                                         Messages.getString(Messages.ATTR_STACK_TRACE_METHOD_DESC), UnitLookup.PLAIN_TEXT) {
 235                                 @Override
 236                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 237                                         final IMemberAccessor<IMCMethod, U> accessor = STACK_TRACE_TOP_METHOD.getAccessor(type);
 238                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 239                                                 @Override
 240                                                 public String getMember(U i) {
 241                                                         IMCMethod method = accessor.getMember(i);
 242                                                         return method == null ? null : FormatToolkit.getHumanReadable(method);
 243                                                 }
 244                                         };
 245                                 }
 246                         });
 247 
 248         public static final IAttribute<IMCFrame> STACK_TRACE_BOTTOM_FRAME = Attribute
 249                         .canonicalize(new Attribute<IMCFrame>("(stackTrace).bottomFrame", //$NON-NLS-1$
 250                                         Messages.getString(Messages.ATTR_STACK_TRACE_BOTTOM_FRAME),
 251                                         Messages.getString(Messages.ATTR_STACK_TRACE_BOTTOM_FRAME_DESC), UnitLookup.STACKTRACE_FRAME) {
 252                                 @Override
 253                                 public <U> IMemberAccessor<IMCFrame, U> customAccessor(IType<U> type) {
 254                                         final IMemberAccessor<IMCStackTrace, U> accessor = JfrAttributes.EVENT_STACKTRACE.getAccessor(type);
 255                                         return accessor == null ? null : new IMemberAccessor<IMCFrame, U>() {
 256                                                 @Override
 257                                                 public IMCFrame getMember(U i) {
 258                                                         IMCStackTrace trace = accessor.getMember(i);
 259                                                         if (trace != null) {
 260                                                                 List<? extends IMCFrame> frames = trace.getFrames();
 261                                                                 return frames == null || frames.size() == 0 ? null : frames.get(frames.size() - 1);
 262                                                         }
 263                                                         return null;
 264                                                 }
 265                                         };
 266                                 }
 267                         });
 268 
 269         public static final IAttribute<IMCMethod> STACK_TRACE_BOTTOM_METHOD = Attribute
 270                         .canonicalize(new Attribute<IMCMethod>("(stackTrace).bottomMethod", //$NON-NLS-1$
 271                                         Messages.getString(Messages.ATTR_STACK_TRACE_BOTTOM_METHOD),
 272                                         Messages.getString(Messages.ATTR_STACK_TRACE_BOTTOM_METHOD_DESC), UnitLookup.METHOD) {
 273                                 @Override
 274                                 public <U> IMemberAccessor<IMCMethod, U> customAccessor(IType<U> type) {
 275                                         final IMemberAccessor<IMCFrame, U> accessor = STACK_TRACE_BOTTOM_FRAME.getAccessor(type);
 276                                         return accessor == null ? null : new IMemberAccessor<IMCMethod, U>() {
 277                                                 @Override
 278                                                 public IMCMethod getMember(U i) {
 279                                                         IMCFrame frame = accessor.getMember(i);
 280                                                         return frame == null ? null : frame.getMethod();
 281                                                 }
 282                                         };
 283                                 }
 284                         });
 285         public static final IAttribute<String> STACK_TRACE_BOTTOM_METHOD_STRING = Attribute
 286                         .canonicalize(new Attribute<String>("(stackTrace).bottomMethodString", //$NON-NLS-1$
 287                                         Messages.getString(Messages.ATTR_STACK_TRACE_BOTTOM_METHOD),
 288                                         Messages.getString(Messages.ATTR_STACK_TRACE_BOTTOM_METHOD_DESC), UnitLookup.PLAIN_TEXT) {
 289                                 @Override
 290                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 291                                         final IMemberAccessor<IMCMethod, U> accessor = STACK_TRACE_BOTTOM_METHOD.getAccessor(type);
 292                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 293                                                 @Override
 294                                                 public String getMember(U i) {
 295                                                         IMCMethod method = accessor.getMember(i);
 296                                                         return method == null ? null : FormatToolkit.getHumanReadable(method);
 297                                                 }
 298                                         };
 299                                 }
 300                         });
 301 
 302         public static final IAttribute<Boolean> STACK_TRACE_TRUNCATED = Attribute.canonicalize(
 303                         new Attribute<Boolean>("(stackTrace).truncationState", Messages.getString(Messages.ATTR_STACK_TRACE_DEPTH), //$NON-NLS-1$
 304                                         Messages.getString(Messages.ATTR_STACK_TRACE_DEPTH_DESC), FLAG) {
 305                                 @Override
 306                                 public <U> IMemberAccessor<Boolean, U> customAccessor(IType<U> type) {
 307                                         final IMemberAccessor<IMCStackTrace, U> accessor = JfrAttributes.EVENT_STACKTRACE.getAccessor(type);
 308                                         return accessor == null ? null : new IMemberAccessor<Boolean, U>() {
 309                                                 @Override
 310                                                 public Boolean getMember(U i) {
 311                                                         IMCStackTrace trace = accessor.getMember(i);
 312                                                         // FIXME: Fix train wreck to avoid NPEs and IndexOutOfBoundsException
 313                                                         return trace == null ? null : trace.getTruncationState().isTruncated();
 314                                                 }
 315                                         };
 316                                 }
 317                         });
 318 
 319         public static final IAttribute<String> PID = attr("pid", Messages.getString(Messages.ATTR_PID), PLAIN_TEXT); //$NON-NLS-1$
 320         public static final IAttribute<String> COMMAND_LINE = attr("commandLine", //$NON-NLS-1$
 321                         Messages.getString(Messages.ATTR_COMMAND_LINE), PLAIN_TEXT);
 322 
 323         public static final IAttribute<IQuantity> JVM_SYSTEM = attr("jvmSystem", //$NON-NLS-1$
 324                         Messages.getString(Messages.ATTR_JVM_SYSTEM), Messages.getString(Messages.ATTR_JVM_SYSTEM_DESC),
 325                         PERCENTAGE);
 326         public static final IAttribute<IQuantity> JVM_USER = attr("jvmUser", Messages.getString(Messages.ATTR_JVM_USER), //$NON-NLS-1$
 327                         Messages.getString(Messages.ATTR_JVM_USER_DESC), PERCENTAGE);
 328         public static final IAttribute<IQuantity> JVM_TOTAL = Attribute.canonicalize(new Attribute<IQuantity>("jvmTotal", //$NON-NLS-1$
 329                         Messages.getString(Messages.ATTR_JVM_TOTAL), Messages.getString(Messages.ATTR_JVM_TOTAL_DESC), PERCENTAGE) {
 330                 @Override
 331                 public <U> IMemberAccessor<IQuantity, U> customAccessor(IType<U> type) {
 332                         // Avoid possible future circularity by asking the type directly.
 333                         final IMemberAccessor<IQuantity, U> jvmUserAccessor = type.getAccessor(JVM_USER.getKey());
 334                         final IMemberAccessor<IQuantity, U> jvmSystemAccessor = type.getAccessor(JVM_SYSTEM.getKey());
 335                         if ((jvmUserAccessor == null) || (jvmSystemAccessor == null)) {
 336                                 return null;
 337                         }
 338                         return new IMemberAccessor<IQuantity, U>() {
 339                                 @Override
 340                                 public IQuantity getMember(U i) {
 341                                         IQuantity jvmUser = jvmUserAccessor.getMember(i);
 342                                         IQuantity jvmSystem = jvmSystemAccessor.getMember(i);
 343                                         return jvmUser != null && jvmSystem != null ? jvmUser.add(jvmSystem) : null;
 344                                 }
 345                         };
 346                 }
 347         });
 348         public static final IAttribute<IQuantity> MACHINE_TOTAL = attr("machineTotal", //$NON-NLS-1$
 349                         Messages.getString(Messages.ATTR_MACHINE_TOTAL), Messages.getString(Messages.ATTR_MACHINE_TOTAL_DESC),
 350                         PERCENTAGE);
 351         public static final IAttribute<IQuantity> OTHER_CPU = Attribute.canonicalize(new Attribute<IQuantity>("otherCpu", //$NON-NLS-1$
 352                         Messages.getString(Messages.ATTR_OTHER_CPU), Messages.getString(Messages.ATTR_OTHER_CPU_DESC), PERCENTAGE) {
 353                 @Override
 354                 public <U> IMemberAccessor<IQuantity, U> customAccessor(IType<U> type) {
 355                         final IMemberAccessor<IQuantity, U> jvmTotalAccessor = JVM_TOTAL.getAccessor(type);
 356                         // Avoid possible future circularity by asking the type directly.
 357                         final IMemberAccessor<IQuantity, U> machineTotalAccessor = type.getAccessor(MACHINE_TOTAL.getKey());
 358                         if ((jvmTotalAccessor == null) || (machineTotalAccessor == null)) {
 359                                 return null;
 360                         }
 361                         return new IMemberAccessor<IQuantity, U>() {
 362                                 @Override
 363                                 public IQuantity getMember(U i) {
 364                                         IQuantity jvmTotal = jvmTotalAccessor.getMember(i);
 365                                         IQuantity machineTotal = machineTotalAccessor.getMember(i);
 366                                         return jvmTotal != null && machineTotal != null ? machineTotal.subtract(jvmTotal) : null;
 367                                 }
 368                         };
 369                 }
 370         });
 371 
 372         public static final IAttribute<IQuantity> RECORDING_ID = attr("id", Messages.getString(Messages.ATTR_RECORDING_ID), //$NON-NLS-1$
 373                         NUMBER);
 374         public static final IAttribute<String> RECORDING_NAME = attr("name", //$NON-NLS-1$
 375                         Messages.getString(Messages.ATTR_RECORDING_NAME), PLAIN_TEXT);
 376         public static final IAttribute<IQuantity> RECORDING_START = attr("recordingStart", //$NON-NLS-1$
 377                         Messages.getString(Messages.ATTR_RECORDING_START), TIMESTAMP);
 378         public static final IAttribute<IQuantity> RECORDING_DURATION = attr("recordingDuration", //$NON-NLS-1$
 379                         Messages.getString(Messages.ATTR_RECORDING_DURATION), TIMESPAN);
 380         public static final IAttribute<IQuantity> RECORDING_MAX_SIZE = attr("maxSize", //$NON-NLS-1$
 381                         Messages.getString(Messages.ATTR_RECORDING_MAX_SIZE), MEMORY);
 382         public static final IAttribute<IQuantity> RECORDING_MAX_AGE = attr("maxAge", //$NON-NLS-1$
 383                         Messages.getString(Messages.ATTR_RECORDING_MAX_AGE), TIMESPAN);
 384         public static final IAttribute<String> RECORDING_DESTINATION = attr("destination", //$NON-NLS-1$
 385                         Messages.getString(Messages.ATTR_RECORDING_DESTINATION), PLAIN_TEXT);
 386 
 387         public static final IAttribute<LabeledIdentifier> REC_SETTING_FOR = attr("settingFor", //$NON-NLS-1$
 388                         Messages.getString(Messages.ATTR_REC_SETTING_FOR), LABELED_IDENTIFIER);
 389         public static final IAttribute<String> REC_SETTING_NAME = attr("name", //$NON-NLS-1$
 390                         Messages.getString(Messages.ATTR_REC_SETTING_NAME), PLAIN_TEXT);
 391         public static final IAttribute<String> REC_SETTING_VALUE = attr("value", //$NON-NLS-1$
 392                         Messages.getString(Messages.ATTR_REC_SETTING_VALUE), PLAIN_TEXT);
 393         public static final IAttribute<String> REC_SETTING_FOR_NAME = Attribute.canonicalize(new Attribute<String>(
 394                         "settingFor.string", Messages.getString(Messages.ATTR_REC_SETTING_FOR), null, PLAIN_TEXT) { //$NON-NLS-1$
 395                 @Override
 396                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 397                         final IMemberAccessor<LabeledIdentifier, U> accessor = REC_SETTING_FOR.getAccessor(type);
 398                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 399                                 @Override
 400                                 public String getMember(U i) {
 401                                         LabeledIdentifier identifier = accessor.getMember(i);
 402                                         return identifier == null ? null : identifier.getName();
 403                                 }
 404                         };
 405                 }
 406         });
 407         public static final IAttribute<String> REC_SETTING_FOR_ID = Attribute.canonicalize(new Attribute<String>(
 408                         "settingFor.id", Messages.getString(Messages.ATTR_REC_SETTING_FOR), null, PLAIN_TEXT) { //$NON-NLS-1$
 409                 @Override
 410                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 411                         final IMemberAccessor<LabeledIdentifier, U> accessor = REC_SETTING_FOR.getAccessor(type);
 412                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 413                                 @Override
 414                                 public String getMember(U i) {
 415                                         LabeledIdentifier identifier = accessor.getMember(i);
 416                                         return identifier == null ? null : identifier.getInterfaceId();
 417                                 }
 418                         };
 419                 }
 420         });
 421 
 422         public static final IAttribute<IMCPackage> EXPORTED_PACKAGE = attr("exportedPackage", //$NON-NLS-1$
 423                         Messages.getString(Messages.ATTR_EXPORTED_PACKAGE), UnitLookup.PACKAGE);
 424 
 425         public static final IAttribute<IMCModule> EXPORTING_MODULE = Attribute.canonicalize(new Attribute<IMCModule>(
 426                         "exportingModule", Messages.getString(Messages.ATTR_EXPORTING_MODULE), null, UnitLookup.MODULE) { //$NON-NLS-1$
 427                 @Override
 428                 public <U> IMemberAccessor<IMCModule, U> customAccessor(IType<U> type) {
 429                         final IMemberAccessor<IMCPackage, U> accessor = EXPORTED_PACKAGE.getAccessor(type);
 430                         return accessor == null ? null : new IMemberAccessor<IMCModule, U>() {
 431                                 @Override
 432                                 public IMCModule getMember(U i) {
 433                                         IMCPackage thePackage = accessor.getMember(i);
 434                                         return thePackage == null ? null : thePackage.getModule();
 435                                 }
 436                         };
 437                 }
 438         });
 439 
 440         public static final IAttribute<IQuantity> JVM_START_TIME = attr("jvmStartTime", //$NON-NLS-1$
 441                         Messages.getString(Messages.ATTR_JVM_START_TIME), TIMESTAMP);
 442         public static final IAttribute<String> JVM_NAME = attr("jvmName", Messages.getString(Messages.ATTR_JVM_NAME), //$NON-NLS-1$
 443                         PLAIN_TEXT);
 444         public static final IAttribute<String> JVM_VERSION = attr("jvmVersion", //$NON-NLS-1$
 445                         Messages.getString(Messages.ATTR_JVM_VERSION), PLAIN_TEXT);
 446         public static final IAttribute<String> JVM_ARGUMENTS = attr("jvmArguments", //$NON-NLS-1$
 447                         Messages.getString(Messages.ATTR_JVM_ARGUMENTS), PLAIN_TEXT);
 448         public static final IAttribute<String> JAVA_ARGUMENTS = attr("javaArguments", //$NON-NLS-1$
 449                         Messages.getString(Messages.ATTR_JAVA_ARGUMENTS), PLAIN_TEXT);
 450 
 451         public static final IAttribute<String> IO_PATH = attr("path", Messages.getString(Messages.ATTR_IO_PATH), //$NON-NLS-1$
 452                         Messages.getString(Messages.ATTR_IO_PATH_DESC), PLAIN_TEXT);
 453         public static final IAttribute<IQuantity> IO_FILE_BYTES_READ = attr("bytesRead", //$NON-NLS-1$
 454                         Messages.getString(Messages.ATTR_IO_FILE_BYTES_READ),
 455                         Messages.getString(Messages.ATTR_IO_FILE_BYTES_READ_DESC), MEMORY);
 456         public static final IAttribute<Boolean> IO_FILE_READ_EOF = attr("endOfFile", //$NON-NLS-1$
 457                         Messages.getString(Messages.ATTR_IO_FILE_READ_EOF), Messages.getString(Messages.ATTR_IO_FILE_READ_EOF_DESC),
 458                         FLAG);
 459         public static final IAttribute<IQuantity> IO_FILE_BYTES_WRITTEN = attr("bytesWritten", //$NON-NLS-1$
 460                         Messages.getString(Messages.ATTR_IO_FILE_BYTES_WRITTEN),
 461                         Messages.getString(Messages.ATTR_IO_FILE_BYTES_WRITTEN_DESC), MEMORY);
 462         public static final IAttribute<IQuantity> IO_SOCKET_BYTES_READ = attr("bytesRead", //$NON-NLS-1$
 463                         Messages.getString(Messages.ATTR_IO_SOCKET_BYTES_READ),
 464                         Messages.getString(Messages.ATTR_IO_SOCKET_BYTES_READ_DESC), MEMORY);
 465         public static final IAttribute<Boolean> IO_SOCKET_READ_EOS = attr("endOfStream", //$NON-NLS-1$
 466                         Messages.getString(Messages.ATTR_IO_SOCKET_READ_EOS),
 467                         Messages.getString(Messages.ATTR_IO_SOCKET_READ_EOS_DESC), FLAG);
 468         public static final IAttribute<IQuantity> IO_SOCKET_BYTES_WRITTEN = attr("bytesWritten", //$NON-NLS-1$
 469                         Messages.getString(Messages.ATTR_IO_SOCKET_BYTES_WRITTEN),
 470                         Messages.getString(Messages.ATTR_IO_SOCKET_BYTES_WRITTEN_DESC), MEMORY);
 471         public static final IAttribute<String> IO_ADDRESS = attr("address", Messages.getString(Messages.ATTR_IO_ADDRESS), //$NON-NLS-1$
 472                         PLAIN_TEXT);
 473         public static final IAttribute<String> IO_HOST = attr("host", Messages.getString(Messages.ATTR_IO_HOST), //$NON-NLS-1$
 474                         Messages.getString(Messages.ATTR_IO_HOST_DESC), PLAIN_TEXT);
 475         public static final IAttribute<IQuantity> IO_PORT = attr("port", Messages.getString(Messages.ATTR_IO_PORT), NUMBER); //$NON-NLS-1$
 476         public static final IAttribute<Object> IO_PORT_ON_ADDRESS = Attribute.canonicalize(new Attribute<Object>(
 477                         "portOnAddress", Messages.getString(Messages.ATTR_IO_PORT_ON_ADDRESS), null, UNKNOWN) { //$NON-NLS-1$
 478                 @Override
 479                 public <U> IMemberAccessor<Object, U> customAccessor(IType<U> type) {
 480                         class PortOnAddress implements IDisplayable {
 481 
 482                                 final String address;
 483                                 final IQuantity port;
 484 
 485                                 PortOnAddress(String address, IQuantity port) {
 486                                         this.address = address;
 487                                         this.port = port;
 488                                 }
 489 
 490                                 @Override
 491                                 public String displayUsing(String formatHint) {
 492                                         return address + " : " + port.displayUsing(formatHint); //$NON-NLS-1$
 493                                 }
 494 
 495                                 @Override
 496                                 public int hashCode() {
 497                                         return 31 * address.hashCode() + port.hashCode();
 498                                 };
 499 
 500                                 @Override
 501                                 public boolean equals(Object o) {
 502                                         return o instanceof PortOnAddress && ((PortOnAddress) o).address.equals(address)
 503                                                         && ((PortOnAddress) o).port.equals(port);
 504                                 };
 505 
 506                         }
 507                         // Avoid possible future circularity by asking the type directly.
 508                         final IMemberAccessor<String, U> addressAccessor = type.getAccessor(IO_ADDRESS.getKey());
 509                         final IMemberAccessor<IQuantity, U> portAccessor = type.getAccessor(IO_PORT.getKey());
 510                         if ((addressAccessor == null) || (portAccessor == null)) {
 511                                 return null;
 512                         }
 513                         return new IMemberAccessor<Object, U>() {
 514                                 @Override
 515                                 public IDisplayable getMember(U i) {
 516                                         String address = addressAccessor.getMember(i);
 517                                         IQuantity port = portAccessor.getMember(i);
 518                                         if (address != null && port != null) {
 519                                                 return new PortOnAddress(address, port);
 520                                         }
 521                                         return null;
 522                                 }
 523                         };
 524                 }
 525         });
 526 
 527         public static final IAttribute<IQuantity> IO_TIMEOUT = attr("timeout", Messages.getString(Messages.ATTR_IO_TIMEOUT), //$NON-NLS-1$
 528                         TIMESPAN);
 529 
 530         public static final IAttribute<IQuantity> TLAB_SIZE = attr("tlabSize", Messages.getString(Messages.ATTR_TLAB_SIZE), //$NON-NLS-1$
 531                         MEMORY);
 532         public static final IAttribute<IQuantity> ALLOCATION_SIZE = attr("allocationSize", //$NON-NLS-1$
 533                         Messages.getString(Messages.ATTR_ALLOCATION_SIZE), MEMORY);
 534         public static final IAttribute<IMCType> ALLOCATION_CLASS = attr("objectClass", //$NON-NLS-1$
 535                         Messages.getString(Messages.ATTR_ALLOCATION_CLASS), Messages.getString(Messages.ATTR_ALLOCATION_CLASS_DESC),
 536                         CLASS);
 537         public static final IAttribute<IMCType> OBJECT_CLASS = attr("objectClass", //$NON-NLS-1$
 538                         Messages.getString(Messages.ATTR_OBJECT_CLASS), CLASS);
 539         public static final IAttribute<String> OBJECT_CLASS_FULLNAME = Attribute.canonicalize(new Attribute<String>(
 540                         "objectClass.humanreadable", Messages.getString(Messages.ATTR_OBJECT_CLASS), null, PLAIN_TEXT) { //$NON-NLS-1$
 541                 @Override
 542                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 543                         final IMemberAccessor<IMCType, U> accessor = OBJECT_CLASS.getAccessor(type);
 544                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 545                                 @Override
 546                                 public String getMember(U i) {
 547                                         IMCType type = accessor.getMember(i);
 548                                         return type == null ? null : type.getFullName();
 549                                 }
 550                         };
 551                 }
 552         });
 553         public static final IAttribute<IQuantity> COUNT = attr("count", Messages.getString(Messages.ATTR_COUNT), NUMBER); //$NON-NLS-1$
 554 
 555         public static final IAttribute<IQuantity> HW_THREADS = attr("hwThreads", //$NON-NLS-1$
 556                         Messages.getString(Messages.ATTR_HW_THREADS), Messages.getString(Messages.ATTR_HW_THREADS_DESC), NUMBER);
 557 
 558         public static final IAttribute<IQuantity> PARALLEL_GC_THREADS = attr("parallelGCThreads", //$NON-NLS-1$
 559                         Messages.getString(Messages.ATTR_PARALLEL_GC_THREADS),
 560                         Messages.getString(Messages.ATTR_PARALLEL_GC_THREADS_DESC), NUMBER);
 561         public static final IAttribute<IQuantity> CONCURRENT_GC_THREADS = attr("concurrentGCThreads", //$NON-NLS-1$
 562                         Messages.getString(Messages.ATTR_CONCURRENT_GC_THREADS),
 563                         Messages.getString(Messages.ATTR_CONCURRENT_GC_THREADS_DESC), NUMBER);
 564         public static final IAttribute<String> YOUNG_COLLECTOR = attr("youngCollector", //$NON-NLS-1$
 565                         Messages.getString(Messages.ATTR_YOUNG_COLLECTOR), Messages.getString(Messages.ATTR_YOUNG_COLLECTOR_DESC),
 566                         PLAIN_TEXT);
 567         public static final IAttribute<String> OLD_COLLECTOR = attr("oldCollector", //$NON-NLS-1$
 568                         Messages.getString(Messages.ATTR_OLD_COLLECTOR), Messages.getString(Messages.ATTR_OLD_COLLECTOR_DESC),
 569                         PLAIN_TEXT);
 570         public static final IAttribute<Boolean> EXPLICIT_GC_CONCURRENT = attr("isExplicitGCConcurrent", //$NON-NLS-1$
 571                         Messages.getString(Messages.ATTR_EXPLICIT_GC_CONCURRENT),
 572                         Messages.getString(Messages.ATTR_EXPLICIT_GC_CONCURRENT_DESC), FLAG);
 573         public static final IAttribute<Boolean> EXPLICIT_GC_DISABLED = attr("isExplicitGCDisabled", //$NON-NLS-1$
 574                         Messages.getString(Messages.ATTR_EXPLICIT_GC_DISABLED),
 575                         Messages.getString(Messages.ATTR_EXPLICIT_GC_DISABLED_DESC), FLAG);
 576         public static final IAttribute<Boolean> USE_DYNAMIC_GC_THREADS = attr("usesDynamicGCThreads", //$NON-NLS-1$
 577                         Messages.getString(Messages.ATTR_USE_DYNAMIC_GC_THREADS),
 578                         Messages.getString(Messages.ATTR_USE_DYNAMIC_GC_THREADS_DESC), FLAG);
 579         public static final IAttribute<IQuantity> GC_TIME_RATIO = attr("gcTimeRatio", //$NON-NLS-1$
 580                         Messages.getString(Messages.ATTR_GC_TIME_RATIO), Messages.getString(Messages.ATTR_GC_TIME_RATIO_DESC),
 581                         NUMBER);
 582 
 583         public static final IAttribute<IQuantity> HEAP_MAX_SIZE = attr("maxSize", //$NON-NLS-1$
 584                         Messages.getString(Messages.ATTR_HEAP_MAX_SIZE), MEMORY);
 585         public static final IAttribute<IQuantity> HEAP_MIN_SIZE = attr("minSize", //$NON-NLS-1$
 586                         Messages.getString(Messages.ATTR_HEAP_MIN_SIZE), MEMORY);
 587         public static final IAttribute<IQuantity> HEAP_INITIAL_SIZE = attr("initialSize", //$NON-NLS-1$
 588                         Messages.getString(Messages.ATTR_HEAP_INITIAL_SIZE), MEMORY);
 589         public static final IAttribute<IQuantity> HEAP_OBJECT_ALIGNMENT = attr("objectAlignment", //$NON-NLS-1$
 590                         Messages.getString(Messages.ATTR_HEAP_OBJECT_ALIGNMENT),
 591                         Messages.getString(Messages.ATTR_HEAP_OBJECT_ALIGNMENT_DESC), MEMORY);
 592         public static final IAttribute<IQuantity> HEAP_ADDRESS_SIZE = attr("heapAddressBits", //$NON-NLS-1$
 593                         Messages.getString(Messages.ATTR_HEAP_ADDRESS_SIZE),
 594                         Messages.getString(Messages.ATTR_HEAP_ADDRESS_SIZE_DESC), NUMBER);
 595         public static final IAttribute<Boolean> HEAP_USE_COMPRESSED_OOPS = attr("usesCompressedOops", //$NON-NLS-1$
 596                         Messages.getString(Messages.ATTR_HEAP_USE_COMPRESSED_OOPS),
 597                         Messages.getString(Messages.ATTR_HEAP_USE_COMPRESSED_OOPS_DESC), FLAG);
 598         public static final IAttribute<String> HEAP_COMPRESSED_OOPS_MODE = attr("compressedOopsMode", //$NON-NLS-1$
 599                         Messages.getString(Messages.ATTR_HEAP_COMPRESSED_OOPS_MODE),
 600                         Messages.getString(Messages.ATTR_HEAP_COMPRESSED_OOPS_MODE_DESC), PLAIN_TEXT);
 601 
 602         public static final IAttribute<IQuantity> YOUNG_GENERATION_MIN_SIZE = attr("minSize", //$NON-NLS-1$
 603                         Messages.getString(Messages.ATTR_YOUNG_GENERATION_MIN_SIZE), MEMORY);
 604         public static final IAttribute<IQuantity> YOUNG_GENERATION_MAX_SIZE = attr("maxSize", //$NON-NLS-1$
 605                         Messages.getString(Messages.ATTR_YOUNG_GENERATION_MAX_SIZE), MEMORY);
 606 
 607         public static final IAttribute<IQuantity> NEW_RATIO = attr("newRatio", Messages.getString(Messages.ATTR_NEW_RATIO), //$NON-NLS-1$
 608                         Messages.getString(Messages.ATTR_NEW_RATIO_DESC), NUMBER);
 609         public static final IAttribute<IQuantity> TENURING_THRESHOLD_INITIAL = attr("initialTenuringThreshold", //$NON-NLS-1$
 610                         Messages.getString(Messages.ATTR_TENURING_THRESHOLD_INITIAL),
 611                         Messages.getString(Messages.ATTR_TENURING_THRESHOLD_INITIAL_DESC), NUMBER);
 612         public static final IAttribute<IQuantity> TENURING_THRESHOLD_MAXIMUM = attr("maxTenuringThreshold", //$NON-NLS-1$
 613                         Messages.getString(Messages.ATTR_TENURING_THRESHOLD_MAXIMUM),
 614                         Messages.getString(Messages.ATTR_TENURING_THRESHOLD_MAXIMUM_DESC), NUMBER);
 615 
 616         public static final IAttribute<Boolean> USES_TLABS = attr("usesTLABs", Messages.getString(Messages.ATTR_USES_TLABS), //$NON-NLS-1$
 617                         Messages.getString(Messages.ATTR_USES_TLABS_DESC), FLAG);
 618         public static final IAttribute<IQuantity> TLAB_MIN_SIZE = attr("minTLABSize", //$NON-NLS-1$
 619                         Messages.getString(Messages.ATTR_TLAB_MIN_SIZE), MEMORY);
 620         public static final IAttribute<IQuantity> TLAB_REFILL_WASTE_LIMIT = attr("tlabRefillWasteLimit", //$NON-NLS-1$
 621                         Messages.getString(Messages.ATTR_TLAB_REFILL_WASTE_LIMIT), MEMORY);
 622 
 623         public static final IAttribute<IQuantity> HEAP_TOTAL = attr("totalSize", //$NON-NLS-1$
 624                         Messages.getString(Messages.ATTR_HEAP_TOTAL), MEMORY);
 625         public static final IAttribute<IQuantity> HEAP_USED = attr("heapUsed", Messages.getString(Messages.ATTR_HEAP_USED), //$NON-NLS-1$
 626                         Messages.getString(Messages.ATTR_HEAP_USED_DESC), MEMORY);
 627         public static final IAttribute<String> GC_WHEN = attr("when", Messages.getString(Messages.ATTR_GC_WHEN), //$NON-NLS-1$
 628                         PLAIN_TEXT);
 629         public static final IAttribute<IQuantity> GC_ID = attr("gcId", Messages.getString(Messages.ATTR_GC_ID), //$NON-NLS-1$
 630                         Messages.getString(Messages.ATTR_GC_ID_DESC), NUMBER);
 631         public static final IAttribute<IQuantity> REFERENCE_COUNT = attr("count", //$NON-NLS-1$
 632                         Messages.getString(Messages.ATTR_REFERENCE_COUNT), NUMBER);
 633         public static final IAttribute<String> GC_PHASE_NAME = attr("name", Messages.getString(Messages.ATTR_GC_PHASE_NAME), //$NON-NLS-1$
 634                         PLAIN_TEXT);
 635 
 636         public static final IAttribute<IQuantity> GC_HEAPSPACE_COMMITTED = attr("heapSpace:committedSize", //$NON-NLS-1$
 637                         Messages.getString(Messages.ATTR_GC_HEAPSPACE_COMMITTED),
 638                         Messages.getString(Messages.ATTR_GC_HEAPSPACE_COMMITTED_DESC), MEMORY);
 639         public static final IAttribute<IQuantity> GC_HEAPSPACE_RESERVED = attr("heapSpace:reservedSize", //$NON-NLS-1$
 640                         Messages.getString(Messages.ATTR_GC_HEAPSPACE_RESERVED),
 641                         Messages.getString(Messages.ATTR_GC_HEAPSPACE_RESERVED_DESC), MEMORY);
 642 
 643         public static final IAttribute<IQuantity> GC_METASPACE_CAPACITY = attr("metaspace:capacity", //$NON-NLS-1$
 644                         Messages.getString(Messages.ATTR_GC_METASPACE_CAPACITY),
 645                         Messages.getString(Messages.ATTR_GC_METASPACE_CAPACITY_DESC), MEMORY);
 646         public static final IAttribute<IQuantity> GC_METASPACE_COMMITTED = attr("metaspace:committed", //$NON-NLS-1$
 647                         Messages.getString(Messages.ATTR_GC_METASPACE_COMMITTED),
 648                         Messages.getString(Messages.ATTR_GC_METASPACE_COMMITTED_DESC), MEMORY);
 649         public static final IAttribute<IQuantity> GC_METASPACE_RESERVED = attr("metaspace:reserved", //$NON-NLS-1$
 650                         Messages.getString(Messages.ATTR_GC_METASPACE_RESERVED),
 651                         Messages.getString(Messages.ATTR_GC_METASPACE_RESERVED_DESC), MEMORY);
 652         public static final IAttribute<IQuantity> GC_METASPACE_USED = attr("metaspace:used", //$NON-NLS-1$
 653                         Messages.getString(Messages.ATTR_GC_METASPACE_USED),
 654                         Messages.getString(Messages.ATTR_GC_METASPACE_USED_DESC), MEMORY);
 655         public static final IAttribute<IQuantity> GC_DATASPACE_COMMITTED = attr("dataSpace:committed", //$NON-NLS-1$
 656                         Messages.getString(Messages.ATTR_GC_METASPACE_DATA_COMMITTED),
 657                         Messages.getString(Messages.ATTR_GC_METASPACE_DATA_COMMITTED_DESC), MEMORY);
 658         public static final IAttribute<IQuantity> GC_DATASPACE_RESERVED = attr("dataSpace:reserved", //$NON-NLS-1$
 659                         Messages.getString(Messages.ATTR_GC_METASPACE_DATA_RESERVED),
 660                         Messages.getString(Messages.ATTR_GC_METASPACE_DATA_RESERVED_DESC), MEMORY);
 661         public static final IAttribute<IQuantity> GC_DATASPACE_USED = attr("dataSpace:used", //$NON-NLS-1$
 662                         Messages.getString(Messages.ATTR_GC_METASPACE_DATA_USED),
 663                         Messages.getString(Messages.ATTR_GC_METASPACE_DATA_USED_DESC), MEMORY);
 664         public static final IAttribute<IQuantity> GC_CLASSSPACE_COMMITTED = attr("classSpace:committed", //$NON-NLS-1$
 665                         Messages.getString(Messages.ATTR_GC_METASPACE_CLASS_COMMITTED),
 666                         Messages.getString(Messages.ATTR_GC_METASPACE_CLASS_COMMITTED_DESC), MEMORY);
 667         public static final IAttribute<IQuantity> GC_CLASSSPACE_RESERVED = attr("classSpace:reserved", //$NON-NLS-1$
 668                         Messages.getString(Messages.ATTR_GC_METASPACE_CLASS_RESERVED),
 669                         Messages.getString(Messages.ATTR_GC_METASPACE_CLASS_RESERVED_DESC), MEMORY);
 670         public static final IAttribute<IQuantity> GC_CLASSSPACE_USED = attr("classSpace:used", //$NON-NLS-1$
 671                         Messages.getString(Messages.ATTR_GC_METASPACE_CLASS_USED),
 672                         Messages.getString(Messages.ATTR_GC_METASPACE_CLASS_USED_DESC), MEMORY);
 673 
 674         public static final IAttribute<IQuantity> GC_THRESHOLD = attr("gcThreshold", //$NON-NLS-1$
 675                         Messages.getString(Messages.ATTR_GC_THRESHOLD), Messages.getString(Messages.ATTR_GC_THRESHOLD_DESC),
 676                         MEMORY);
 677 
 678         public static final IAttribute<IQuantity> OS_MEMORY_TOTAL = attr("totalSize", //$NON-NLS-1$
 679                         Messages.getString(Messages.ATTR_OS_MEMORY_TOTAL), Messages.getString(Messages.ATTR_OS_MEMORY_TOTAL_DESC),
 680                         MEMORY);
 681         public static final IAttribute<IQuantity> OS_MEMORY_USED = attr("usedSize", //$NON-NLS-1$
 682                         Messages.getString(Messages.ATTR_OS_MEMORY_USED), Messages.getString(Messages.ATTR_OS_MEMORY_USED_DESC),
 683                         MEMORY);
 684 
 685         public static final IAttribute<String> FLAG_NAME = attr("name", Messages.getString(Messages.ATTR_FLAG_NAME), //$NON-NLS-1$
 686                         PLAIN_TEXT);
 687         public static final IAttribute<String> FLAG_ORIGIN = attr("origin", Messages.getString(Messages.ATTR_FLAG_ORIGIN), //$NON-NLS-1$
 688                         PLAIN_TEXT);
 689         public static final IAttribute<IQuantity> FLAG_VALUE_NUMBER = attr("value", //$NON-NLS-1$
 690                         Messages.getString(Messages.ATTR_FLAG_VALUE_NUMBER), NUMBER);
 691         public static final IAttribute<Boolean> FLAG_VALUE_BOOLEAN = attr("value", //$NON-NLS-1$
 692                         Messages.getString(Messages.ATTR_FLAG_VALUE_BOOLEAN), FLAG);
 693         public static final IAttribute<String> FLAG_VALUE_TEXT = attr("value", //$NON-NLS-1$
 694                         Messages.getString(Messages.ATTR_FLAG_VALUE_TEXT), PLAIN_TEXT);
 695 
 696         public static final IAttribute<String> THREAD_DUMP_RESULT = attr("result", //$NON-NLS-1$
 697                         Messages.getString(Messages.ATTR_THREAD_DUMP_RESULT), PLAIN_TEXT);
 698         public static final IAttribute<String> DUMP_REASON = attr("reason", Messages.getString(Messages.ATTR_DUMP_REASON), //$NON-NLS-1$
 699                         Messages.getString(Messages.ATTR_DUMP_REASON_DESC), PLAIN_TEXT);
 700         public static final IAttribute<String> DUMP_REASON_RECORDING_ID = attr("recordingId", //$NON-NLS-1$
 701                         Messages.getString(Messages.ATTR_DUMP_REASON_RECORDING_ID),
 702                         Messages.getString(Messages.ATTR_DUMP_REASON_RECORDING_ID_DESC), PLAIN_TEXT);
 703         
 704         public static final IAttribute<String> SHUTDOWN_REASON = attr("reason", // $NON-NLS-1$
 705                         Messages.getString(Messages.ATTR_SHUTDOWN_REASON),
 706                         Messages.getString(Messages.ATTR_SHUTDOWN_REASON_DESC), PLAIN_TEXT);
 707 
 708         public static final IAttribute<IQuantity> CLASSLOADER_LOADED_COUNT = attr("loadedClassCount", //$NON-NLS-1$
 709                         Messages.getString(Messages.ATTR_CLASSLOADER_LOADED_COUNT),
 710                         Messages.getString(Messages.ATTR_CLASSLOADER_LOADED_COUNT_DESC), NUMBER);
 711         public static final IAttribute<IQuantity> CLASSLOADER_UNLOADED_COUNT = attr("unloadedClassCount", //$NON-NLS-1$
 712                         Messages.getString(Messages.ATTR_CLASSLOADER_UNLOADED_COUNT),
 713                         Messages.getString(Messages.ATTR_CLASSLOADER_UNLOADED_COUNT_DESC), NUMBER);
 714 
 715         private static final IAttribute<IMCType> CLASS_DEFINING_CLASSLOADER_V0 = attr("definingClassLoader", //$NON-NLS-1$
 716                         Messages.getString(Messages.ATTR_CLASS_DEFINING_CLASSLOADER), CLASS);
 717         private static final IAttribute<IMCType> CLASS_INITIATING_CLASSLOADER_V0 = attr("initiatingClassLoader", //$NON-NLS-1$
 718                         Messages.getString(Messages.ATTR_CLASS_INITIATING_CLASSLOADER), CLASS);
 719         private static final IAttribute<IMCType> PARENT_CLASSLOADER_V0 = attr("parentClassLoader", // $NON-NLS-1$
 720                         Messages.getString(Messages.ATTR_PARENT_CLASSLOADER), CLASS);
 721         private static final IAttribute<IMCType> CLASSLOADER_V0 = attr("classLoader", // $NON-NLS-1$
 722                         Messages.getString(Messages.ATTR_CLASSLOADER), CLASS);
 723 
 724         public static final IAttribute<IMCClassLoader> CLASS_DEFINING_CLASSLOADER = Attribute
 725                         .canonicalize(new Attribute<IMCClassLoader>("definingClassLoader", //$NON-NLS-1$
 726                                         Messages.getString(Messages.ATTR_CLASS_DEFINING_CLASSLOADER), null, CLASS_LOADER) {
 727                                 @Override
 728                                 public <U> IMemberAccessor<IMCClassLoader, U> customAccessor(IType<U> type) {
 729                                         // V1 is handled by the standard accessor
 730                                         final IMemberAccessor<IMCType, U> accessorV0 = CLASS_DEFINING_CLASSLOADER_V0.getAccessor(type);
 731                                         if (accessorV0 != null) {
 732                                                 return new IMemberAccessor<IMCClassLoader, U>() {
 733                                                         @Override
 734                                                         public IMCClassLoader getMember(U i) {
 735                                                                 IMCType type = accessorV0.getMember(i);
 736                                                                 return new MCClassLoader(type, null);
 737                                                         }
 738                                                 };
 739                                         }
 740                                         return null;
 741                                 }
 742                         });
 743         public static final IAttribute<IMCClassLoader> CLASS_INITIATING_CLASSLOADER = Attribute
 744                         .canonicalize(new Attribute<IMCClassLoader>("initiatingClassLoader", //$NON-NLS-1$
 745                                         Messages.getString(Messages.ATTR_CLASS_INITIATING_CLASSLOADER), null, CLASS_LOADER) {
 746                                 @Override
 747                                 public <U> IMemberAccessor<IMCClassLoader, U> customAccessor(IType<U> type) {
 748                                         // V1 is handled by the standard accessor
 749                                         final IMemberAccessor<IMCType, U> accessorV0 = CLASS_INITIATING_CLASSLOADER_V0.getAccessor(type);
 750                                         if (accessorV0 != null) {
 751                                                 return new IMemberAccessor<IMCClassLoader, U>() {
 752                                                         @Override
 753                                                         public IMCClassLoader getMember(U i) {
 754                                                                 IMCType type = accessorV0.getMember(i);
 755                                                                 return new MCClassLoader(type, null);
 756                                                         }
 757                                                 };
 758                                         }
 759                                         return null;
 760                                 }
 761                         });
 762         public static final IAttribute<IMCClassLoader> PARENT_CLASSLOADER = Attribute
 763                         .canonicalize(new Attribute<IMCClassLoader>("parentClassLoader", //$NON-NLS-1$
 764                                         Messages.getString(Messages.ATTR_PARENT_CLASSLOADER), null, CLASS_LOADER) {
 765                                 @Override
 766                                 public <U> IMemberAccessor<IMCClassLoader, U> customAccessor(IType<U> type) {
 767                                         // V1 is handled by the standard accessor
 768                                         final IMemberAccessor<IMCType, U> accessorV0 = PARENT_CLASSLOADER_V0.getAccessor(type);
 769                                         if (accessorV0 != null) {
 770                                                 return new IMemberAccessor<IMCClassLoader, U>() {
 771                                                         @Override
 772                                                         public IMCClassLoader getMember(U i) {
 773                                                                 IMCType type = accessorV0.getMember(i);
 774                                                                 return new MCClassLoader(type, null);
 775                                                         }
 776                                                 };
 777                                         }
 778                                         return null;
 779                                 }
 780                         });
 781         public static final IAttribute<IMCClassLoader> CLASSLOADER = Attribute
 782                         .canonicalize(new Attribute<IMCClassLoader>("classLoader", //$NON-NLS-1$
 783                                         Messages.getString(Messages.ATTR_CLASSLOADER), null, CLASS_LOADER) {
 784                                 @Override
 785                                 public <U> IMemberAccessor<IMCClassLoader, U> customAccessor(IType<U> type) {
 786                                         // V1 is handled by the standard accessor
 787                                         final IMemberAccessor<IMCType, U> accessorV0 = CLASSLOADER_V0.getAccessor(type);
 788                                         if (accessorV0 != null) {
 789                                                 return new IMemberAccessor<IMCClassLoader, U>() {
 790                                                         @Override
 791                                                         public IMCClassLoader getMember(U i) {
 792                                                                 IMCType type = accessorV0.getMember(i);
 793                                                                 return new MCClassLoader(type, null);
 794                                                         }
 795                                                 };
 796                                         }
 797                                         return null;
 798                                 }
 799                         });
 800         public static final IAttribute<String> CLASS_DEFINING_CLASSLOADER_STRING = Attribute
 801                         .canonicalize(new Attribute<String>("defininingClassLoader.string", //$NON-NLS-1$
 802                                         Messages.getString(Messages.ATTR_CLASS_DEFINING_CLASSLOADER), null, PLAIN_TEXT) {
 803                                 @Override
 804                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 805                                         final IMemberAccessor<IMCClassLoader, U> accessor = CLASS_DEFINING_CLASSLOADER.getAccessor(type);
 806                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 807                                                 @Override
 808                                                 public String getMember(U i) {
 809                                                         IMCClassLoader cl = accessor.getMember(i);
 810                                                         return cl == null ? null : FormatToolkit.getHumanReadable(cl);
 811                                                 }
 812                                         };
 813                                 }
 814                         });
 815         public static final IAttribute<String> CLASS_INITIATING_CLASSLOADER_STRING = Attribute
 816                         .canonicalize(new Attribute<String>("initiatingClassLoader.string", //$NON-NLS-1$
 817                                         Messages.getString(Messages.ATTR_CLASS_INITIATING_CLASSLOADER), null, PLAIN_TEXT) {
 818                                 @Override
 819                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 820                                         final IMemberAccessor<IMCClassLoader, U> accessor = CLASS_INITIATING_CLASSLOADER.getAccessor(type);
 821                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 822                                                 @Override
 823                                                 public String getMember(U i) {
 824                                                         IMCClassLoader cl = accessor.getMember(i);
 825                                                         return cl == null ? null : FormatToolkit.getHumanReadable(cl);
 826                                                 }
 827                                         };
 828                                 }
 829                         });
 830         public static final IAttribute<String> PARENT_CLASSLOADER_STRING = Attribute
 831                         .canonicalize(new Attribute<String>("parentClassLoader.string", //$NON-NLS-1$
 832                                         Messages.getString(Messages.ATTR_PARENT_CLASSLOADER), null, PLAIN_TEXT) {
 833                                 @Override
 834                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 835                                         final IMemberAccessor<IMCClassLoader, U> accessor = PARENT_CLASSLOADER.getAccessor(type);
 836                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 837                                                 @Override
 838                                                 public String getMember(U i) {
 839                                                         IMCClassLoader cl = accessor.getMember(i);
 840                                                         return cl == null ? null : FormatToolkit.getHumanReadable(cl);
 841                                                 }
 842                                         };
 843                                 }
 844                         });
 845 
 846         public static final IAttribute<String> CLASSLOADER_STRING = Attribute
 847                         .canonicalize(new Attribute<String>("classLoader.string", //$NON-NLS-1$
 848                                         Messages.getString(Messages.ATTR_CLASSLOADER), null, PLAIN_TEXT) {
 849                                 @Override
 850                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 851                                         final IMemberAccessor<IMCClassLoader, U> accessor = CLASSLOADER.getAccessor(type);
 852                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 853                                                 @Override
 854                                                 public String getMember(U i) {
 855                                                         IMCClassLoader cl = accessor.getMember(i);
 856                                                         return cl == null ? null : FormatToolkit.getHumanReadable(cl);
 857                                                 }
 858                                         };
 859                                 }
 860                         });
 861 
 862         public static final IAttribute<IMCType> CLASS_LOADED = attr("loadedClass", //$NON-NLS-1$
 863                         Messages.getString(Messages.ATTR_CLASS_LOADED), CLASS);
 864         public static final IAttribute<IMCType> CLASS_UNLOADED = attr("unloadedClass", //$NON-NLS-1$
 865                         Messages.getString(Messages.ATTR_CLASS_UNLOADED), CLASS);
 866         public static final IAttribute<IMCType> CLASS_DEFINED = attr("definedClass", // $NON-NLS-1$
 867                         Messages.getString(Messages.ATTR_CLASS_DEFINED), CLASS);
 868         public static final IAttribute<IQuantity> ANONYMOUS_BLOCK_SIZE = attr("anonymousBlockSize", // $NON-NLS-1$
 869                         Messages.getString(Messages.ATTR_ANONYMOUS_BLOCK_SIZE), MEMORY);
 870         public static final IAttribute<IQuantity> ANONYMOUS_CHUNK_SIZE = attr("anonymousChunkSize", // $NON-NLS-1$ 
 871                         Messages.getString(Messages.ATTR_ANONYMOUS_CHUNK_SIZE), MEMORY);
 872         public static final IAttribute<IQuantity> ANONYMOUS_CLASS_COUNT = attr("anonymousClassCount", // $NON-NLS-1$
 873                         Messages.getString(Messages.ATTR_ANONYMOUS_CLASS_COUNT), NUMBER);
 874         public static final IAttribute<IQuantity> BLOCK_SIZE = attr("blockSize", // $NON-NLS-1$
 875                         Messages.getString(Messages.ATTR_BLOCK_SIZE), MEMORY);
 876         public static final IAttribute<IQuantity> CHUNK_SIZE = attr("chunkSize", // $NON-NLS-1$
 877                         Messages.getString(Messages.ATTR_CHUNK_SIZE), MEMORY);
 878         public static final IAttribute<IQuantity> CLASS_COUNT = attr("classCount", // $NON-NLS-1$
 879                         Messages.getString(Messages.ATTR_CLASS_COUNT), NUMBER);
 880         public static final IAttribute<IQuantity> CLASS_LOADER_DATA = attr("classLoaderData", // $NON-NLS-1$
 881                         Messages.getString(Messages.ATTR_CLASSLOADER_DATA), ADDRESS);   
 882 
 883         public static final IAttribute<IQuantity> COMPILER_COMPILATION_ID = attr("compileId", //$NON-NLS-1$
 884                         Messages.getString(Messages.ATTR_COMPILER_COMPILATION_ID), NUMBER);
 885         public static final IAttribute<IQuantity> COMPILER_CODE_SIZE = attr("codeSize", //$NON-NLS-1$
 886                         Messages.getString(Messages.ATTR_COMPILER_CODE_SIZE), MEMORY);
 887         public static final IAttribute<IQuantity> COMPILER_INLINED_SIZE = attr("inlinedBytes", //$NON-NLS-1$
 888                         Messages.getString(Messages.ATTR_COMPILER_INLINED_SIZE), MEMORY);
 889         public static final IAttribute<IMCMethod> COMPILER_METHOD = attr("method", //$NON-NLS-1$
 890                         Messages.getString(Messages.ATTR_COMPILER_METHOD), METHOD);
 891         public static final IAttribute<String> COMPILER_METHOD_STRING = Attribute.canonicalize(
 892                         new Attribute<String>("method.humanreadable", Messages.getString(Messages.ATTR_COMPILER_METHOD_HUMAN), //$NON-NLS-1$
 893                                         Messages.getString(Messages.ATTR_COMPILER_METHOD_HUMAN_DESC), PLAIN_TEXT) {
 894                                 @Override
 895                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
 896                                         final IMemberAccessor<IMCMethod, U> accessor = COMPILER_METHOD.getAccessor(type);
 897                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
 898                                                 @Override
 899                                                 public String getMember(U i) {
 900                                                         IMCMethod method = accessor.getMember(i);
 901                                                         return method == null ? null : FormatToolkit.getHumanReadable(method);
 902                                                 }
 903                                         };
 904                                 }
 905                         });
 906         public static final IAttribute<String> COMPILER_FAILED_MESSAGE = attr("failureMessage", //$NON-NLS-1$
 907                         Messages.getString(Messages.ATTR_COMPILER_FAILED_MESSAGE), PLAIN_TEXT);
 908         public static final IAttribute<IQuantity> COMPILER_STANDARD_COUNT = attr("standardCompileCount", //$NON-NLS-1$
 909                         Messages.getString(Messages.ATTR_COMPILER_STANDARD_COUNT), NUMBER);
 910         public static final IAttribute<IQuantity> COMPILER_OSR_COUNT = attr("osrCompileCount", //$NON-NLS-1$
 911                         Messages.getString(Messages.ATTR_COMPILER_OSR_COUNT), NUMBER);
 912         public static final IAttribute<IQuantity> COMPILER_COMPILATION_LEVEL = attr("compileLevel", //$NON-NLS-1$
 913                         Messages.getString(Messages.ATTR_COMPILER_COMPILATION_LEVEL), NUMBER);
 914         public static final IAttribute<Boolean> COMPILER_COMPILATION_SUCCEEDED = attr("succeded", //$NON-NLS-1$
 915                         Messages.getString(Messages.ATTR_COMPILER_COMPILATION_SUCCEEDED), FLAG);
 916         public static final IAttribute<Boolean> COMPILER_IS_OSR = attr("isOsr", //$NON-NLS-1$
 917                         Messages.getString(Messages.ATTR_COMPILER_IS_OSR), FLAG);
 918 
 919         public static final IAttribute<IQuantity> START_ADDRESS = attr("startAddress", //$NON-NLS-1$
 920                         Messages.getString(Messages.ATTR_START_ADDRESS), ADDRESS);
 921         public static final IAttribute<IQuantity> COMMITTED_TOP = attr("commitedTopAddress", //$NON-NLS-1$
 922                         Messages.getString(Messages.ATTR_COMMITTED_TOP), ADDRESS);
 923         public static final IAttribute<IQuantity> RESERVED_TOP = attr("reservedTopAddress", //$NON-NLS-1$
 924                         Messages.getString(Messages.ATTR_RESERVED_TOP), ADDRESS);
 925         public static final IAttribute<IQuantity> ENTRIES = attr("entryCount", Messages.getString(Messages.ATTR_ENTRIES), //$NON-NLS-1$
 926                         NUMBER);
 927         public static final IAttribute<IQuantity> METHODS = attr("methodCount", Messages.getString(Messages.ATTR_METHODS), //$NON-NLS-1$
 928                         NUMBER);
 929         public static final IAttribute<IQuantity> ADAPTORS = attr("adaptorCount", //$NON-NLS-1$
 930                         Messages.getString(Messages.ATTR_ADAPTORS), NUMBER);
 931         public static final IAttribute<IQuantity> FULL_COUNT = attr("fullCount", //$NON-NLS-1$
 932                         Messages.getString(Messages.ATTR_FULL_COUNT), NUMBER);
 933         public static final IAttribute<IQuantity> UNALLOCATED = attr("unallocatedCapacity", //$NON-NLS-1$
 934                         Messages.getString(Messages.ATTR_UNALLOCATED), MEMORY);
 935 
 936         private static final String CODE_HEAP_NON_NMETHODS = "CodeHeap 'non-nmethods'"; //$NON-NLS-1$
 937         private static final String CODE_HEAP_NON_PROFILED_NMETHODS = "CodeHeap 'non-profiled nmethods'"; //$NON-NLS-1$
 938         private static final String CODE_HEAP_PROFILED_NMETHODS = "CodeHeap 'profiled nmethods'"; //$NON-NLS-1$
 939 
 940         public static final IAttribute<IQuantity> PROFILED_UNALLOCATED = Attribute
 941                         .canonicalize(createCodeHeapAttribute(UNALLOCATED, CODE_HEAP_PROFILED_NMETHODS, "profiledUnallocated", //$NON-NLS-1$
 942                                         Messages.getString(Messages.ATTR_PROFILED_NMETHODS_UNALLOCATED),
 943                                         Messages.getString(Messages.ATTR_PROFILED_NMETHODS_UNALLOCATED_DESCRIPTION), MEMORY));
 944         public static final IAttribute<IQuantity> PROFILED_ENTRIES = Attribute
 945                         .canonicalize(createCodeHeapAttribute(ENTRIES, CODE_HEAP_PROFILED_NMETHODS, "profiledEntries", //$NON-NLS-1$
 946                                         Messages.getString(Messages.ATTR_PROFILED_NMETHODS_ENTRIES),
 947                                         Messages.getString(Messages.ATTR_PROFILED_NMETHODS_ENTRIES_DESCRIPTION), NUMBER));
 948         public static final IAttribute<IQuantity> PROFILED_METHODS = Attribute
 949                         .canonicalize(createCodeHeapAttribute(METHODS, CODE_HEAP_PROFILED_NMETHODS, "profiledMethods", //$NON-NLS-1$
 950                                         Messages.getString(Messages.ATTR_PROFILED_NMETHODS_METHODS),
 951                                         Messages.getString(Messages.ATTR_PROFILED_NMETHODS_METHODS_DESCRIPTION), NUMBER));
 952         public static final IAttribute<IQuantity> NON_PROFILED_NMETHODS_UNALLOCATED = Attribute
 953                         .canonicalize(createCodeHeapAttribute(UNALLOCATED, CODE_HEAP_NON_PROFILED_NMETHODS,
 954                                         "nonProfiledUnallocated", Messages.getString(Messages.ATTR_NON_PROFILED_NMETHODS_UNALLOCATED), //$NON-NLS-1$
 955                                         Messages.getString(Messages.ATTR_NON_PROFILED_NMETHODS_UNALLOCATED_DESCRIPTION), MEMORY));
 956         public static final IAttribute<IQuantity> NON_PROFILED_NMETHODS_ENTRIES = Attribute
 957                         .canonicalize(createCodeHeapAttribute(ENTRIES, CODE_HEAP_NON_PROFILED_NMETHODS, "nonProfiledEntries", //$NON-NLS-1$
 958                                         Messages.getString(Messages.ATTR_NON_PROFILED_NMETHODS_ENTRIES),
 959                                         Messages.getString(Messages.ATTR_NON_PROFILED_NMETHODS_ENTRIES_DESCRIPTION), NUMBER));
 960         public static final IAttribute<IQuantity> NON_PROFILED_METHODS = Attribute
 961                         .canonicalize(createCodeHeapAttribute(METHODS, CODE_HEAP_NON_PROFILED_NMETHODS, "nonProfiledMethods", //$NON-NLS-1$
 962                                         Messages.getString(Messages.ATTR_NON_PROFILED_NMETHODS_METHODS),
 963                                         Messages.getString(Messages.ATTR_NON_PROFILED_NMETHODS_METHODS_DESCRIPTION), NUMBER));
 964         public static final IAttribute<IQuantity> NON_NMETHODS_UNALLOCATED = Attribute
 965                         .canonicalize(createCodeHeapAttribute(UNALLOCATED, CODE_HEAP_NON_NMETHODS, "nonNmethodsUnallocated", //$NON-NLS-1$
 966                                         Messages.getString(Messages.ATTR_NON_NMETHODS_UNALLOCATED),
 967                                         Messages.getString(Messages.ATTR_NON_NMETHODS_UNALLOCATED_DESCRIPTION), MEMORY));
 968         public static final IAttribute<IQuantity> NON_NMETHODS_ENTRIES = Attribute
 969                         .canonicalize(createCodeHeapAttribute(ENTRIES, CODE_HEAP_NON_NMETHODS, "nonNmethodsEntries", //$NON-NLS-1$
 970                                         Messages.getString(Messages.ATTR_NON_NMETHODS_ENTRIES),
 971                                         Messages.getString(Messages.ATTR_NON_NMETHODS_ENTRIES_DESCRIPTION), NUMBER));
 972         public static final IAttribute<IQuantity> NON_NMETHODS_ADAPTORS = Attribute
 973                         .canonicalize(createCodeHeapAttribute(ADAPTORS, CODE_HEAP_NON_NMETHODS, "nonNmethodsAdaptors", //$NON-NLS-1$
 974                                         Messages.getString(Messages.ATTR_NON_NMETHODS_ADAPTORS),
 975                                         Messages.getString(Messages.ATTR_NON_NMETHODS_ADAPTORS_DESCRIPTION), NUMBER));
 976 
 977         /**
 978          * Workaround for badly constructed JDK 9 segmented code cache events. Creates a synthetic
 979          * attributes for specific code heaps.
 980          *
 981          * @param attribute
 982          *            the attribute to convert
 983          * @param codeHeap
 984          *            the code heap for the new attribute to be for
 985          * @param identifier
 986          *            the identifier of the new attribute
 987          * @param name
 988          *            the name of the new attribute
 989          * @param description
 990          *            the description of the new attribute
 991          * @param contentType
 992          *            the content type of the new attribute
 993          * @return the wrapped attribute for the specified code heap and attribute
 994          */
 995         private static Attribute<IQuantity> createCodeHeapAttribute(
 996                 final IAttribute<IQuantity> attribute, final String codeHeap, String identifier, String name,
 997                 String description, ContentType<IQuantity> contentType) {
 998                 return new Attribute<IQuantity>(identifier, name, description, contentType) {
 999                         @Override
1000                         public <U> IMemberAccessor<IQuantity, U> customAccessor(IType<U> type) {
1001                                 final IMemberAccessor<IQuantity, U> attributeAccessor = attribute.getAccessor(type);
1002                                 final IMemberAccessor<String, U> codeHeapAccessor = CODE_HEAP.getAccessor(type);
1003                                 return attributeAccessor == null || codeHeapAccessor == null ? null
1004                                                 : new IMemberAccessor<IQuantity, U>() {
1005                                                         @Override
1006                                                         public IQuantity getMember(U i) {
1007                                                                 return codeHeapAccessor.getMember(i).equals(codeHeap) ? attributeAccessor.getMember(i)
1008                                                                                 : null;
1009                                                         }
1010                                                 };
1011                         }
1012                 };
1013         }
1014 
1015         public static final IAttribute<String> CODE_HEAP = attr("codeBlobType", Messages.getString(Messages.ATTR_CODE_HEAP), //$NON-NLS-1$
1016                         PLAIN_TEXT);
1017 
1018         public static final IAttribute<IQuantity> SWEEP_INDEX = attr("sweepId", //$NON-NLS-1$
1019                         Messages.getString(Messages.ATTR_SWEEP_INDEX), NUMBER);
1020         public static final IAttribute<IQuantity> SWEEP_FRACTION_INDEX = attr("sweepFractionIndex", //$NON-NLS-1$
1021                         Messages.getString(Messages.ATTR_SWEEP_FRACTION_INDEX), NUMBER);
1022         public static final IAttribute<IQuantity> SWEEP_METHOD_SWEPT = attr("sweptCount", //$NON-NLS-1$
1023                         Messages.getString(Messages.ATTR_SWEEP_METHOD_SWEPT), NUMBER);
1024         public static final IAttribute<IQuantity> SWEEP_METHOD_FLUSHED = attr("flushedCount", //$NON-NLS-1$
1025                         Messages.getString(Messages.ATTR_SWEEP_METHOD_FLUSHED), NUMBER);
1026         public static final IAttribute<IQuantity> SWEEP_METHOD_RECLAIMED = attr("markedCount", //$NON-NLS-1$
1027                         Messages.getString(Messages.ATTR_SWEEP_METHOD_RECLAIMED), NUMBER);
1028         public static final IAttribute<IQuantity> SWEEP_METHOD_ZOMBIFIED = attr("zombifiedCount", //$NON-NLS-1$
1029                         Messages.getString(Messages.ATTR_SWEEP_METHOD_ZOMBIFIED), NUMBER);
1030 
1031         public static final IAttribute<IQuantity> INITIAL_SIZE = attr("initialSize", //$NON-NLS-1$
1032                         Messages.getString(Messages.ATTR_INITIAL_SIZE), MEMORY);
1033         public static final IAttribute<IQuantity> RESERVED_SIZE = attr("reservedSize", //$NON-NLS-1$
1034                         Messages.getString(Messages.ATTR_RESERVED_SIZE), MEMORY);
1035         public static final IAttribute<IQuantity> EXPANSION_SIZE = attr("expansionSize", //$NON-NLS-1$
1036                         Messages.getString(Messages.ATTR_EXPANSION_SIZE), MEMORY);
1037         public static final IAttribute<IQuantity> NON_PROFILED_SIZE = attr("nonProfiledSize", //$NON-NLS-1$
1038                         Messages.getString(Messages.ATTR_NON_PROFILED_SIZE), MEMORY);
1039         public static final IAttribute<IQuantity> PROFILED_SIZE = attr("profiledSize", //$NON-NLS-1$
1040                         Messages.getString(Messages.ATTR_PROFILED_SIZE), MEMORY);
1041         public static final IAttribute<IQuantity> NON_NMETHOD_SIZE = attr("nonNMethodSize", //$NON-NLS-1$
1042                         Messages.getString(Messages.ATTR_NON_NMETHOD_SIZE), MEMORY);
1043 
1044         public static final IAttribute<String> ENVIRONMENT_KEY = attr("key", //$NON-NLS-1$
1045                         Messages.getString(Messages.ATTR_ENVIRONMENT_KEY), PLAIN_TEXT);
1046         public static final IAttribute<String> ENVIRONMENT_VALUE = attr("value", //$NON-NLS-1$
1047                         Messages.getString(Messages.ATTR_ENVIRONMENT_VALUE), PLAIN_TEXT);
1048 
1049         public static final IAttribute<IQuantity> EXCEPTION_THROWABLES_COUNT = attr("throwables", //$NON-NLS-1$
1050                         Messages.getString(Messages.ATTR_EXCEPTION_THROWABLES_COUNT),
1051                         Messages.getString(Messages.ATTR_EXCEPTION_THROWABLES_COUNT_DESC), NUMBER);
1052         public static final IAttribute<IMCType> EXCEPTION_THROWNCLASS = attr("thrownClass", //$NON-NLS-1$
1053                         Messages.getString(Messages.ATTR_EXCEPTION_THROWNCLASS), CLASS);
1054         public static final IAttribute<String> EXCEPTION_THROWNCLASS_NAME = Attribute.canonicalize(
1055                         new Attribute<String>("thrownClassName", Messages.getString(Messages.ATTR_EXCEPTION_THROWNCLASS_NAME), //$NON-NLS-1$
1056                                         Messages.getString(Messages.ATTR_EXCEPTION_THROWNCLASS_NAME_DESC), PLAIN_TEXT) {
1057                                 @Override
1058                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
1059                                         final IMemberAccessor<IMCType, U> accessor = EXCEPTION_THROWNCLASS.getAccessor(type);
1060                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
1061                                                 @Override
1062                                                 public String getMember(U i) {
1063                                                         IMCType type = accessor.getMember(i);
1064                                                         return type == null ? null : type.getFullName();
1065                                                 }
1066                                         };
1067                                 }
1068                         });
1069 
1070         public static final IAttribute<String> EXCEPTION_MESSAGE = attr("message", //$NON-NLS-1$
1071                         Messages.getString(Messages.ATTR_EXCEPTION_MESSAGE), PLAIN_TEXT);
1072 
1073         public static final IAttribute<IQuantity> MONITOR_ADDRESS = attr("address", //$NON-NLS-1$
1074                         Messages.getString(Messages.ATTR_MONITOR_ADDRESS), ADDRESS);
1075         public static final IAttribute<IMCType> MONITOR_CLASS = attr("monitorClass", //$NON-NLS-1$
1076                         Messages.getString(Messages.ATTR_MONITOR_CLASS), CLASS);
1077         public static final IAttribute<IMCThread> MONITOR_PREVIOUS_OWNER = attr("previousOwner", //$NON-NLS-1$
1078                         Messages.getString(Messages.ATTR_MONITOR_PREVIOUS_OWNER), THREAD);
1079 
1080         public static final IAttribute<IQuantity> OS_SWITCH_RATE = attr("switchRate", //$NON-NLS-1$
1081                         Messages.getString(Messages.ATTR_OS_SWITCH_RATE), NUMBER);
1082         public static final IAttribute<String> REFERENCE_STATISTICS_TYPE = attr("type", //$NON-NLS-1$
1083                         Messages.getString(Messages.ATTR_REFERENCE_STATISTICS_TYPE), PLAIN_TEXT);
1084         public static final IAttribute<IQuantity> REFERENCE_STATISTICS_COUNT = attr("count", //$NON-NLS-1$
1085                         Messages.getString(Messages.ATTR_REFERENCE_STATISTICS_COUNT), NUMBER);
1086         public static final IAttribute<IQuantity> GC_SUM_OF_PAUSES = attr("sumOfPauses", //$NON-NLS-1$
1087                         Messages.getString(Messages.ATTR_GC_SUM_OF_PAUSES), Messages.getString(Messages.ATTR_GC_SUM_OF_PAUSES_DESC),
1088                         TIMESPAN);
1089         public static final IAttribute<IQuantity> GC_LONGEST_PAUSE = attr("longestPause", //$NON-NLS-1$
1090                         Messages.getString(Messages.ATTR_GC_LONGEST_PAUSE), Messages.getString(Messages.ATTR_GC_LONGEST_PAUSE_DESC),
1091                         TIMESPAN);
1092         public static final IAttribute<String> GC_NAME = attr("name", Messages.getString(Messages.ATTR_GC_NAME), //$NON-NLS-1$
1093                         Messages.getString(Messages.ATTR_GC_NAME_DESC), PLAIN_TEXT);
1094         public static final IAttribute<String> GC_CAUSE = attr("cause", Messages.getString(Messages.ATTR_GC_CAUSE), //$NON-NLS-1$
1095                         Messages.getString(Messages.ATTR_GC_CAUSE_DESC), PLAIN_TEXT);
1096 
1097         public static final IAttribute<IMCOldObject> OBJECT = attr("object", Messages.getString(Messages.ATTR_REFERRER), //$NON-NLS-1$
1098                         Messages.getString(Messages.ATTR_REFERRER_DESC), OLD_OBJECT);
1099         public static final IAttribute<IQuantity> ALLOCATION_TIME = attr("allocationTime", //$NON-NLS-1$
1100                         Messages.getString(Messages.ATTR_REFERRER), Messages.getString(Messages.ATTR_REFERRER_DESC), TIMESTAMP);
1101         public static final IAttribute<IMCOldObjectGcRoot> GC_ROOT = attr("root", Messages.getString(Messages.ATTR_GC_ROOT), //$NON-NLS-1$
1102                         Messages.getString(Messages.ATTR_GC_ROOT_DESC), UnitLookup.OLD_OBJECT_GC_ROOT);
1103         public static final IAttribute<IMCType> OLD_OBJECT_CLASS = Attribute
1104                         .canonicalize(new Attribute<IMCType>("oldObjectClass", Messages.getString(Messages.ATTR_OLD_OBJECT_CLASS), //$NON-NLS-1$
1105                                         Messages.getString(Messages.ATTR_OLD_OBJECT_CLASS_DESC), CLASS) {
1106                                 @Override
1107                                 public <U> IMemberAccessor<IMCType, U> customAccessor(IType<U> type) {
1108                                         final IMemberAccessor<IMCOldObject, U> accessor = OBJECT.getAccessor(type);
1109                                         return accessor == null ? null : new IMemberAccessor<IMCType, U>() {
1110                                                 @Override
1111                                                 public IMCType getMember(U i) {
1112                                                         IMCOldObject object = accessor.getMember(i);
1113                                                         return object == null ? null : object.getType();
1114                                                 }
1115                                         };
1116                                 }
1117                         });
1118         public static final IAttribute<String> OLD_OBJECT_DESCRIPTION = Attribute.canonicalize(
1119                         new Attribute<String>("oldObjectDescription", Messages.getString(Messages.ATTR_OLD_OBJECT_DESCRIPTION), //$NON-NLS-1$
1120                                         Messages.getString(Messages.ATTR_OLD_OBJECT_DESCRIPTION_DESC), PLAIN_TEXT) {
1121                                 @Override
1122                                 public <U> IMemberAccessor<String, U> customAccessor(IType<U> type) {
1123                                         final IMemberAccessor<IMCOldObject, U> accessor = OBJECT.getAccessor(type);
1124                                         return accessor == null ? null : new IMemberAccessor<String, U>() {
1125                                                 @Override
1126                                                 public String getMember(U i) {
1127                                                         IMCOldObject object = accessor.getMember(i);
1128                                                         return object == null ? null : object.getDescription();
1129                                                 }
1130                                         };
1131                                 }
1132                         });
1133         public static final IAttribute<Long> OLD_OBJECT_ARRAY_SIZE = Attribute.canonicalize(
1134                         new Attribute<Long>("oldObjectArraySize", Messages.getString(Messages.ATTR_OLD_OBJECT_ARRAY_SIZE), //$NON-NLS-1$
1135                                         Messages.getString(Messages.ATTR_OLD_OBJECT_ARRAY_SIZE_DESC), UnitLookup.RAW_LONG) {
1136                                 @Override
1137                                 public <U> IMemberAccessor<Long, U> customAccessor(IType<U> type) {
1138                                         final IMemberAccessor<IMCOldObject, U> accessor = OBJECT.getAccessor(type);
1139                                         return accessor == null ? null : new IMemberAccessor<Long, U>() {
1140                                                 @Override
1141                                                 public Long getMember(U i) {
1142                                                         IMCOldObject object = accessor.getMember(i);
1143                                                         return object != null && object.getReferrerArray() != null
1144                                                                         ? object.getReferrerArray().getSize() : null;
1145                                                 }
1146                                         };
1147                                 }
1148                         });
1149         public static final IAttribute<IQuantity> OLD_OBJECT_ADDRESS = Attribute.canonicalize(
1150                         new Attribute<IQuantity>("oldObjectAddress", Messages.getString(Messages.ATTR_OLD_OBJECT_ADDRESS), //$NON-NLS-1$
1151                                         Messages.getString(Messages.ATTR_OLD_OBJECT_ADDRESS_DESC), ADDRESS) {
1152                                 @Override
1153                                 public <U> IMemberAccessor<IQuantity, U> customAccessor(IType<U> type) {
1154                                         final IMemberAccessor<IMCOldObject, U> accessor = OBJECT.getAccessor(type);
1155                                         return accessor == null ? null : new IMemberAccessor<IQuantity, U>() {
1156                                                 @Override
1157                                                 public IQuantity getMember(U i) {
1158                                                         IMCOldObject object = accessor.getMember(i);
1159                                                         return object == null ? null : object.getAddress();
1160                                                 }
1161                                         };
1162                                 }
1163                         });
1164 
1165         public static final IAttribute<String> OS_VERSION = attr("osVersion", Messages.getString(Messages.ATTR_OS_VERSION), //$NON-NLS-1$
1166                         PLAIN_TEXT);
1167         public static final IAttribute<IQuantity> NUMBER_OF_SOCKETS = attr("sockets", //$NON-NLS-1$
1168                         Messages.getString(Messages.ATTR_NUMBER_OF_SOCKETS),
1169                         Messages.getString(Messages.ATTR_NUMBER_OF_SOCKETS_DESC), NUMBER);
1170         public static final IAttribute<String> CPU_DESCRIPTION = attr("description", //$NON-NLS-1$
1171                         Messages.getString(Messages.ATTR_CPU_DESCRIPTION), Messages.getString(Messages.ATTR_CPU_DESCRIPTION_DESC),
1172                         PLAIN_TEXT);
1173         public static final IAttribute<String> CPU_TYPE = attr("cpu", Messages.getString(Messages.ATTR_CPU_TYPE), //$NON-NLS-1$
1174                         PLAIN_TEXT);
1175         public static final IAttribute<IQuantity> NUMBER_OF_CORES = attr("cores", //$NON-NLS-1$
1176                         Messages.getString(Messages.ATTR_NUMBER_OF_CORES), Messages.getString(Messages.ATTR_NUMBER_OF_CORES_DESC),
1177                         NUMBER);
1178         public static final IAttribute<Boolean> BLOCKING = attr("blocking", Messages.getString(Messages.ATTR_BLOCKING), //$NON-NLS-1$
1179                         Messages.getString(Messages.ATTR_BLOCKING_DESC), FLAG);
1180         public static final IAttribute<Boolean> SAFEPOINT = attr("safepoint", Messages.getString(Messages.ATTR_SAFEPOINT), //$NON-NLS-1$
1181                         Messages.getString(Messages.ATTR_SAFEPOINT_DESC), FLAG);
1182         public static final IAttribute<String> OPERATION = attr("operation", Messages.getString(Messages.ATTR_OPERATION), //$NON-NLS-1$
1183                         Messages.getString(Messages.ATTR_OPERATION_DESC), PLAIN_TEXT);
1184         public static final IAttribute<IMCThread> CALLER = attr("caller", Messages.getString(Messages.ATTR_CALLER), //$NON-NLS-1$
1185                         Messages.getString(Messages.ATTR_CALLER_DESC), THREAD);
1186         public static final IAttribute<IMCType> BIASED_REVOCATION_LOCK_CLASS = attr("lockClass", //$NON-NLS-1$
1187                         Messages.getString(Messages.ATTR_REVOKATION_LOCK_CLASS),
1188                         Messages.getString(Messages.ATTR_REVOKATION_LOCK_CLASS_DESC), CLASS);
1189         public static final IAttribute<IMCType> BIASED_REVOCATION_CLASS = attr("revokedClass", //$NON-NLS-1$
1190                         Messages.getString(Messages.ATTR_REVOKED_CLASS), Messages.getString(Messages.ATTR_REVOKED_CLASS_DESC),
1191                         CLASS);
1192         public static final IAttribute<Boolean> BIASED_REVOCATION_DISABLE_BIASING = attr("disableBiasing", //$NON-NLS-1$
1193                         Messages.getString(Messages.ATTR_DISABLE_BIASING), FLAG);
1194 }