[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Vanilla Xen total CPU %
On Thu, Jun 4, 2020 at 8:34 PM Nick Calvert <nick.calvert@xxxxxxxxx> wrote: Hi everyone, Just to be clear: What you mean, is you want to add up the time all VMs are running? (i.e., if you have one VM at 150%, another at 25%, and another at 25%, the total would be 200%?) I have been experimenting with writing a parser for xentop output in If you don't mind me asking, what are you (and the projects you mention) using this information for? Xen is open-source project, so rather than having dozens of projects trying to work around the fact that the core tools don't tell them what they want to know, it seems like it would be better to either modify xentop to tell you what you want to know, or add a new tool to do the same thing.
I think if I were writing a program, I'd probably use libxl to get the raw data, rather than trying to parse xentop. libxl_list_domain() will return a list of libxl_dominfo, which has a field "cpu_time", which is (I believe) the number of nanoseconds of cpu time that domain has consumed ever in its lifetime. So what you'd do is take a timestamp (t1) call libxl_list_domain(), and go through the resulting list, adding up `cpu_time` (c1). Then at some point later, take a timestamp (t2) and do another sum (c2). Your total host utilization between t1 and t2 would then be (c2 - c1) / (t2 - t1). If you're using 4.13 at least, you could use the golang bindings instead, if you didn't want to use C. -George
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |