Recent

Author Topic: Win10 have a option, set maxim CPU work for MsMpEng.exe?  (Read 1375 times)

d2010

  • Full Member
  • ***
  • Posts: 168
Win10 have a option, set maxim CPU work for MsMpEng.exe?
« on: January 07, 2025, 05:18:49 pm »
Happy new year2025
The Microsoft Antivirus inside Win10, they user/s can set limit of CPU at max40%.
I have my application.exe (E.g. Any console.app.lpr)
How to set max of cpu-work  with Lazarus for my app.exe?

Code: [Select]
Directory of C:\Program Files\Windows Defender
04/11/2018  06:29 PM           395,304 MpCmdRun.exe
04/11/2018  06:29 PM            69,016 MpUXSrv.exe
04/11/2018  06:29 PM           974,232 MSASCui.exe
04/11/2018  06:29 PM           486,816 MSASCuiL.exe
04/11/2018  06:29 PM            85,016 MsMpEng.exe

Fibonacci

  • Hero Member
  • *****
  • Posts: 753
  • Internal Error Hunter
Re: Win10 have a option, set maxim CPU work for MsMpEng.exe?
« Reply #1 on: January 07, 2025, 05:33:23 pm »
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadaffinitymask

You cant limit your app to a specific CPU % using WinAPI. To achieve this, you will need to add small delays in your app, like in heavy work loops (compression? encryption? parsing something?).

 

TinyPortal © 2005-2018