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"
|
#include "procmon.h"
|
||||||
|
|
||||||
|
#define PROC_STAT_CPU_COUNTERS 7
|
||||||
|
|
||||||
//
|
//
|
||||||
// FORWARD DECLARATIONS
|
// 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
|
||||||
cpu_stats + 5, // skip 'cpu '
|
//
|
||||||
" ",
|
gint running_total = 0;
|
||||||
0
|
|
||||||
);
|
|
||||||
gchar* last_utime_s = wintc_strdup_delimited(
|
|
||||||
cpu_stats + 5,
|
|
||||||
" ",
|
|
||||||
2
|
|
||||||
);
|
|
||||||
|
|
||||||
*cpu_time =
|
for (gint i = 0; i < PROC_STAT_CPU_COUNTERS; i++)
|
||||||
strtoul(last_stime_s, NULL, 0) + strtoul(last_utime_s, NULL, 0);
|
{
|
||||||
|
gchar* time_stat_s =
|
||||||
|
wintc_strdup_delimited(
|
||||||
|
cpu_stats + 5, // skip 'cpu '
|
||||||
|
" ",
|
||||||
|
i
|
||||||
|
);
|
||||||
|
|
||||||
|
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);
|
g_free(cpu_stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user