Implement Mhz to current, min and max.#1517
Conversation
|
Thank you for your contribution. However, unfortunately, this PR breaks current compatibility. So we cannot accept while in current major version, v3. I have added |
|
Hi @shirou , can we merge this ? |
|
As I commented, this PR breaks current compatibility. So we cannot merge until v4 is released. |
|
It seems the current version is v4 now can this be considered again? I was also interested in this data. --- Edit And if it does get picked back up a fallback to scaling_cur_freq should be added to support amd-pstate's governor which only reports frequency from there https://docs.kernel.org/admin-guide/pm/amd-pstate.html#key-governors-support (I don't know which is more correct on other platforms/configurations but amd-pstate doesnt report cpuinfo_cur_freq at all). |
|
@shirou , need something to merge ? |
|
@alexwbaule I +1 this feature because it eases the ability to figure out any glitches during a benchmark. However I'd recommend to keep a flat structure such as: instead of using a So far no other collected metric use any sub-structure. It would be better IMHO to keep it that way. |
ccoVeille
left a comment
There was a problem hiding this comment.
It's a breaking change but why not
| Microcode string `json:"microcode"` | ||
| } | ||
|
|
||
| type Mhz struct { |
There was a problem hiding this comment.
I would use MHz
And while you are changing the type and so the output format, I would change the Mhz variable name in the struct
But here,I'm only a random Gopher.
The maintainers of this project might have another opinion
| c.Mhz.Current = float64(u32) | ||
| c.Mhz.Min = 0 | ||
| c.Mhz.Max = 0 | ||
|
|
There was a problem hiding this comment.
At some point if it's for test purpose that you are resetting it
| c.Mhz.Current = float64(u32) | ||
| c.Mhz.Min = 0 | ||
| c.Mhz.Max = 0 |
There was a problem hiding this comment.
Please consider writing this
| c.Mhz.Current = float64(u32) | |
| c.Mhz.Min = 0 | |
| c.Mhz.Max = 0 | |
| c.Mhz = Mhz{Current: float64(u32)} |
Abd everywhere you did the replacement
| c.Mhz.Current = fillMhz(ctx, "cur", c) | ||
| c.Mhz.Min = fillMhz(ctx, "min", c) | ||
| c.Mhz.Max = fillMhz(ctx, "max", c) |
There was a problem hiding this comment.
I would pass
| c.Mhz.Current = fillMhz(ctx, "cur", c) | |
| c.Mhz.Min = fillMhz(ctx, "min", c) | |
| c.Mhz.Max = fillMhz(ctx, "max", c) | |
| c.Mhz.Current = fillMhz(ctx, "cpuinfo_cur_freq", c) | |
| c.Mhz.Min = fillMhz(ctx, "cpuinfo_min_freq", c) | |
| c.Mhz.Max = fillMhz(ctx, "cpuinfo_max_freq", c) |
And then I would use
| c.Mhz.Current = fillMhz(ctx, "cur", c) | |
| c.Mhz.Min = fillMhz(ctx, "min", c) | |
| c.Mhz.Max = fillMhz(ctx, "max", c) | |
| c.Mhz = Mhz{Current: fillMhz(ctx, "cpuinfo_cur_freq", c), Min: fillMhz(ctx, "cpuinfo_min_freq", c), Max: fillMhz(ctx, "cpuinfo_max_freq", c)} |
| var line float64 | ||
| var mhz float64 = 0 | ||
|
|
||
| if value == "min" || value == "max" || value == "cur" { |
There was a problem hiding this comment.
Add a switch here and return 0 if the value are not the one you expect
Implement of #1516
Please, is my first PR here, and i only have Linux to test it.