fearful-symmetry / gorapl

A user-friendly, low-level API for accessing Intel's RAPL feature set
Apache License 2.0
1 stars 1 forks source link

Formulate write algorithms & API #4

Open fearful-symmetry opened 5 years ago

fearful-symmetry commented 5 years ago

So, embarrassingly, I don't have nearly as much experience writing to MSRs as I do reading them. This has lead me to wonder how we want to update single values in a write. Presumably modifying the MSR itself isn't hard, and applying a binary AND to the existing value and writing it back will be enough.

The API is a little more interesting: I'm thinking an Option Type that allows us to specify an arbitrary number of values to update might be best:

raplHandler.UpdatePowerLimit(gorapl.OptionLock(true), gorapl.OptionEnableLimit1(true))

Another option would be a struct with &int pointers, as this would allow us to distinguish between uninitialized values. Having pointers everywhere seems awkward, but it's certainly an option.

fearful-symmetry commented 5 years ago

Another consideration is the units in the write API. For example, the SDM specifies the value for the Time Limit in the MSR_[DOMAIN]_POWER_LIMIT as: Time limit = 2^Y * (1.0 + Z/4.0) * Time_Unit

Should we expect the user to do that math? Do they give a value in whatever unit and we convert it?

fearful-symmetry commented 5 years ago

5 Is going to make this a bit of a pain, as we'll have to 'reverse' the multiplier function to turn the data back into something we write to a register.