src/share/vm/services/threadService.cpp

changeset 2423
b1a2afa37ec4
parent 2314
f95d63e2154a
child 2497
3582bf76420e
     1.1 --- a/src/share/vm/services/threadService.cpp	Fri Jan 07 03:38:19 2011 -0800
     1.2 +++ b/src/share/vm/services/threadService.cpp	Fri Jan 07 10:42:32 2011 -0500
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -46,6 +46,7 @@
    1.11  // Default is disabled.
    1.12  bool ThreadService::_thread_monitoring_contention_enabled = false;
    1.13  bool ThreadService::_thread_cpu_time_enabled = false;
    1.14 +bool ThreadService::_thread_allocated_memory_enabled = false;
    1.15  
    1.16  PerfCounter*  ThreadService::_total_threads_count = NULL;
    1.17  PerfVariable* ThreadService::_live_threads_count = NULL;
    1.18 @@ -84,6 +85,8 @@
    1.19    if (os::is_thread_cpu_time_supported()) {
    1.20      _thread_cpu_time_enabled = true;
    1.21    }
    1.22 +
    1.23 +  _thread_allocated_memory_enabled = true; // Always on, so enable it
    1.24  }
    1.25  
    1.26  void ThreadService::reset_peak_thread_count() {
    1.27 @@ -181,6 +184,15 @@
    1.28    return prev;
    1.29  }
    1.30  
    1.31 +bool ThreadService::set_thread_allocated_memory_enabled(bool flag) {
    1.32 +  MutexLocker m(Management_lock);
    1.33 +
    1.34 +  bool prev = _thread_allocated_memory_enabled;
    1.35 +  _thread_allocated_memory_enabled = flag;
    1.36 +
    1.37 +  return prev;
    1.38 +}
    1.39 +
    1.40  // GC support
    1.41  void ThreadService::oops_do(OopClosure* f) {
    1.42    for (ThreadDumpResult* dump = _threaddump_list; dump != NULL; dump = dump->next()) {

mercurial