summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-23 00:38:34 +0800
committerruki <[email protected]>2022-09-23 00:38:34 +0800
commit766f61852a6665a6c180baf37518f7ea988e48e3 (patch)
tree9a6f424f16f832d6a2856cf5d41cdff948902f85 /core/src
parent95744e90280781b105de7846367156fb61d4f318 (diff)
fix format error
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/os/cpuinfo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/xmake/os/cpuinfo.c b/core/src/xmake/os/cpuinfo.c
index 49f6e27a4..2cbb931ce 100644
--- a/core/src/xmake/os/cpuinfo.c
+++ b/core/src/xmake/os/cpuinfo.c
@@ -162,12 +162,12 @@ static tb_float_t xm_os_cpuinfo_usagerate()
*/
if (fgets(line, sizeof(line), fp) && !tb_strncmp(line, "cpu ", 4))
{
- tb_int64_t user, nice, sys, idle, iowait, irq, softirq, steal, guest, guest_nice;
+ long long user, nice, sys, idle, iowait, irq, softirq, steal, guest, guest_nice;
if (10 == sscanf(line, "cpu %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld",
&user, &nice, &sys, &idle, &iowait, &irq, &softirq, &steal, &guest, &guest_nice))
{
- tb_int64_t active = user + nice + sys + irq + softirq + steal + guest + guest_nice;
- tb_int64_t total = user + nice + sys + idle + iowait + irq + softirq + steal + guest + guest_nice;
+ tb_int64_t active = (tb_int64_t)(user + nice + sys + irq + softirq + steal + guest + guest_nice);
+ tb_int64_t total = (tb_int64_t)(user + nice + sys + idle + iowait + irq + softirq + steal + guest + guest_nice);
if (total_prev > 0 && active_prev > 0)
{
tb_int64_t total_diff = total - total_prev;