1. CPU Usage
2. CPU Usage를 구하고 싶어서 이것저것 시도해 보았는데, 일단은 WMI 와 AdCpuUsage를 알게 되었다. 여기서 쓰인 것은 AdCpuUsage이다. 이것으로 대략적인 Cpu Usage를 받아 올 수 있었다.
** [WMI에 대한 정보들 ]**
[WMI]
WMI는 윈도우 관리 도구(Window Management Instrumentation)라고 하며, Windows에 대한 Microsoft 주요 관리 기술이라고 부른다.
모든 Windows 리소스를 엑세스, 구성, 관리 및 모니터링 할 수 있는 수단
http://kjcc2.tistory.com/1957
[Download URL]
https://code.google.com/p/delphi-wmi-class-generator/downloads/list
다음 게시글로 정리 中
3. AdCpuUsage 사이트는 아래와 같다.
http://www.aldyn.ru/products/cpu_usage/index.html
4. 위 사이트에 접속을 하고, Download 를 눌러 다운로드 할 수 있다. 버전은 델파이 5까지 이므로, 나머지는 adCpuUsage.pas 를 사용하도록 한다.
압축을 풀고 readme.txt 를 열어보면 아래와 같은 내용을 볼 수 있다.
CPU Usage Measurement routines for Delphi and C++ Builder
Compatible with Windows 95/98/NT/2000
Version: 1.02
Creation: Jul 8, 2000
Unit: adCpuUsage.pas
USAGE:
1. Include this unit into project.
2. Call GetCPUCount to obtain the numbr of processors in the system
3. Each time you need to know the value of CPU usage call the CollectCPUData
to refresh the CPU usage information. Then call the GetCPUUsage to obtain
the CPU usage for given processor. Note that succesive calls of GetCPUUsage
without calling CollectCPUData will return the same CPU usage value.
Windows 2000 notes:
The GetCPUCount returns the value that equals to the number of CPUs plus one.
The call GetCPUUsage(GetCPUCount-1) returns the total CPU usage value in this case.
Example:
procedure TTestForm.TimerTimer(Sender: TObject);
var i: Integer;
begin
CollectCPUData; // Get the data for all processors
for i:=0 to GetCPUCount-1 do // Show data for each processor
MInfo.Lines[i]:=Format('CPU #%d - %5.2f%%',[i,GetCPUUsage(i)*100]);
end;
Author: Alexey A. Dynnikov
EMail: aldyn@chat.ru
WebSite: http://www.aldyn.ru/
Support: Use the e-mail aldyn@chat.ru
or support@aldyn.ru
위의 Example 부분을 주목하라. 타이머(TimerTimer)를 이용하여 주기적으로 데이터를 받아와 뿌려주고 있다.
사용시 반드시 AdCpuUsage.pas를 프로젝트에 추가 시켜주도록 한다.
(Project -> Add to Project)
1번에 표시된 그림의 프로그램 코드는 아래와 같다.
3. Sorce
'Programming > Delphi' 카테고리의 다른 글
Delphi 자동 중정렬 (0) | 2014.05.13 |
---|---|
Delphi 시간 측정(QueryPerformanceCounter) (0) | 2014.05.12 |
Delphi 배열 프로시저(Array Procedure) (0) | 2014.02.05 |
Delphi save, read record (0) | 2014.01.16 |
AdvStringGrid popup (0) | 2014.01.09 |