src/share/vm/jfr/recorder/checkpoint/types/jfrThreadState.cpp

Mon, 19 Aug 2019 12:47:38 +0200

author
shade
date
Mon, 19 Aug 2019 12:47:38 +0200
changeset 9862
f162232da105
parent 9858
b985cbb00e68
permissions
-rw-r--r--

8229873: 8229401 broke jdk8u-jfr-incubator
Reviewed-by: neugens

     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.
     8 *
     9 * This code is distributed in the hope that it will be useful, but WITHOUT
    10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 * version 2 for more details (a copy is included in the LICENSE file that
    13 * accompanied this code).
    14 *
    15 * You should have received a copy of the GNU General Public License version
    16 * 2 along with this work; if not, write to the Free Software Foundation,
    17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 *
    19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20 * or visit www.oracle.com if you need additional information or have any
    21 * questions.
    22 *
    23 */
    25 #include "precompiled.hpp"
    26 #include "jfr/recorder/checkpoint/types/jfrThreadState.hpp"
    27 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp"
    28 #include "jvmtifiles/jvmti.h"
    30 struct jvmti_thread_state {
    31   u8 id;
    32   const char* description;
    33 };
    35 static jvmti_thread_state states[] = {
    36   {
    37     JVMTI_JAVA_LANG_THREAD_STATE_NEW,
    38     "STATE_NEW"
    39   },
    40   {
    41     JVMTI_THREAD_STATE_TERMINATED,
    42     "STATE_TERMINATED"
    43   },
    44   {
    45     JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE,
    46     "STATE_RUNNABLE"
    47   },
    48   {
    49     (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT | JVMTI_THREAD_STATE_SLEEPING),
    50     "STATE_SLEEPING"
    51   },
    52   {
    53     (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_IN_OBJECT_WAIT),
    54     "STATE_IN_OBJECT_WAIT"
    55   },
    56   {
    57     (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT | JVMTI_THREAD_STATE_IN_OBJECT_WAIT),
    58     "STATE_IN_OBJECT_WAIT_TIMED"
    59   },
    60   {
    61     (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_PARKED),
    62     "STATE_PARKED"
    63   },
    64   {
    65     (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT | JVMTI_THREAD_STATE_PARKED),
    66     "STATE_PARKED_TIMED"
    67   },
    68   {
    69     JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED,
    70     "STATE_BLOCKED_ON_MONITOR_ENTER"
    71   }
    72 };
    74 void JfrThreadState::serialize(JfrCheckpointWriter& writer) {
    75   const u4 number_of_states = sizeof(states) / sizeof(jvmti_thread_state);
    76   writer.write_count(number_of_states);
    77   for (u4 i = 0; i < number_of_states; ++i) {
    78     writer.write_key(states[i].id);
    79     writer.write(states[i].description);
    80   }
    81 }

mercurial