src/share/vm/services/gcNotifier.hpp

Thu, 12 May 2011 10:30:11 -0700

author
fparain
date
Thu, 12 May 2011 10:30:11 -0700
changeset 2888
78542e2b5e35
child 3549
1891640ca63f
permissions
-rw-r--r--

7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
Summary: Add a notification to the GarbageCollectorMXBeans
Reviewed-by: acorn, mchung

fparain@2888 1 /*
fparain@2888 2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
fparain@2888 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fparain@2888 4 *
fparain@2888 5 * This code is free software; you can redistribute it and/or modify it
fparain@2888 6 * under the terms of the GNU General Public License version 2 only, as
fparain@2888 7 * published by the Free Software Foundation.
fparain@2888 8 *
fparain@2888 9 * This code is distributed in the hope that it will be useful, but WITHOUT
fparain@2888 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fparain@2888 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fparain@2888 12 * version 2 for more details (a copy is included in the LICENSE file that
fparain@2888 13 * accompanied this code).
fparain@2888 14 *
fparain@2888 15 * You should have received a copy of the GNU General Public License version
fparain@2888 16 * 2 along with this work; if not, write to the Free Software Foundation,
fparain@2888 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fparain@2888 18 *
fparain@2888 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fparain@2888 20 * or visit www.oracle.com if you need additional information or have any
fparain@2888 21 * questions.
fparain@2888 22 *
fparain@2888 23 */
fparain@2888 24
fparain@2888 25 #ifndef SHARE_VM_SERVICES_GCNOTIFIER_HPP
fparain@2888 26 #define SHARE_VM_SERVICES_GCNOTIFIER_HPP
fparain@2888 27
fparain@2888 28 #include "memory/allocation.hpp"
fparain@2888 29 #include "services/memoryPool.hpp"
fparain@2888 30 #include "services/memoryService.hpp"
fparain@2888 31 #include "services/memoryManager.hpp"
fparain@2888 32
fparain@2888 33 class GCNotificationRequest : public CHeapObj {
fparain@2888 34 friend class GCNotifier;
fparain@2888 35 GCNotificationRequest *next;
fparain@2888 36 jlong timestamp;
fparain@2888 37 GCMemoryManager *gcManager;
fparain@2888 38 const char *gcAction;
fparain@2888 39 const char *gcCause;
fparain@2888 40 GCStatInfo *gcStatInfo;
fparain@2888 41 public:
fparain@2888 42 GCNotificationRequest(jlong ts, GCMemoryManager *manager, const char*action, const char *cause,GCStatInfo *info) {
fparain@2888 43 next = NULL;
fparain@2888 44 timestamp = ts;
fparain@2888 45 gcManager = manager;
fparain@2888 46 gcAction = action;
fparain@2888 47 gcCause = cause;
fparain@2888 48 gcStatInfo = info;
fparain@2888 49 }
fparain@2888 50
fparain@2888 51 ~GCNotificationRequest() {
fparain@2888 52 delete gcStatInfo;
fparain@2888 53 }
fparain@2888 54 };
fparain@2888 55
fparain@2888 56 class GCNotifier : public AllStatic {
fparain@2888 57 friend class ServiceThread;
fparain@2888 58 private:
fparain@2888 59 static GCNotificationRequest *first_request;
fparain@2888 60 static GCNotificationRequest *last_request;
fparain@2888 61 static void addRequest(GCNotificationRequest *request);
fparain@2888 62 static GCNotificationRequest *getRequest();
fparain@2888 63 public:
fparain@2888 64 static void pushNotification(GCMemoryManager *manager, const char *action, const char *cause);
fparain@2888 65 static bool has_event();
fparain@2888 66 static void sendNotification(TRAPS);
fparain@2888 67 };
fparain@2888 68
fparain@2888 69 #endif // SHARE_VM_SERVICES_GCNOTIFIER_HPP

mercurial