PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2025 → API Windows CPU
API Windows CPU
Débuté par toto28toto, 05 jan. 2005 17:36 - 2 réponses
Posté le 05 janvier 2005 - 17:36
Bonjour, je recherche une astuce pour connaitre le taux d'utilisation du CPU sur une plateforme WINDOWS 32 Bits.

Je pense utiliser l'API KERNEL32 et GetSystemInfo.
Par contre pour connaitre le taux je ne trouve rien.

Si quelqu'un à une idée...

En vous remerciant d'avance cordialement.

Sébastien
Posté le 05 janvier 2005 - 17:56
GetSystemInfo renvoi un pointeur sur une structure de type struct
_SYSTEM_INFOJe ne vois pas dedans le taux d'utilisation du CPUci joint une
partie de l'aide de microsoft
http://msdn.microsoft.com/library/default.asp…
struct _SYSTEM_INFO { union { DWORD dwOemId; struct { WORD
wProcessorArchitecture; WORD wReserved; }; }; DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress;
DWORD_PTR dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD
dwProcessorType; DWORD dwAllocationGranularity; WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO;Members
dwOemId
An obsolete member that is retained for compatibility with Windows NT 3.5
and earlier. New applications should use the wProcessorArchitecture branch
of the union.
Windows Me/98/95: The system always sets this member to zero, the value
defined for PROCESSOR_ARCHITECTURE_INTEL.
wProcessorArchitecture
System's processor architecture. This value can be one of the following
values:
PROCESSOR_ARCHITECTURE_UNKNOWN
PROCESSOR_ARCHITECTURE_INTEL
PROCESSOR_ARCHITECTURE_IA64
PROCESSOR_ARCHITECTURE_AMD64

wReserved
Reserved for future use.
dwPageSize
Page size and the granularity of page protection and commitment. This is
the page size used by the VirtualAlloc function.
lpMinimumApplicationAddress
Pointer to the lowest memory address accessible to applications and
dynamic-link libraries (DLLs).
lpMaximumApplicationAddress
Pointer to the highest memory address accessible to applications and DLLs.
dwActiveProcessorMask
Mask representing the set of processors configured into the system. Bit 0
is processor 0; bit 31 is processor 31.
dwNumberOfProcessors
Number of processors in the system.
dwProcessorType
An obsolete member that is retained for compatibility with Windows NT 3.5
and earlier. Use the wProcessorArchitecture, wProcessorLevel, and
wProcessorRevision members to determine the type of processor.
Windows Me/98/95: Specifies the type of processor in the system. This
member is one of the following values:

PROCESSOR_INTEL_386
PROCESSOR_INTEL_486
PROCESSOR_INTEL_PENTIUM
dwAllocationGranularity
Granularity for the starting address at which virtual memory can be
allocated. For more information, see VirtualAlloc.
wProcessorLevel
System's architecture-dependent processor level. It should be used only
for display purposes. To determine the feature set of a processor, use the
IsProcessorFeaturePresent function.
If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_INTEL, wProcessorLevel
is defined by the CPU vendor.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_IA64, wProcessorLevel
is set to 1.

wProcessorRevision
Architecture-dependent processor revision. The following table shows how
the revision value is assembled for each type of processor architecture.
"Sébastien" <toto28toto@tiscali.fr> a écrit dans le message de
news:41dbff37$1@news.pcsoft.fr...

Bonjour, je recherche une astuce pour connaitre le taux d'utilisation du

CPU sur une plateforme WINDOWS 32 Bits.

Je pense utiliser l'API KERNEL32 et GetSystemInfo.
Par contre pour connaitre le taux je ne trouve rien.

Si quelqu'un à une idée...

En vous remerciant d'avance cordialement.

Sébastien
Posté le 06 janvier 2005 - 11:21
Bonjour, justement je ne trouve pas d'infos pour calculer le taux d'utilisation du CPU.
Si quelqu'un arrive à me guider sur l'API à utiliser.

En vous remerciant d'avance

Seb