1 /*
   2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.internal;
  27 
  28 /* Mapped against c++ enum in jfrLogTagSet.hpp */
  29 public enum LogTag {
  30     /**
  31      * Covers
  32      * <ul>
  33      * <li>Initialization of Flight Recorder
  34      * <li> recording life cycle (start, stop and dump)
  35      * <li> repository life cycle
  36      * <li>loading of configuration files.
  37      * </ul>
  38      * Target audience: operations
  39      */
  40     JFR(0),
  41     /**
  42      * Covers general implementation aspects of JFR (for Hotspot developers)
  43      */
  44     JFR_SYSTEM(1),
  45     /**
  46      * Covers JVM/JDK events (for Hotspot developers)
  47      */
  48     JFR_SYSTEM_EVENT(2),
  49     /**
  50      * Covers setting for the JVM/JDK  (for Hotspot developers)
  51      */
  52     JFR_SYSTEM_SETTING(3),
  53     /**
  54      * Covers generated bytecode (for Hotspot developers)
  55      */
  56     JFR_SYSTEM_BYTECODE(4),
  57     /**
  58      * Covers XML parsing (for Hotspot developers)
  59      */
  60     JFR_SYSTEM_PARSER(5),
  61     /**
  62      * Covers metadata for JVM/JDK (for Hotspot developers)
  63      */
  64     JFR_SYSTEM_METADATA(6),
  65     /**
  66      *  Covers metadata for Java user (for Hotspot developers)
  67      */
  68     JFR_METADATA(7),
  69     /**
  70      * Covers events (for users of the JDK)
  71      */
  72     JFR_EVENT(8),
  73     /**
  74      * Covers setting (for users of the JDK)
  75      */
  76     JFR_SETTING(9);
  77     /* set from native side */
  78     private volatile int tagSetLevel = 100; // prevent logging if JVM log system has not been initialized
  79 
  80     final int id;
  81 
  82     LogTag(int tagId) {
  83         id = tagId;
  84     }
  85 
  86     public boolean shouldLog(int level) {
  87         return level >= tagSetLevel;
  88     }
  89 }