[lxc-devel] issue with inotify and cgroups

Lou-adrien Fabre lou.adrien at gmail.com
Thu Jul 28 10:03:59 UTC 2011


Hi,

I'm currently trying to monitor my container's stats from my host, using the
cgroup file (especialy cpuacct.usage_percpu), but the problem is that the
refresh rate of the cgroup file seems to be quit unstable. So i need to
watch for file modification and make my calculation then. I was thinking
about using inotify to watch files, but it seems that I'm not getting
notifed for any event while the file's content is actualy modified by lxc. (
while I'm modified when I personaly modify the file). I assume it has
something to see with lxc's way of modifying does files, but it is out of my
comprehension. Could someone give me an advice on this?

Thx in advance,
Lou

ps: this is a unrelated issue, and less important, but it's kind of
stressing me : I noticed that time computation using clock() (processor
ticks) inside the container becomes false when cpu shared is used. per
exemple if i'm using 2 container on one 1cpu a 100%, time calculated inside
each container with a code like :

double duration;
    start = clock();
    while(running==1)
    {
        finish = clock();
        duration = ((double)(finish - start)) / CLOCKS_PER_SEC;

        if(duration >=1.0)
        {
            printf("1 second spent!");
            start = clock();
        }
    }

will be wrong, actualy the message will pop every 2 second. I would
appreciate to have some lightning about this as i don't understand what is
going on with that, i guess it comes from the cpu scheduling process, but
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20110728/527e0082/attachment.html>


More information about the lxc-devel mailing list