1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 00:17:46 +00:00

Profiler: Round sample percentages to a constant number of digits

This constant is currently 3 but can be changed easily or integrated
into a user setting. Note that the results are not ideal because during
pretty-printing we're not using any nice rounding rules, so many
percentage values will actually appear as 0.399999 even though they were
rounded to three digits.
This commit is contained in:
kleines Filmröllchen 2022-04-26 22:56:57 +02:00 committed by Linus Groh
parent d9decfbbf3
commit 6368ef41f8
2 changed files with 11 additions and 2 deletions

View file

@ -13,6 +13,10 @@ namespace Profiler {
class Profile;
// Number of digits after the decimal point for sample percentages.
static constexpr int const number_of_percent_digits = 3;
static constexpr float const percent_digits_rounding_constant = AK::pow(10, number_of_percent_digits);
class ProfileModel final : public GUI::Model {
public:
static NonnullRefPtr<ProfileModel> create(Profile& profile)