From: Dongwoo Lee Date: Thu, 25 Aug 2022 04:46:28 +0000 (+0900) Subject: resource: process: Fix to convert to double before integer division X-Git-Tag: submit/tizen/20220829.102006~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbd7b7ad57cd0da74f51e18167ba235773cbff84;p=platform%2Fcore%2Fsystem%2Fpass.git resource: process: Fix to convert to double before integer division In order to prevent losing floating point number for the result of integer division, integer value is coverted to double before calculation. Change-Id: I38c19c1468167ed1203417f03d187dcf0893e6ca Signed-off-by: Dongwoo Lee --- diff --git a/src/resource/resource-process.c b/src/resource/resource-process.c index dfbe086..4f68a78 100644 --- a/src/resource/resource-process.c +++ b/src/resource/resource-process.c @@ -112,7 +112,7 @@ static int process_get_mem_attrs(struct resource *res, double *percent = (double *)data; curr = &ctx->curr; - *percent = (curr->coremem * 1024) / curr->ac_stime; + *percent = (double)(curr->coremem * 1024) / curr->ac_stime; *percent /= total_memory * 100.0; break; }