packages: util-vserver/util-vserver.spec, util-vserver/util-vserver-usersys...

arekm arekm at pld-linux.org
Tue Jan 18 19:40:42 CET 2011


Author: arekm                        Date: Tue Jan 18 18:40:42 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- use cgroup for user/sys time statistics

---- Files affected:
packages/util-vserver:
   util-vserver.spec (1.270 -> 1.271) , util-vserver-usersystime.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/util-vserver/util-vserver.spec
diff -u packages/util-vserver/util-vserver.spec:1.270 packages/util-vserver/util-vserver.spec:1.271
--- packages/util-vserver/util-vserver.spec:1.270	Thu Dec  9 19:12:00 2010
+++ packages/util-vserver/util-vserver.spec	Tue Jan 18 19:40:37 2011
@@ -20,7 +20,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
@@ -74,6 +74,7 @@
 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
@@ -401,6 +402,7 @@
 %patch22 -p1
 %patch24 -p1
 %patch25 -p1
+%patch26 -p1
 
 install %{SOURCE9} package-management.txt
 
@@ -943,6 +945,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.271  2011/01/18 18:40:37  arekm
+- use cgroup for user/sys time statistics
+
 Revision 1.270  2010/12/09 18:12:00  arekm
 - up to 2926
 

================================================================
Index: packages/util-vserver/util-vserver-usersystime.patch
diff -u /dev/null packages/util-vserver/util-vserver-usersystime.patch:1.1
--- /dev/null	Tue Jan 18 19:40:43 2011
+++ packages/util-vserver/util-vserver-usersystime.patch	Tue Jan 18 19:40:37 2011
@@ -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;
+
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/util-vserver/util-vserver.spec?r1=1.270&r2=1.271&f=u



More information about the pld-cvs-commit mailing list