On Tue, Jan 26, 2016 at 11:20:59AM +0000, Daniel P. Berrange wrote: > The VIR_DOMAIN_STATS_VCPU flag to virDomainListGetStats > enables reporting of stats about vCPUs. Currently we > only report the cumulative CPU running time and the > execution state. > > This adds reporting of the wait time - time the vCPU > wants to run, but the host schedular has something else *scheduler > running ahead of it. > > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 36fb047..40c52d4 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > + if (tid) > + ret = virAsprintf(&proc, "/proc/%d/task/%d/sched", (int)pid, (int)tid); > + else > + ret = virAsprintf(&proc, "/proc/%d/sched", (int)pid); > + if (ret < 0) > + goto cleanup; > + ret = -1; > + > + /* The file is not guaranteed to exist (needs CONFIG_SCHED_DEBUG) */ > + if (access(proc, R_OK) < 0) ret = 0; goto cleanup; to also free proc > + return 0; > + > + if (virFileReadAll(proc, (1<<16), &data) < 0) > + goto cleanup; > + > + lines = virStringSplit(data, "\n", 0); > + if (!lines) > + goto cleanup; > + > + for (i = 0; lines[i] != NULL; i++) { > + const char *line = lines[i]; > + > + /* Needs CONFIG_SCHEDSTATS. The second check > + * is the old name the kernel used in past */ > + if (STRPREFIX(line, "se.statistics.wait_sum") || > + STRPREFIX(line, "se.wait_sum")) { > + line = strchr(line, ':'); > + if (!line) { > + virReportError(VIR_ERR_INTERNAL_ERROR, > + _("Missing separate in sched info '%s'"), The error message is either missing a word, or it should be separator. > + lines[i]); > + goto cleanup; > + } ACK Jan
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list