RFR: 8259956: jdk.jfr.internal.ChunkInputStream#available should return the sum of remaining available bytes
Denghui Dong
ddong at openjdk.java.net
Tue Feb 2 02:46:40 UTC 2021
On Mon, 1 Feb 2021 19:55:09 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> There is a method for finding the size of a recording, Recording::getSize(). It returns a long, which means it will work in cases where the recording is larger than 2 GB. I would recommend using it if you want to know the size in a reliable way.
>
But if I get the data of a period of time in the past through Recoding::getStream, I cannot know its size.
> One problem with the implementation is that you iterate over all chunks with every call to available(). It would be nice to avoid this.
I used "unstreamedSize" to cache the size.
> I also wonder if you considered making total a long value and check for overflow once and near the return statement?
yes, good idea!
-------------
PR: https://git.openjdk.java.net/jdk/pull/2138
More information about the hotspot-jfr-dev
mailing list