الشبكة العربية لمطوري الألعاب

محترف مشرف عبد اللطيف حاجي علي مشاركة 1

السلام عليكم

أعمل على برنامج (بلغة ++C كما يوضح موضوع المنتدى) حيث أحتاج إلى معرفة الـ CPU Usage (الذي يظهر في الـ Task Manager)
لقد بحثت في الـ MSDN و وجدت إجراءات جاهزة من أجل ذلك ولكن في VB و C# و C++ .Net و ليس في الـ Native ++C

فهل يملك أحد فكرة عن ذلك؟

عبد اللطيف حاجي علي
مبرمج
In|Framez

خبير  Mohammad Khashashneh مشاركة 2

Do you mean ISO C++ by native C++? Actually I don’t know anything about this in pure C++ since this always depends on what type of system you are using. Check out RegQueryValueEx for now, I’m assuming you use Windows because you mentioned MSDN. As for how to use it I’m sorry because I never used did. But I believe that you must record a number of CPU Usage values over an interval of time and then calculate the average.

Check the following link : http://www.geocities.com/SiliconValley/Horizon/2691/files.htm and take a look at the Memory Stat code. It is really complicated so I’ll try to dig more about it later.

من سار على الدرب وصل, من جد وجد...
بس عتبك على اللي بيسمع

محترف مشرف عبد اللطيف حاجي علي مشاركة 3

> Check out RegQueryValueEx for now,
I don’t get it, what is the relationship between CPU usage and registry entries??!!!!

> I’m assuming you use Windows because you mentioned MSDN.
Just to clear things up... who said that MSDN is specific to Windows?

> Check the following link : http://www.geocities.com/SiliconValley/Horizon/
> 2691/files.htm and take a look at the Memory Stat code. It is really
> complicated so I’ll try to dig more about it later
Thanks I found what I wanted (along with other cool stuff)…

Cheers,

عبد اللطيف حاجي علي
مبرمج
In|Framez

خبير مدير وسام البهنسي مشاركة 4

التعليق على مشاركة Abdo Haji-Ali في July 13, 2005 23:38 :

>> I’m assuming you use Windows because
> you mentioned MSDN.
> Just to clear things up... who
> said that MSDN is specific to Windows?

Well, MSDN is from MS, and Windows is from MS... So MSDN is for Windows ;)
Just kidding, but I think we all agree that 90% of MSDN is about technology from MS for Windows (except for the programming languages references I guess?)

> Thanks I found what I wanted (along
> with other cool stuff)…

Well? Would you be kind and post the routine that does it?


--
وسام البهنسي

وسام البهنسي
مبرمج في إنفيديا وإنفريمز

خبير  Mohammad Khashashneh مشاركة 5

I was going t ask the same thing.

محمد خشاشنة

من سار على الدرب وصل, من جد وجد...
بس عتبك على اللي بيسمع

محترف مشرف عبد اللطيف حاجي علي مشاركة 6

I thought the link is enough... Anyway I can't even if I want to; the function responsible for this task is very complicated calling other functions and using external variables
So you'll just have to follow the link, download the "Memory Stat" source and look for GetCPUUsage() (or something like that)

عبد اللطيف حاجي علي
مبرمج
In|Framez