mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
SystemMonitor: Use size_t for graph values
The memory and CPU graphs fail to display anything when the memory size is larger than 2**31 bytes, because of the small range of int. This commit makes replaces the type with size_t. Hopefully nobody will have 18 quintillion bytes of memory before this gets replaced. :^)
This commit is contained in:
parent
f73aa8e2bd
commit
7aa3cfda09
4 changed files with 9 additions and 9 deletions
|
@ -700,7 +700,7 @@ NonnullRefPtr<GUI::Widget> build_performance_tab()
|
|||
ProcessModel::the().on_cpu_info_change = [cpu_graphs](const NonnullOwnPtrVector<ProcessModel::CpuInfo>& cpus) {
|
||||
float sum_cpu = 0;
|
||||
for (size_t i = 0; i < cpus.size(); ++i) {
|
||||
cpu_graphs[i].add_value({ (int)cpus[i].total_cpu_percent, (int)cpus[i].total_cpu_percent_kernel });
|
||||
cpu_graphs[i].add_value({ static_cast<size_t>(cpus[i].total_cpu_percent), static_cast<size_t>(cpus[i].total_cpu_percent_kernel) });
|
||||
sum_cpu += cpus[i].total_cpu_percent;
|
||||
}
|
||||
float cpu_usage = sum_cpu / (float)cpus.size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue