Re: [PATCH v2] qemu: add reporting of vCPU wait time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]