-
Notifications
You must be signed in to change notification settings - Fork 125
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
Support arbitrary scaling factor #19
Comments
I did an initial implementation of this and realized that the output sometimes differs between my version and the Perl version because of differences in the way floating point numbers are rounded when formatting to a string compared to calling
The Perl version formats the samples like this: my $samples = sprintf "%.0f", ($etime - $stime) * $factor; But our version is using let samples = ((frame.end_time - frame.start_time) as f64 * opt.factor).round() as usize; Do we want to come up with a way to get the sample counts to match the Perl version in every case, or should we not worry about it? |
I think we specifically need the result to not be a |
The Perl version formats the samples in the end without the fractional part. Are you saying you want to diverge from this behavior? If so, how many decimal places would we want to show? |
Ohh, you're entirely right! I misread that part of the Perl code. I think what we want here is |
Yes - I had always planned to add floating point support to num-format, but it's a bit more complicated than integers. I'd like to read and (at least partially) understand some of the following kind of stuff before I get started (just a sample of various stuff on the topic that's out there):
But if inferno needs it, I'd be happy to prioritize the feature! Doing a very naive implementation, by the way, would be super easy, but it would be just that, a very naive implementation. But if you wanted a temporary stop-gap feature added, I could do the naive version quickly while I work on implementing a faster algorithm for later release. |
@bcmyers thanks, I appreciate that, but from the discussion above I think it's fine for us to just convert to an integer and then format, as that's what the Perl implementation is doing :) |
Sounds good. |
The
--factor
option inflamegraph.pl
lets you arbitrarily multiply all sample counts by a constant, probably to show "true counts" if you've undersampled. We should document and adopt that option.The text was updated successfully, but these errors were encountered: