Cpu Ve Memory Kullanımını C++ İle Öğrenmek ??
-
Sayın müridler,
Başlık gayet açık, platform bağımsız bu işi yapmak istiyorum. Sıcaklık falan da öğrenmek istiyorum. Bir yol gösterin. -
Bu tip işlemleri yapabileceğin açık kaynak lib;
https://github.com/hyperic/sigar
+
http://msdn.microsoft.com/en-us/library/ms683219.aspx
-
http://msdn.microsoft.com/en-us/library/aa389762%28v=VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/aa394493%28VS.85%29.aspx
veya
http://www.alcpu.com/CoreTemp/developers.html
ZINDIK tarafından 13/Eyl/13 12:01 tarihinde düzenlenmiştir -
Hocam platform bağımsız istiyorsan bunun için bazı kütüphaneler var.
https://support.hyperic.com/display/SIGAR/Home
Ben daha önce bunu kullanmıştım. Java ile düzgün çalışıyordu. Yanlış hatırlamıyorsam native versionları da mevcut zaten içinde.
Kolay gelsin :)
-
#include <iostream>
#include <windows.h>
#include <conio.h>
#include <memory.h>
using namespace std;
unsigned long long GetCycleCount()
{
asm(".intel_syntax noprefix\nrdtsc\n\nleave\nret\n.att_syntax noprefix\n");
}
unsigned long GetCPUSpeed()
{
unsigned long long ullStart, ullStop;
ullStart = GetCycleCount();
Sleep(1000);
ullStop = GetCycleCount();
return (unsigned long)((ullStop - ullStart) / 100000);
}
int main()
{
MEMORYSTATUS MemStat;
memset(&MemStat, 0, sizeof(MemStat));
::GlobalMemoryStatus(&MemStat);
cout << "Memory Size: \t" << MemStat.dwTotalPhys / 1024 / 1024 << " MB" << endl;
cout << "Cpu Speed: \t" << ((float)GetCPUSpeed() / 10000.0f) << " Ghz" << endl;
getch();
return 0;
}bir ara böyle bişi bulmuştum belki işine yarar
-
Sigar'ı kullanayım dedim VS2008 ile bir türlü entegre edemedim. bir el atın.
uLtRaLoVeR tarafından 13/Eyl/13 16:41 tarihinde düzenlenmiştir
Error 1 error C3861: 'sigar_open': identifier not found
