Valhalla Legends Forums Archive | General Programming | system statistics

AuthorMessageTime
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?
January 26, 2004, 4:39 AM
Grok
Yes, and I'm not attempting to be smart or funny. Get rid of Win98 and get WinXP.
January 26, 2004, 5:03 AM
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..
January 26, 2004, 5:10 AM
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".
January 26, 2004, 1:00 PM
DVX
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:

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

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?
January 26, 2004, 8:14 PM
Adron
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
January 26, 2004, 9:16 PM
kamakazie
[quote author=Adron link=board=5;threadid=4910;start=0#msg41220 date=1075151764]
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
[/quote]

To add: secondsuptime isn't even intialized to 0, therefore the value of secondsuptime after that for-loop is arbitrary.
January 26, 2004, 9:20 PM
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..
January 26, 2004, 9:24 PM
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.
January 26, 2004, 10:30 PM

Search