src/share/vm/services/threadService.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2009, 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  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_threadService.cpp.incl"












  27 
  28 // TODO: we need to define a naming convention for perf counters
  29 // to distinguish counters for:
  30 //   - standard JSR174 use
  31 //   - Hotspot extension (public and committed)
  32 //   - Hotspot extension (private/internal and uncommitted)
  33 
  34 // Default is disabled.
  35 bool ThreadService::_thread_monitoring_contention_enabled = false;
  36 bool ThreadService::_thread_cpu_time_enabled = false;
  37 
  38 PerfCounter*  ThreadService::_total_threads_count = NULL;
  39 PerfVariable* ThreadService::_live_threads_count = NULL;
  40 PerfVariable* ThreadService::_peak_threads_count = NULL;
  41 PerfVariable* ThreadService::_daemon_threads_count = NULL;
  42 volatile int ThreadService::_exiting_threads_count = 0;
  43 volatile int ThreadService::_exiting_daemon_threads_count = 0;
  44 
  45 ThreadDumpResult* ThreadService::_threaddump_list = NULL;
  46 


   1 /*
   2  * Copyright (c) 2003, 2010, 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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "memory/allocation.hpp"
  28 #include "memory/heapInspection.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "oops/instanceKlass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/init.hpp"
  34 #include "runtime/thread.hpp"
  35 #include "runtime/vframe.hpp"
  36 #include "runtime/vmThread.hpp"
  37 #include "runtime/vm_operations.hpp"
  38 #include "services/threadService.hpp"
  39 
  40 // TODO: we need to define a naming convention for perf counters
  41 // to distinguish counters for:
  42 //   - standard JSR174 use
  43 //   - Hotspot extension (public and committed)
  44 //   - Hotspot extension (private/internal and uncommitted)
  45 
  46 // Default is disabled.
  47 bool ThreadService::_thread_monitoring_contention_enabled = false;
  48 bool ThreadService::_thread_cpu_time_enabled = false;
  49 
  50 PerfCounter*  ThreadService::_total_threads_count = NULL;
  51 PerfVariable* ThreadService::_live_threads_count = NULL;
  52 PerfVariable* ThreadService::_peak_threads_count = NULL;
  53 PerfVariable* ThreadService::_daemon_threads_count = NULL;
  54 volatile int ThreadService::_exiting_threads_count = 0;
  55 volatile int ThreadService::_exiting_daemon_threads_count = 0;
  56 
  57 ThreadDumpResult* ThreadService::_threaddump_list = NULL;
  58