Re: [libvirt PATCH 01/13] util: Helper functions to get process info

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

 



On 10/22/21 5:37 PM, Praveen K Paladugu wrote:
> From: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
> 
> These helper methods are used to capture vcpu information
> in ch driver.
> 
> Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
> ---
>  src/util/virprocess.c | 136 ++++++++++++++++++++++++++++++++++++++++++
>  src/util/virprocess.h |   5 ++
>  2 files changed, 141 insertions(+)
> 
> diff --git a/src/util/virprocess.c b/src/util/virprocess.c
> index 6de3f36f52..0164d70df6 100644
> --- a/src/util/virprocess.c
> +++ b/src/util/virprocess.c
> @@ -1721,3 +1721,139 @@ virProcessSetScheduler(pid_t pid G_GNUC_UNUSED,
>  }
>  
>  #endif /* !WITH_SCHED_SETSCHEDULER */
> +
> +/*
> +TODO: This method was cloned from qemuGetProcessInfo in src/qemu/qemu_driver.c.
> +Need to refactor qemu driver to use this shared function.

There's no harm in doing that in this patch. In fact, it's desired. You
can move a qemu function into src/util, rename it and fix all places
where it is called, all in one patch.

Also, please don't forget to export this function in
src/libvirt_private.syms.

> +*/
> +int
> +virProcessGetStatInfo(unsigned long long *cpuTime, int *lastCpu, long *vm_rss,
> +                   pid_t pid, pid_t tid)

Indentation's off. I've noticed other patches in the series suffer from
mis-indentation too. Please fix that in another version.

> +{
> +    g_autofree char *proc = NULL;
> +    FILE *pidinfo;
> +    unsigned long long usertime = 0, systime = 0;

I wonder whether we should take this opportunity and declare these two
variables at one line each.

> +    long rss = 0;
> +    int cpu = 0;

Michal




[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]

  Powered by Linux