Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to stream region sampling data to a file #82

Closed
Original file line number Diff line number Diff line change
@@ -88,20 +88,16 @@ void ShenandoahHeapRegionCounters::update() {
if (ShenandoahRegionSampling) {
jlong current = nanos_to_millis(os::javaTimeNanos());
jlong last = _last_sample_millis;
if (current - last > ShenandoahRegionSamplingRate &&
Atomic::cmpxchg(&_last_sample_millis, last, current) == last) {
if (current - last > ShenandoahRegionSamplingRate && Atomic::cmpxchg(&_last_sample_millis, last, current) == last) {

ShenandoahHeap* heap = ShenandoahHeap::heap();

_status->set_value(encode_heap_status(heap));

_timestamp->set_value(os::elapsed_counter());

size_t num_regions = heap->num_regions();

{
ShenandoahHeapLocker locker(heap->lock());
size_t rs = ShenandoahHeapRegion::region_size_bytes();
size_t num_regions = heap->num_regions();
for (uint i = 0; i < num_regions; i++) {
ShenandoahHeapRegion* r = heap->get_region(i);
jlong data = 0;
Original file line number Diff line number Diff line change
@@ -101,4 +101,3 @@ class ShenandoahHeapRegionCounters : public CHeapObj<mtGC> {
};

#endif // SHARE_GC_SHENANDOAH_SHENANDOAHHEAPREGIONCOUNTERS_HPP

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021, Amazon.com, Inc. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahLogFileOutput.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved.
* Copyright (c) 2021, Amazon.com, Inc. All rights reserved.
* Copyright (c) 2015, 2021, 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