Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shenandoah/shenandoahJfrSupport.cpp
38920 views
/*1* Copyright (c) 2019, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223#include "precompiled.hpp"24#include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"25#include "gc_implementation/shenandoah/shenandoahHeapRegion.hpp"26#include "gc_implementation/shenandoah/shenandoahJfrSupport.hpp"27#include "jfr/jfrEvents.hpp"28#if INCLUDE_JFR29#include "jfr/metadata/jfrSerializer.hpp"30#endif3132#if INCLUDE_JFR3334class ShenandoahHeapRegionStateConstant : public JfrSerializer {35friend class ShenandoahHeapRegion;36public:37virtual void serialize(JfrCheckpointWriter& writer) {38static const u4 nof_entries = ShenandoahHeapRegion::region_states_num();39writer.write_count(nof_entries);40for (u4 i = 0; i < nof_entries; ++i) {41writer.write_key(i);42writer.write(ShenandoahHeapRegion::region_state_to_string((ShenandoahHeapRegion::RegionState)i));43}44}45};4647void ShenandoahJFRSupport::register_jfr_type_serializers() {48JfrSerializer::register_serializer(TYPE_SHENANDOAHHEAPREGIONSTATE,49false,50true,51new ShenandoahHeapRegionStateConstant());52}53#endif5455class ShenandoahDumpHeapRegionInfoClosure : public ShenandoahHeapRegionClosure {56public:57virtual void heap_region_do(ShenandoahHeapRegion* r) {58EventShenandoahHeapRegionInformation evt;59evt.set_index((unsigned)r->index());60evt.set_state((u8)r->state());61evt.set_start((uintptr_t)r->bottom());62evt.set_used(r->used());63evt.commit();64}65};6667void VM_ShenandoahSendHeapRegionInfoEvents::doit() {68ShenandoahDumpHeapRegionInfoClosure c;69ShenandoahHeap::heap()->heap_region_iterate(&c);70}717273