Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

.net - Windows - CPU power management APIs

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)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...