Giter Club home page Giter Club logo

Comments (8)

trapgate avatar trapgate commented on July 3, 2024

I'm not sure what you're asking here. If you're looking for help decoding the returned TypedParams, check in libvirt.go, there are some examples there that show how it's done. The returned rNparams value is redundant - len(rParams) will tell you the same thing..

from go-libvirt.

fcddk avatar fcddk commented on July 3, 2024

Nparams ,StartCPU,TypedParameterFlags
How to finish the above three request parameters?

from go-libvirt.

fcddk avatar fcddk commented on July 3, 2024

I don’t understand the meaning of these three parameters。

from go-libvirt.

trapgate avatar trapgate commented on July 3, 2024

Your best resource for that question is the libvirt documentation for this function, which is here: https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetCPUStats

from go-libvirt.

fcddk avatar fcddk commented on July 3, 2024
resultSli, _, err := l.DomainGetCPUStats(*domain, 1, -1, 1, 0)
if err != nil {
	log.Printf("failed to get domainCpuState: %v", err)
	return err
}
for _, value := range resultSli {
	fmt.Printf("cpuState: %v", value)
}

from go-libvirt.

fcddk avatar fcddk commented on July 3, 2024

return:
cpuState: {cpu_time {4 1740335852754}}
cpuState: {cpu_time {4 663492372092}}
cpuState: {cpu_time {4 2788674600845}}
cpuState: {cpu_time {4 7265418187967}}
cpuState: {cpu_time {4 62431433010}}
cpuState: {cpu_time {4 20751254614}}
cpuState: {cpu_time {4 596372260237}}
cpuState: {cpu_time {4 233139094885}}

from go-libvirt.

fcddk avatar fcddk commented on July 3, 2024

How does the data returned by the interface help me calculate CPU usage?

from go-libvirt.

vtolstov avatar vtolstov commented on July 3, 2024

You must take two measurements.
After that substract from second measure first. Divide by number of seconds between two measurements.
Also note that stats for each cpu. So if you need total sum.

from go-libvirt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.