-
Notifications
You must be signed in to change notification settings - Fork 41
Percentile iterator example for .hgrm output (for plotting) #62
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
Comments
There is not currently, but it's pretty straightforward if you want to take a try at it. (If not, I'll get to it when I can.) The Java tool that generates them is here: https://github.com/HdrHistogram/HdrHistogram/blob/master/src/main/java/org/HdrHistogram/HistogramLogProcessor.java This approach is fine for tinkering or one-off analysis, but if you're looking into building a robust histogram visualization pipeline, you're probably better off storing the encoded histograms and using the TypeScript HdrHistogram port to parse and visualize it directly in the browser. |
Thanks, this helps a lot - did not know about the JS demos. I am using
and pipe the file through base64 on unix. This does not work as the data seems to be useless to the JS demos. Any idea off the top of your head what I am doing wrong? Thanks either way, |
I tried with V2DeflateSerializer, too, with no luck. I saw the JS uses an Int32 Histogram constructor[1] when loading from base64 - but changing my own Histogram from u64 to u32 also did not do the trick. So, in general the question remains: - how do I serialize a histogram with hdrsample into "base64 zlib encoded" form? |
Perhaps @alexvictoor might be able to shed some light on what the JS port expects? Anyway, there are a few possibilities that occur to me:
|
@algermissen int32 is the default configuration in the JS version. You can switch to Float64 that gives you 53 bits for integers. Unfortunately no Int64 in JavaScript yet. |
Thanks @alexvictoor for the clarification. Sounds like the issue is not a matter of older logfile support but the fact that the rust implementation currently only serializes a single histogram into its binary form (which would be used in a log). I should have log file support implemented in the next couple of weeks. @algermissen in the meantime, if you're in a hurry, I would take the base64'd binary and shove it into a text file that looks like what https://github.com/HdrHistogram/HdrHistogram/blob/master/src/main/java/org/HdrHistogram/HistogramLogWriter.java produces. |
Thanks @marshallpierce I get it now! Let me know if the output seems correct. |
@alexvictoor Yes, I tried that (and this is basically all I am trying - single histogram, no logs etc). The base64 does not work - and I assume this is because it would need to be a Rust i32 to match the binary JS I32? |
This is my Rust code to create the file:
And I pipe that through base64 on macos and copy paste that into form. |
@algermissen could you share your base64 binary? |
I implemented Counter for i32 and exported and then send through base64: HISTFAAAAFstikEKQFAURZ+Dfj8DSTKgDIxkZGJqBfZkYAeWYjF2IUtw870699W5t92P0sxWC8f/oy/ne1ueIC7gjIjJGXCkwlFTCUdGgeGJEy/jZQotGTXzKgY6pRMN9Ey8 Still does not work in JS version |
foo2.hist.zip |
@algermissen thanks a lot. I get back to you asap |
Let me know if there's anything I can do to help. I'll try to pounce quickly on any encoding bugs that may be revealed as part of this! |
@marshallpierce I have just tried with the java version. I get a java.util.zip.DataFormatException with an "incorrect header check" message when trying to decode the base64 string send by @algermissen I do not know anything about rust but I guess you need to change the compression algorithm, maybe switch from DeflateEncoder to ZlibEncoder in v2_deflate_serializer.rs |
Thanks for investigating. I'll take a look! |
@alexvictoor you were right -- I must not have tested the compressed flavor for interop with java. It does want the zlib header, not just the raw deflate. I was led astray by the JDK's name choice ( |
Just tested on that branch - works for me - great! Also just tried with using u32 on the Rust side - this also works with the copy/past in between step to get from base64 to hgrm. |
Fixed in 5.1.0. |
Hi,
is there an example, how to use the percentile iterator to create a text output that can be plotted like on the hdrhistogram.org Web site's example?
Jan
The text was updated successfully, but these errors were encountered: