How to dump a RecordingStream?
Erik Gahlin
erik.gahlin at oracle.com
Mon Nov 23 11:28:41 UTC 2020
You can try to use RecordingStream and a Recording. Enable events using the stream, but dump using the Recording. It may keep things more in sync.
Erik
> On 23 Nov 2020, at 12:22, Gunnar Morling <gunnar at hibernate.org> wrote:
>
> Hi Erik,
>
> Thanks for confirming, and +1 for enabling this use case in one way or another. The filtering idea sounds nice.
>
> So I'll go with the Recording + separate EventStream approach for now. From what I observe, it adds some latency, though: if I start the recording and the stream, it takes ~3 sec until I receive events emitted right thereafter. Not ideal for my testing use case, but not sure whether there's anything I can do about it. Things seemed faster when using RecordingStream. But as discussed, I'd then lack the ability to dump the stream if needed.
>
> Best,
>
> --Gunnar
>
>
> Am Mo., 23. Nov. 2020 um 11:50 Uhr schrieb Erik Gahlin <erik.gahlin at oracle.com <mailto:erik.gahlin at oracle.com>>:
> Hi Gunnar,
>
> There is no way to dump a RecordingStream.
>
> I have thought about the use case and prototyped it, but I have waited with the implementation because I like to add a RemoteRecordingStream first. It could impact the design.
>
> The workaround, like you describe, is to use a Recoding for control and EventStream#openRepository() for reading the data.
>
> I’m also thinking of adding something more advanced where you can filter out events to make the dumped recording smaller.
>
> Cheers
> Erik
>
> > On 23 Nov 2020, at 10:00, Gunnar Morling <gunnar at hibernate.org <mailto:gunnar at hibernate.org>> wrote:
> >
> > Hi,
> >
> > Is it possible to dump the underlying Recording of a JEP 349
> > RecordingStream into a file at a given point in time?
> >
> > I can't seem to find any way for doing that; so what I'm currently doing is
> > to start a Recording, and then get a stream via
> > EventStream.openRepository() which will expose the recording's events; That
> > way, I have a reference to the Recording instance and can call dump(). Is
> > this the right way to do it? Perhaps it would make sense to have a method
> > dump() on RecordingStream(), too, so to simplify this?
> >
> > My use case is that I'm examining the JFR events based on the stream. If it
> > doesn't satisfy certain requirements, I'd like to dump the stream for
> > offline analysis e.g. via JMC [1].
> >
> > Thanks a lot,
> >
> > --Gunnar
> >
> > [1] https://twitter.com/gunnarmorling/status/1330623384418455559 <https://urldefense.com/v3/__https://twitter.com/gunnarmorling/status/1330623384418455559__;!!GqivPVa7Brio!N7BRHMV7g4czu8LiNrSDaOYyeeQ0RbHMTHoKxl8FLq9p2ZYmydZac8IHBWJhhPa7$>
>
More information about the hotspot-jfr-dev
mailing list