]> git.pld-linux.org Git - packages/util-vserver.git/commitdiff
- use cgroup for user/sys time statistics
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Tue, 18 Jan 2011 18:40:37 +0000 (18:40 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    util-vserver-usersystime.patch -> 1.1
    util-vserver.spec -> 1.271

util-vserver-usersystime.patch [new file with mode: 0644]
util-vserver.spec

diff --git a/util-vserver-usersystime.patch b/util-vserver-usersystime.patch
new file mode 100644 (file)
index 0000000..b697688
--- /dev/null
@@ -0,0 +1,57 @@
+--- util-vserver-0.30.216-pre2926/src/vserver-stat.c   2010-12-02 16:30:12.000000000 +0100
++++ util-vserver-0.30.216-pre2926.new/src/vserver-stat.c       2011-01-18 20:32:23.465389530 +0100
+@@ -309,6 +309,7 @@
+     unsigned long long                rss;
+     char                      *endptr;
+     size_t                    len;
++    uint64_t                  stime_total, utime_total;
+     if (vc_virt_stat(xid, &vstat) == -1) {
+       perror("vc_virt_stat()");
+@@ -402,6 +403,24 @@
+       return;
+     }
++    strcpy(filename, cgroup);
++    strcpy(filename + cgroup_len, "/cpuacct.stat");
++
++    if ((fd = open(filename, O_RDONLY)) == -1) {
++      perror("open(cpuacct.stat)");
++      return;
++    }
++    if (read(fd, buf, sizeof(buf)) == -1) {
++      perror("read(cpuacct.stat)");
++      return;
++    }
++    close(fd);
++
++    if (sscanf(buf, "user %lu\nsystem %lu\n", &utime_total, &stime_total) != 2) {
++      perror("sscanf(cpuacct.stat)");
++      return;
++    }
++
+     res                       = Vector_insert(vec, &xid, cmpData);
+     res->xid          = xid;
+@@ -409,18 +428,8 @@
+     res->VmRSS_total  = rss / 4096;
+     res->start_time_oldest= getUptime() - vstat.uptime/1000000;
+-    res->utime_total  = 0;
+-    res->stime_total  = 0;
+-    // XXX: arbitrary CPU limit.
+-    for (cpu = 0; cpu < 1024; cpu++) {
+-      sched.cpu_id = cpu;
+-      sched.bucket_id = 0;
+-      if (vc_sched_info(xid, &sched) == -1)
+-        break;
+-
+-      res->utime_total        += sched.user_msec;
+-      res->stime_total        += sched.sys_msec;
+-    }
++    res->utime_total  = utime_total * 100 /* USER_HZ */;
++    res->stime_total  = stime_total * 100 /* USER_HZ */;
+   }
+   
+   res->VmSize_total   += process->VmSize;
+
index b21714dc6c0299f2b3997d88024f730b69401244..013005b965633d716dc51f5066858c383e6122f9 100644 (file)
@@ -19,7 +19,7 @@
 %endif
 
 %define                snap    pre2926
-%define                rel     1
+%define                rel     2
 Summary:       Linux virtual server utilities
 Summary(pl.UTF-8):     Narzędzia dla linuksowych serwerów wirtualnych
 Name:          util-vserver
@@ -73,6 +73,7 @@ Patch21:      %{name}-bash-wrapper.patch
 Patch22:       %{name}-pivot-root-ugly-hack.patch
 Patch24:       vunify-more-exclude.patch
 Patch25:       stat.patch
+Patch26:       %{name}-usersystime.patch
 URL:           http://savannah.nongnu.org/projects/util-vserver/
 BuildRequires: autoconf
 BuildRequires: automake >= 1.9
@@ -400,6 +401,7 @@ Szablon do tworzenia VServerów dla dystrybucji SuSE 9.1.
 %patch22 -p1
 %patch24 -p1
 %patch25 -p1
+%patch26 -p1
 
 install %{SOURCE9} package-management.txt
 
This page took 0.057715 seconds and 4 git commands to generate.