1 --- util-vserver-0.30.216-pre2926/src/vserver-stat.c 2010-12-02 16:30:12.000000000 +0100
2 +++ util-vserver-0.30.216-pre2926.new/src/vserver-stat.c 2011-01-18 20:32:23.465389530 +0100
4 unsigned long long rss;
7 + uint64_t stime_total, utime_total;
9 if (vc_virt_stat(xid, &vstat) == -1) {
10 perror("vc_virt_stat()");
15 + strcpy(filename, cgroup);
16 + strcpy(filename + cgroup_len, "/cpuacct.stat");
18 + if ((fd = open(filename, O_RDONLY)) == -1) {
19 + perror("open(cpuacct.stat)");
22 + if (read(fd, buf, sizeof(buf)) == -1) {
23 + perror("read(cpuacct.stat)");
28 + if (sscanf(buf, "user %lu\nsystem %lu\n", &utime_total, &stime_total) != 2) {
29 + perror("sscanf(cpuacct.stat)");
33 res = Vector_insert(vec, &xid, cmpData);
37 res->VmRSS_total = rss / 4096;
38 res->start_time_oldest= getUptime() - vstat.uptime/1000000;
40 - res->utime_total = 0;
41 - res->stime_total = 0;
42 - // XXX: arbitrary CPU limit.
43 - for (cpu = 0; cpu < 1024; cpu++) {
45 - sched.bucket_id = 0;
46 - if (vc_sched_info(xid, &sched) == -1)
49 - res->utime_total += sched.user_msec;
50 - res->stime_total += sched.sys_msec;
52 + res->utime_total = utime_total * 100 /* USER_HZ */;
53 + res->stime_total = stime_total * 100 /* USER_HZ */;
56 res->VmSize_total += process->VmSize;