comparison src/share/vm/services/threadService.hpp @ 2100:b1a2afa37ec4

7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis Summary: Track allocated bytes in Thread's, update on TLAB retirement and direct allocation in Eden and tenured, add JNI methods for ThreadMXBean. Reviewed-by: coleenp, kvn, dholmes, ysr
author phh
date Fri, 07 Jan 2011 10:42:32 -0500
parents f95d63e2154a
children d2a62e0f25eb
comparison
equal deleted inserted replaced
2097:039eb4201e06 2100:b1a2afa37ec4
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
63 static volatile int _exiting_threads_count; 63 static volatile int _exiting_threads_count;
64 static volatile int _exiting_daemon_threads_count; 64 static volatile int _exiting_daemon_threads_count;
65 65
66 static bool _thread_monitoring_contention_enabled; 66 static bool _thread_monitoring_contention_enabled;
67 static bool _thread_cpu_time_enabled; 67 static bool _thread_cpu_time_enabled;
68 static bool _thread_allocated_memory_enabled;
68 69
69 // Need to keep the list of thread dump result that 70 // Need to keep the list of thread dump result that
70 // keep references to methodOop since thread dump can be 71 // keep references to methodOop since thread dump can be
71 // requested by multiple threads concurrently. 72 // requested by multiple threads concurrently.
72 static ThreadDumpResult* _threaddump_list; 73 static ThreadDumpResult* _threaddump_list;
80 static bool set_thread_monitoring_contention(bool flag); 81 static bool set_thread_monitoring_contention(bool flag);
81 static bool is_thread_monitoring_contention() { return _thread_monitoring_contention_enabled; } 82 static bool is_thread_monitoring_contention() { return _thread_monitoring_contention_enabled; }
82 83
83 static bool set_thread_cpu_time_enabled(bool flag); 84 static bool set_thread_cpu_time_enabled(bool flag);
84 static bool is_thread_cpu_time_enabled() { return _thread_cpu_time_enabled; } 85 static bool is_thread_cpu_time_enabled() { return _thread_cpu_time_enabled; }
86
87 static bool set_thread_allocated_memory_enabled(bool flag);
88 static bool is_thread_allocated_memory_enabled() { return _thread_cpu_time_enabled; }
85 89
86 static jlong get_total_thread_count() { return _total_threads_count->get_value(); } 90 static jlong get_total_thread_count() { return _total_threads_count->get_value(); }
87 static jlong get_peak_thread_count() { return _peak_threads_count->get_value(); } 91 static jlong get_peak_thread_count() { return _peak_threads_count->get_value(); }
88 static jlong get_live_thread_count() { return _live_threads_count->get_value() - _exiting_threads_count; } 92 static jlong get_live_thread_count() { return _live_threads_count->get_value() - _exiting_threads_count; }
89 static jlong get_daemon_thread_count() { return _daemon_threads_count->get_value() - _exiting_daemon_threads_count; } 93 static jlong get_daemon_thread_count() { return _daemon_threads_count->get_value() - _exiting_daemon_threads_count; }