projects
/
platform
/
core
/
system
/
pass.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
121611a
)
resource: process: Fix to convert to double before integer division
28/280228/1
author
Dongwoo Lee
<dwoo08.lee@samsung.com>
Thu, 25 Aug 2022 04:46:28 +0000
(13:46 +0900)
committer
Dongwoo Lee
<dwoo08.lee@samsung.com>
Thu, 25 Aug 2022 10:53:10 +0000
(19:53 +0900)
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 <dwoo08.lee@samsung.com>
src/resource/resource-process.c
patch
|
blob
|
history
diff --git
a/src/resource/resource-process.c
b/src/resource/resource-process.c
index
dfbe086
..
4f68a78
100644
(file)
--- 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;
}