尝试在Windows PC上禁用处理器空闲状态(C状态) [英] Trying to disable Processor idle states (C states) on Windows PC

查看:2358
本文介绍了尝试在Windows PC上禁用处理器空闲状态(C状态)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要防止处理器进入空闲状态(非C0 C状态)。诚然,我不知道处理器C和P状态,所以忍受我。
我们使用来自第三方供应商的相机,偶尔发送损坏的帧。供应商已经确定当CPU进入空闲状态时,它干扰帧在火线上的传输。
要确认这一点,我在Windows 7 PC上使用了下面的代码,确实,禁用空闲状态解决了问题。

I need to prevent the processor from entering an idle state (non C0 C state). Admittedly I do not know much about processor C and P states so bear with me. We use a camera from a third party vendor which occasionally delivers corrupted frames. The vendor has determined that when the CPU enters an idle state it interferes with the transmission of the frame over the firewire. To confirm this I used the following code on a Windows 7 PC and indeed, disabling the idle states resolved the issue.

   //WIN7
const DWORD DISABLED = 1;
const DWORD ENABLED = 0;
GUID *scheme;
PowerGetActiveScheme(NULL, &scheme);
PowerWriteACValueIndex(NULL, scheme, &GUID_PROCESSOR_SETTINGS_SUBGROUP, &GUID_PROCESSOR_IDLE_DISABLE, DISABLED);
PowerSetActiveScheme(NULL, scheme);

如果我运行我的应用程序并打开Windows permon并添加%C1时间,%C2时间和% C3时间我看到他们都是零,当我禁用这些状态,当我启用他们我看到相当多的时间花在C3状态(这是在Dell Precision T3500四核电脑)。

If I run my application and open Windows permon and add the %C1 Time, %C2 Time and %C3 time I see that they are all zero when I disable these states, when I enable them I see quite a bit of time spent in the C3 state (this is on a Dell Precision T3500 quad core PC).

我也需要在XP上这样做,但是这些调用在XP上不可用。所以我试图执行以下操作禁用空闲状态

I also need to do this on XP however these calls are not available on XP. So I attempted to do the following to disable the idle states

  unsigned int ActPwrSch; 
DWORD currPolicy,newPolicy, curr1Policy,curr2Policy, new1Policy, new2Policy;
MACHINE_PROCESSOR_POWER_POLICY Policy; 
if(GetActivePwrScheme(&ActPwrSch)) 
{ 
    if(ReadProcessorPwrScheme(ActPwrSch,&Policy)) 
    { 
        printf("Read Power Scheme:\n"); 
        //if(Policy.ProcessorPolicyAc.DisableCStates!=0) 
        currPolicy = Policy.ProcessorPolicyAc.Policy[0].AllowPromotion;
        curr1Policy = Policy.ProcessorPolicyAc.Policy[1].AllowPromotion;
        curr2Policy = Policy.ProcessorPolicyAc.Policy[2].AllowPromotion;
        Policy.ProcessorPolicyAc.Policy[0].AllowPromotion = 0;
        Policy.ProcessorPolicyAc.Policy[1].AllowPromotion = 0;
        Policy.ProcessorPolicyAc.Policy[2].AllowPromotion = 0;
        newPolicy = Policy.ProcessorPolicyAc.Policy[0].AllowPromotion;

        if(WriteProcessorPwrScheme(ActPwrSch,&Policy)) 
        { 
            printf("WriteProcessorPwrScheme succeed\n"); 
            if(SetActivePwrScheme(ActPwrSch,0,0)) 
            { 
                printf("SetActivePwrScheme succeed!!\n");
            } 
        }

    } 

我运行我的应用程序我仍然看到处理器花费时间在C1状态(通过查看perfmon中的相同的计数器)。我仍然得到我的损坏的图像问题。 XP PC是单核Dell Optiplex PC。

However when I run my application I still see that the processor is spending time in the C1 state (by looking at the same counters in perfmon). And I still get my corrupted image problem. The XP PC is an single core Dell optiplex PC.

有人知道我如何防止进入任何C1-C3状态在XP?

Does anybody know how I can prevent entry into any of the C1-C3 states on XP? As I said it seems that I have done it on Windows 7.

推荐答案

当然,TSR每5分钟运行一次数学计算防止空闲状态?
或者,您可以购买一个便宜的硬件或软件鼠标模拟器,以定义的间隔发送鼠标移动信号。

Surely a TSR running a mathematical calculation every 5 minutes will prevent an idle state? Alternatively you can purchase a cheap hardware or software mouse emulator that sends a mouse move signal at defined intervals.

这篇关于尝试在Windows PC上禁用处理器空闲状态(C状态)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆