
Metric from between two samples which provides mean, min, max values.The IDP framework provides few ways to get metrics about the processor: Now that we have basic unit types available we can look further in data structures. So I would need a structure for Frequency/Temperature with mean/min/max values.Īn interesting point I discovered while looking into the IDP header is that processor power values are returning in Watts and Joule's values.Īnother interesting point about go structures I found is that you can define a JSON field name just by using an annotation style format.
#Sources didi chinabased linkdoc ipotimes how to#
While trying to figure out how to present the available data. I found that the IPG framework returns the number of packages (processors) available in the system and then you use the further methods to fetch the metrics using package number. So metrics are also available per package and core. I am digging the Go time module and how it has the main unit and how it is easy to transform it into other types quickly. I also liked how the Maps are defined in Go reminds me a bit of Java. Now that our data structures are defined we can dig into logic and functions. To start using the IDP framework you first need to initialize it and after using shutdown it. I have decided to make it more usable than direct integration to C functions that way it would be easier to use for everyone else. The main function will be to GetPackages() which will return the all packages in mapIntelPowerGadgetPackage type.

#Sources didi chinabased linkdoc ipotimes code#
These functions will provide basic information about processors inside the system in which this code is running. Now to collect metrics I need to implement sampling functions. As I did with package information I decided to collect all metrics in a single function call instead of needing to call each function individually.įirst, you will get all packages, when you call for each package function StartSampling to get sampleId which you can fetch results back from FinishSampling which will return the IntelPowerGadgetSample structure.įinally, the module is finished now let's try to test it out.

TestingĪfter pushing code to GitHub and making a release we can finally test the module to see how it works. The code is available on my personal GitHub account.
