On Fri, Jul 18, 2008 at 01:41:34PM +0400, Evgeniy Sokolov wrote: > >On Thu, Jul 17, 2008 at 03:04:46PM +0400, Evgeniy Sokolov wrote: > >>OpenVZ calculate statistics and allow to get them . > >>Added function for getting cpu usage of container. > > > >Modular some minor comments, ACK for this patch. > > > >>+ if (!openvzIsActiveVM(vm)) { > >>+ info->cpuTime = 0; > >>+ } else { > >>+ if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) { > >>+ openvzError(dom->conn, VIR_ERR_OPERATION_FAILED, ("cannot > >>read cputime for domain")); > > > >Need to have a leading '_' in front of the string to be mark > >for translation. > > > >>+ return -1; > >>+ } > >>+ } > >>+ > >> /* TODO These need to be calculated differently for OpenVZ */ > >> //info->cpuTime = > >> //info->maxMem = vm->def->maxmem; > >>@@ -689,6 +700,48 @@ static int openvzListDefinedDomains(virC > >> return got; > >> } > >> > >>+static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid) { > >>+ int fd; > >>+ char line[PATH_MAX] ; > > > >Best to use something else as the size here - we're not reading > >a path & we should try to eliminate uses of PATH_MAX in libvirt, > >since POSIX allows for it to be undefine, or stupidly huge. I > >reckon 1024 would do the job for line length in this case. > > > >>+ if (readvps != vpsid) /*not found*/ > >>+ return -1; > >>+ > >>+ /* convert jiffies to nanoseconds */ > >>+ *cpuTime = 1000ull * 1000ull * 1000ull * (usertime + nicetime + > >>systime) / (unsigned long long)sysconf(_SC_CLK_TCK); > > > >Can we break this expression across multiple lines to avoid going > >soo far over 80 chars. > > > >Daniel > > Thanks! I completely forgot basic rules. > > fixed patch is attached. Okidoc, applied and commited, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@xxxxxxxxxx | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list