简体   繁体   English

进程关联性更改通知

[英]Notification on process affinity change

Is it possible to be notified immediately when an external party changes your programs process affinity?当外部方更改您的程序进程关联时,是否可以立即收到通知? Without polling GetProcessAffinityMask().无需轮询 GetProcessAffinityMask()。 For example if a user decides to change it via the task manager.例如,如果用户决定通过任务管理器更改它。

EDIT: This answer happened before the edit that added "Without polling GetProcessAffinityMask()" and did not specify the language of the check.编辑:这个答案发生在添加“不轮询GetProcessAffinityMask()”并且没有指定检查语言的编辑之前。

Yes, it's doable with a PowerShell for example.是的,例如 PowerShell 是可行的。 Set some base data once and make comparisons every once in a while.设置一些基础数据,每隔一段时间做一次比较。

You can get processes with Get-Process ( documentation ) which returns System.Diagnostics.Process object ( documentation ) with Process.ProcessorAffinity ( documentation ) property.您可以使用Get-Process ( documentation ) 获取进程,它返回System.Diagnostics.Process object ( documentation ) 和Process.ProcessorAffinity ( documentation ) 属性。

So getting the affinity would look like:所以获得亲和力看起来像:

Get-Process PROCESS | Select-Object ProcessorAffinity

And with that - you can set your notifications (either mail, desktop or any other).有了它 - 你可以设置你的通知(邮件、桌面或任何其他)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM