mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-01-26 11:39:44 +00:00
Bugfix: Tally up all CPU totals for more accurate usage % in taskmgr
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "procmon.h"
|
||||
|
||||
#define PROC_STAT_CPU_COUNTERS 7
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
@@ -236,22 +238,26 @@ static void process_get_totals(
|
||||
)
|
||||
)
|
||||
{
|
||||
gchar* last_stime_s = wintc_strdup_delimited(
|
||||
// Total up all the CPU time in various modes
|
||||
//
|
||||
gint running_total = 0;
|
||||
|
||||
for (gint i = 0; i < PROC_STAT_CPU_COUNTERS; i++)
|
||||
{
|
||||
gchar* time_stat_s =
|
||||
wintc_strdup_delimited(
|
||||
cpu_stats + 5, // skip 'cpu '
|
||||
" ",
|
||||
0
|
||||
);
|
||||
gchar* last_utime_s = wintc_strdup_delimited(
|
||||
cpu_stats + 5,
|
||||
" ",
|
||||
2
|
||||
i
|
||||
);
|
||||
|
||||
*cpu_time =
|
||||
strtoul(last_stime_s, NULL, 0) + strtoul(last_utime_s, NULL, 0);
|
||||
running_total += strtoul(time_stat_s, NULL, 0);
|
||||
|
||||
g_free(time_stat_s);
|
||||
}
|
||||
|
||||
*cpu_time = running_total;
|
||||
|
||||
g_free(last_stime_s);
|
||||
g_free(last_utime_s);
|
||||
g_free(cpu_stats);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user