total_uptime = user + nice + system + idle + iowait + irq + softirq;
- usage->user = (double)user * 100 / total_uptime;
- usage->nice = (double)nice * 100 / total_uptime;
- usage->system = (double)system * 100 / total_uptime;
- usage->iowait = (double)iowait * 100 / total_uptime;
+ if (total_uptime > 0) {
+ usage->user = (double)user * 100 / total_uptime;
+ usage->nice = (double)nice * 100 / total_uptime;
+ usage->system = (double)system * 100 / total_uptime;
+ usage->iowait = (double)iowait * 100 / total_uptime;
+ } else {
+ usage->user = 0;
+ usage->nice = 0;
+ usage->system = 0;
+ usage->iowait = 0;
+ }
return RUNTIME_INFO_ERROR_NONE;
}
if (!fscanf(fp, "%*d %d %d %*d %d", &code, &data, &pss)) {
printf("memps has invalid format\n");
printf(" Result : %s\n", PRINT_RESULT(ERROR));
- fclose(fp);
+ pclose(fp);
return;
}
- fclose(fp);
+ pclose(fp);
printf(" Virtual memory size : %s\n",
PRINT_RESULT(check_value(info[0].vsz, BytetoKiB(vsz), 10)));
}
g_main_loop_run(mainloop);
+ g_main_loop_unref(mainloop);
return NULL;
}
if (g_cond_wait_until(&cond, &mutex, g_get_monotonic_time() + TIME_TO_WAIT_CB)) {
result = SUCCESS;
ret = runtime_info_unset_changed_cb(key_list_bool[CB_TEST_IDX].key_r);
+ if (ret != RUNTIME_INFO_ERROR_NONE)
+ printf("Notice : failed to unset callback.\n");
break;
}
}
ret = execlp(VCONF_EXECUTABLE, VCONF_ARGV_0, VCONF_ARGV_1, VCONF_ARGV_2,
VCONF_ARGV_3, key_list_bool[CB_TEST_IDX].key_v, VCONF_ARGV_5,
(value_orig ? VCONF_ARGV_6_TRUE : VCONF_ARGV_6_FALSE), VCONF_ARGV_7);
+ if (ret == -1)
+ printf("Notice : failed to rollback vconf value.\n");
break;
case -1:
default: