Mercurial > hg > truffle
diff src/share/vm/services/threadService.cpp @ 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 | 3582bf76420e |
line wrap: on
line diff
--- a/src/share/vm/services/threadService.cpp Fri Jan 07 03:38:19 2011 -0800 +++ b/src/share/vm/services/threadService.cpp Fri Jan 07 10:42:32 2011 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,6 +46,7 @@ // Default is disabled. bool ThreadService::_thread_monitoring_contention_enabled = false; bool ThreadService::_thread_cpu_time_enabled = false; +bool ThreadService::_thread_allocated_memory_enabled = false; PerfCounter* ThreadService::_total_threads_count = NULL; PerfVariable* ThreadService::_live_threads_count = NULL; @@ -84,6 +85,8 @@ if (os::is_thread_cpu_time_supported()) { _thread_cpu_time_enabled = true; } + + _thread_allocated_memory_enabled = true; // Always on, so enable it } void ThreadService::reset_peak_thread_count() { @@ -181,6 +184,15 @@ return prev; } +bool ThreadService::set_thread_allocated_memory_enabled(bool flag) { + MutexLocker m(Management_lock); + + bool prev = _thread_allocated_memory_enabled; + _thread_allocated_memory_enabled = flag; + + return prev; +} + // GC support void ThreadService::oops_do(OopClosure* f) { for (ThreadDumpResult* dump = _threaddump_list; dump != NULL; dump = dump->next()) {