Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_interface/allocTracer.cpp
32285 views
/*1* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "gc_implementation/shared/gcId.hpp"26#include "gc_interface/allocTracer.hpp"27#include "jfr/jfrEvents.hpp"28#include "runtime/handles.hpp"29#include "utilities/globalDefinitions.hpp"30#if INCLUDE_JFR31#include "jfr/support/jfrAllocationTracer.hpp"32#endif3334void AllocTracer::send_allocation_outside_tlab_event(KlassHandle klass, HeapWord* obj, size_t alloc_size, Thread* thread) {35JFR_ONLY(JfrAllocationTracer tracer(obj, alloc_size, thread);)36EventObjectAllocationOutsideTLAB event;37if (event.should_commit()) {38event.set_objectClass(klass());39event.set_allocationSize(alloc_size);40event.commit();41}42}4344void AllocTracer::send_allocation_in_new_tlab_event(KlassHandle klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread) {45JFR_ONLY(JfrAllocationTracer tracer(obj, alloc_size, thread);)46EventObjectAllocationInNewTLAB event;47if (event.should_commit()) {48event.set_objectClass(klass());49event.set_allocationSize(alloc_size);50event.set_tlabSize(tlab_size);51event.commit();52}53}5455void AllocTracer::send_allocation_requiring_gc_event(size_t size, const GCId& gcId) {56EventAllocationRequiringGC event;57if (event.should_commit()) {58event.set_gcId(gcId.id());59event.set_size(size);60event.commit();61}62}636465