lkml.org 
[lkml]   [2017]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectcpuacct.stat is too much bigger than cpuacct.usage
Hello,

I found that on kernel linux3.10, 64-bit, not virtual machine, when I
attach my process to a newly created cgroup
(/sys/fs/cgroup/cpu,cpuacct/p1), the cputime collection of
cpuacct.stat and cpuacct.usage have a big difference. Cputime in
cpuacct.stat is too much bigger than cpuacct.usage.
(I tried on linux4.4, and doesn't has such issue. I searched mailing
list, but didn't find related fix.)

Is there any explanation, or is this a kernel bug? Which file's CPU
time is more accurate that I can trust? I need separated sys time and
user time.

# cat run.sh
#! /bin/bash

sudo echo $$ > /sys/fs/cgroup/cpu,cpuacct/p1/tasks
MAX=200000
for i in $(seq ${MAX})
do
echo "test" > /tmp/p1
rm /tmp/p1
done

# cat cpuacct.stat cpuacct.usage
user 7756
system 37760 --> utime + stime = 377s + 77s = 454s
360566710120 --> total cputime is 360s

# getconf CLK_TCK
100

# pwd
/sys/devices/system/cpu
# cat present
0-3
# cat online
0-3

Looking forward for you reply. Thanks.

-Qing

\
 
 \ /
  Last update: 2017-11-01 10:02    [W:0.020 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site