• Курсы Академии Кодебай, стартующие в мае - июне, от команды The Codeby

    1. Цифровая криминалистика и реагирование на инциденты
    2. ОС Linux (DFIR) Старт: 16 мая
    3. Анализ фишинговых атак Старт: 16 мая Устройства для тестирования на проникновение Старт: 16 мая

    Скидки до 10%

    Полный список ближайших курсов ...

процент загрузки процессора для Mfc(c++)

  • Автор темы sergikzhivot
  • Дата начала
S

sergikzhivot

как программно снять процент загрузки процессора для MFC(C++)
 
@

@LE}{@NDER

Думаю тебе нужны следующие структура и функция (для полной инфы ищи в МСДНе):

1) SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION

When the SystemInformationClass parameter is SystemProcessorPerformanceInformation, the buffer pointed to by the SystemInformation parameter should be large enough to hold an array that contains as many SYSTEM_PROCESS_INFORMATION structures as there are processors (CPUs) installed in the system. Each structure has the following layout:
Код:
typedef struct
_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
LARGE_INTEGER IdleTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER Reserved1[2];
ULONG Reserved2;
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
The IdleTime member contains the amount of time that the system has been idle, in 100-nanosecond intervals.

The KernelTime member contains the amount of time that the system has spent executing in Kernel mode (including all threads in all processes, on all processors), in 100-nanosecond intervals.

The UserTime member contains the amount of time that the system has spent executing in User mode (including all threads in all processes, on all processors), in 100-nanosecond intervals.

GetSystemTimes()

2) GetSystemTimes() Function

Retrieves system timing information. On a multiprocessor system, the values returned are the sum of the designated times across all processors.
Код:
BOOL WINAPI GetSystemTimes(
__out		 LPFILETIME lpIdleTime,
__out		 LPFILETIME lpKernelTime,
__out		 LPFILETIME lpUserTime
);
Parameters
lpIdleTime
A pointer to a FILETIME structure that receives the amount of time that the system has been idle.

lpKernelTime
A pointer to a FILETIME structure that receives the amount of time that the system has spent executing in Kernel mode (including all threads in all processes, on all processors).

lpUserTime
A pointer to a FILETIME structure that receives the amount of time that the system has spent executing in User mode (including all threads in all processes, on all processors).

Return Value
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.
 
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!