1 /* 2 * Copyright (c) 1998, 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/_memprofiler.cpp.incl" 27 28 #ifndef PRODUCT 29 30 // -------------------------------------------------------- 31 // MemProfilerTask 32 33 class MemProfilerTask : public PeriodicTask { 34 public: 35 MemProfilerTask(int interval_time) : PeriodicTask(interval_time) {} 36 void task(); 37 }; 38 39 40 void MemProfilerTask::task() { 41 // Get thread lock to provide mutual exclusion, and so we can iterate safely over the thread list. 42 MutexLocker mu(Threads_lock); 43 MemProfiler::do_trace(); 44 } 45 46 | 1 /* 2 * Copyright (c) 1998, 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 "code/codeCache.hpp" 28 #include "gc_interface/collectedHeap.inline.hpp" 29 #include "interpreter/oopMapCache.hpp" 30 #include "memory/generation.hpp" 31 #include "memory/permGen.hpp" 32 #include "memory/resourceArea.hpp" 33 #include "runtime/handles.inline.hpp" 34 #include "runtime/jniHandles.hpp" 35 #include "runtime/memprofiler.hpp" 36 #include "runtime/mutexLocker.hpp" 37 #include "runtime/os.hpp" 38 #include "runtime/task.hpp" 39 #include "runtime/vmThread.hpp" 40 #ifdef TARGET_OS_FAMILY_linux 41 # include "thread_linux.inline.hpp" 42 #endif 43 #ifdef TARGET_OS_FAMILY_solaris 44 # include "thread_solaris.inline.hpp" 45 #endif 46 #ifdef TARGET_OS_FAMILY_windows 47 # include "thread_windows.inline.hpp" 48 #endif 49 50 #ifndef PRODUCT 51 52 // -------------------------------------------------------- 53 // MemProfilerTask 54 55 class MemProfilerTask : public PeriodicTask { 56 public: 57 MemProfilerTask(int interval_time) : PeriodicTask(interval_time) {} 58 void task(); 59 }; 60 61 62 void MemProfilerTask::task() { 63 // Get thread lock to provide mutual exclusion, and so we can iterate safely over the thread list. 64 MutexLocker mu(Threads_lock); 65 MemProfiler::do_trace(); 66 } 67 68 |