• Welcome to Valhalla Legends Archive.
 

system statistics

Started by DVX, January 25, 2004, 10:39 PM

Previous topic - Next topic

DVX

how would i go about creating a relatively small program which gets some system statistics such as uptime, memory usage, cpu usage, etc.  are there any particular functions which can do this all?

the main things i want to beable to do are:  uptime, cpu usage, and memory usage..  i know you can find out most of this by ctrl + alt + del on winxp, but i use win98, and can't do that..  so that's one reason i want to make a program for this, and also a few other things..

anyone have any ideas?

Grok

Yes, and I'm not attempting to be smart or funny.  Get rid of Win98 and get WinXP.

DVX

i'm reformatting in a few days, win98 just came with the system, so it's just temporary..

but i still want to make a program that gets that information;  something like skywing's high resolution uptime program..

iago

I'm going to hazard to guess you're using vb.  Add an about form to your project (one of the premade forms) and then run the program and click "System Info".
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


DVX

#4
c++ :P

but i did find something in regards to the system uptime statistic..  i used GetTickCount() function from the windows api..  basically, i did a lot of things such as:


int systemuptime = GetTickCount();
int secondsuptime;
for (; systemuptime >= 1000; secondsuptime++)
systemuptime -= 1000;
std::cout << secondsuptime; // prints the seconds the system has been online


but i still want to get statistical information of the system such as cpu usage, memory usage, and other miscellaneous things..  any ideas or functions which can do this?

Adron

#5
Umm, did you ever realize that there's a name for "finding out how many times X (like, X=1000) goes into a number Y"? It's called "division", and the answer is Y / X. :P

dxoigmn

Quote from: Adron on January 26, 2004, 03:16 PM
Umm, did you ever realize that there's a name for "finding out how many times X (like, X=1000) goes into a number Y"? It's called "division", and the answer is Y / X. :P

To add: secondsuptime isn't even intialized to 0, therefore the value of secondsuptime after that for-loop is arbitrary.

Adron

That might've been covered by the "such as" part. But I doubt that he'd explain division using a for loop unless that's the way he wrote it. But I suppose that's one way of doing it..

Kp

You can get CPU usage (broken down by user / kernel / idle time) with GetSystemTimes.  First available in Windows XP SP1 and Windows Server 2003.  To gather information about memory usage, use GlobalMemoryStatus or GlobalMemoryStatusEx.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!