Windows - CPU power management APIs

落花浮王杯 提交于 2019-11-27 03:30:57

问题


What APIs are provided by Windows for CPU power management (I'm interested in CPU frequency scaling, setting min and max CPU frequency - similar to what you can do in Control Panel in power plans, but in a programmatic way). I'm also interested in .Net APIs. (It is not something I intend to use in a production environment, but rather as a proof of concept for some dynamic power management algorithms)


回答1:


The C++ Power Management APIs: http://msdn.microsoft.com/en-us/library/aa373170.aspx

.NET Power Management APIs are in the Microsoft.Win32 namespace.

Example from http://msdn.microsoft.com/en-us/library/hxkc1kwd.aspx:

private void powerModeChanged(System.Object sender, Microsoft.Win32.PowerModeChangedEventArgs e)
{
    int si = SystemInformation.PowerStatus;
    switch (si)
    {
        case BatteryChargeStatus.Low:
            MessageBox.Show("Battery is running low", MessageBoxIcon.Exclamation);
        case BatteryChargeStatus.Low:
            MessageBox.Show("Battery is critically low", MessageBoxIcon.Stop);
        Default:
            // Battery is okay.
    }
}

You can find lots more by poking around in that namespace.




回答2:


Have you tried digging in the power-management API ?




回答3:


Have you checked the WMI way ? The Win32_Processor class provides a lot of informations like LoadPercentage, PowerManagementCapabilities...

http://msdn.microsoft.com/en-us/library/aa394373%28VS.85%29.aspx

WMI Reference : http://msdn.microsoft.com/en-us/library/aa394572%28VS.85%29.aspx



来源:https://stackoverflow.com/questions/2450902/windows-cpu-power-management-apis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!