Thread view

getrusage04 - accuracy of getrusage() with RUSAGE_THREAD
This program is used for testing the following upstream commit:
761b1d26df542fd5eb348837351e4d2f3bc7bffe.
getrusage() returns cpu resource usage with accuracy of 10000us
when RUSAGE_THREAD is specified to the argument who. Meanwhile,
accuracy is 1000us when RUSAGE_SELF is specified. This bad
accuracy of getrusage() caused a big impact on some application
which is critical to accuracy of cpu usage. The upstream fix
removed casts to clock_t in task_u/stime(), to keep granularity
of cputime_t over the calculation.
Signed-off-by: Caspar Zhang <czhang@...>
---
runtest/syscalls | 11 +-
testcases/kernel/syscalls/getrusage/getrusage04.c | 122 +++++++++++++++++++++
2 files changed, 128 insertions(+), 5 deletions(-)
create mode 100644 testcases/kernel/syscalls/getrusage/getrusage04.c

getrusage04 - accuracy of getrusage() with RUSAGE_THREAD
This program is used for testing the following upstream commit:
761b1d26df542fd5eb348837351e4d2f3bc7bffe.
getrusage() returns cpu resource usage with accuracy of 10ms
when RUSAGE_THREAD is specified to the argument who. Meanwhile,
accuracy is 1ms when RUSAGE_SELF is specified. This bad accuracy
of getrusage() caused a big impact on some application which is
critical to accuracy of cpu usage. The upstream fix removed
casts to clock_t in task_u/stime(), to keep granularity of
cputime_t over the calculation.
Note that the accuracy on powerpc and s390x systems is always
10ms when either RUSAGE_THREAD or RUSAGE_SELF specified, so
this test won't be executed on those platforms.
Signed-off-by: Caspar Zhang <caspar@...>
---
testcases/kernel/syscalls/getrusage/getrusage04.c | 132 +++++++++++++++++++++
1 files changed, 132 insertions(+), 0 deletions(-)
create mode 100644 testcases/kernel/syscalls/getrusage/getrusage04.c