mirror of
https://github.com/aristocratos/btop.git
synced 2024-11-01 05:11:03 +01:00
Make process thread count better readable when wider than 5 digits
This commit is contained in:
parent
6027cedd42
commit
f34b40892f
@ -20,6 +20,7 @@ tab-size = 4
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "btop_draw.hpp"
|
#include "btop_draw.hpp"
|
||||||
#include "btop_config.hpp"
|
#include "btop_config.hpp"
|
||||||
@ -1529,7 +1530,16 @@ namespace Proc {
|
|||||||
else mem_str.resize((mem_p < 10 or mem_p >= 100 ? 3 : 4));
|
else mem_str.resize((mem_p < 10 or mem_p >= 100 ? 3 : 4));
|
||||||
mem_str += '%';
|
mem_str += '%';
|
||||||
}
|
}
|
||||||
out += (thread_size > 0 ? t_color + rjust(to_string(min(p.threads, (size_t)9999)), thread_size) + ' ' + end : "" )
|
|
||||||
|
// Shorten process thread representation when larger than 5 digits: 10000 -> 10K ...
|
||||||
|
std::string proc_threads_string;
|
||||||
|
if (p.threads > 9999) {
|
||||||
|
proc_threads_string = std::to_string(p.threads / 1000) + 'K';
|
||||||
|
} else {
|
||||||
|
proc_threads_string = std::to_string(p.threads);
|
||||||
|
}
|
||||||
|
|
||||||
|
out += (thread_size > 0 ? t_color + rjust(proc_threads_string, thread_size) + ' ' + end : "" )
|
||||||
+ g_color + ljust((cmp_greater(p.user.size(), user_size) ? p.user.substr(0, user_size - 1) + '+' : p.user), user_size) + ' '
|
+ g_color + ljust((cmp_greater(p.user.size(), user_size) ? p.user.substr(0, user_size - 1) + '+' : p.user), user_size) + ' '
|
||||||
+ m_color + rjust(mem_str, 5) + end + ' '
|
+ m_color + rjust(mem_str, 5) + end + ' '
|
||||||
+ (is_selected ? "" : Theme::c("inactive_fg")) + (show_graphs ? graph_bg * 5: "")
|
+ (is_selected ? "" : Theme::c("inactive_fg")) + (show_graphs ? graph_bg * 5: "")
|
||||||
|
Loading…
Reference in New Issue
Block a user