mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Profiler: Use ProfileModel rounding constant for the status bar text
This way, we can change the constant in one place. Note that this requires the use of nested format strings, which is slightly ugly but safe to do in this instance.
This commit is contained in:
parent
6368ef41f8
commit
71b175d4ed
Notes:
sideshowbarker
2024-07-17 11:12:16 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/71b175d4ed Pull-request: https://github.com/SerenityOS/serenity/pull/13815
1 changed files with 4 additions and 2 deletions
|
@ -222,9 +222,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return min(end_of_trace, max(timestamp, start_of_trace));
|
||||
};
|
||||
|
||||
auto const format_sample_count = [&profile](auto sample_count) {
|
||||
// FIXME: Make this constexpr once String is able to.
|
||||
auto const sample_count_percent_format_string = String::formatted("{{:.{}f}}%", number_of_percent_digits);
|
||||
auto const format_sample_count = [&profile, sample_count_percent_format_string](auto const sample_count) {
|
||||
if (profile->show_percentages())
|
||||
return String::formatted("{:.3f}%", sample_count.as_float_or(0.0));
|
||||
return String::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0));
|
||||
return String::formatted("{} Samples", sample_count.to_i32());
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue