Skip to content

A tutorial on interacting with the Windows System Assessment Tool (WinSAT) API in .NET.

License

Notifications You must be signed in to change notification settings

BL1NDX3N0N/WinSAT-API-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

WinSAT API Tutorial

A tutorial on interacting with the Windows System Assessment Tool (WinSAT) API in .NET.

The WinSAT API enables developers to retrieve computer performance and assessment state information from WinSAT. This enables developers to determine optimal application and video game settings based on a computers performance capabilities using data provided by WinSAT.

Microsoft not only uses WinSAT as a way to adjust the performance of Windows based on a computers performance capabilities, they also provided an API for developers to do the same with their applications and games as well.

Understanding WinSAT:

WinSAT first shipped starting with Windows Vista. During the installation process of Vista and later, a formal WinSAT assessment is ran. In later versions of Windows, an assessment is ran in the background regularly based on a set schedule. This serves as a benchmark in order for Windows to determine optimal system and performance settings including visual effects such as Aero. In earlier versions of Windows, the Windows Experience Index application could be used to review a systems base score and several subscores across different hardware categories. A systems base score is always equal to the lowest subscore, indicating which component should be upgraded first. It wasn’t until Windows 8.1 when Microsoft removed the Windows Experience Index application. Different versions of Windows have a different range of minimum to maximum scores.

Windows Vista: 1.0 - 5.9
Windows 7: 1.0 - 7.9
Windows 8 and later: 1.0 - 9.9

Using:

Retrieving assessment state:

AssesmentState assesmentState = Assesment.State;

if (assesmentState == AssesmentState.Valid)
{
    // There is a valid WinSAT assesment available.
}

Or:

if (Assesment.State == AssesmentState.Valid)
{
    // There is a valid WinSAT assesment available.
}

Retrieving assesment scores:

float cpuScore = 0f;

if (Assesment.State == AssesmentState.Valid)
{
    cpuScore = Assesment.CPUScore;
}

Putting it together (using Unity3D):

private void AutoDetect()
{
    if (Assesment.State == AssesmentState.Valid)
    {
        float d3dScore = Assesment.D3DScore;

        if (d3dScore >= 1.0f && d3dScore <= 3.3f)
        {
            // Low settings.
            QualitySettings.SetQualityLevel(0, false);
        }
        else if (d3dScore >= 3.3f && d3dScore <= 6.6f)
        {
            // Medium settings.
            QualitySettings.SetQualityLevel(1, false);
        }
        else
        {
            // Max settings.
            QualitySettings.SetQualityLevel(2, false);
        }
    }
    else
    {
        // An assesment is not available to read from. Here you would use another method.
    }
}

This is just a very basic example. For production purposes it is recommended that you adjust individual settings of your game based on the hardware component being utilized. For example, a low D3D score should result in resolution reduction of both textures and the framebuffer while low CPU scores should result in reduced animation quality, asset streaming activity, CPU-driven physics simulations, etc..

An example application made for demonstration purposes:

An example project created using the WinSAT API.

Requirements:

Windows Vista and later.

Disclaimer:

WinSAT should not be used for the sole purpose of system benchmarking. WinSAT determines hardware scores by running tests that reflect daily to intense operations (per Microsoft) and then comparing execution times of said operations to a pre-defined dataset.

About

A tutorial on interacting with the Windows System Assessment Tool (WinSAT) API in .NET.

Topics

Resources

License

Stars

Watchers

Forks

Languages