comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com (Ted Dennison)
Subject: Re: Cpu usage in ada?
Date: 30 Oct 2002 06:35:05 -0800
Date: 2002-10-30T14:35:06+00:00	[thread overview]
Message-ID: <4519e058.0210300635.546116f1@posting.google.com> (raw)
In-Reply-To: GrIv9.6803$iW.11642@rwcrnsc52.ops.asp.att.net

"SteveD" <nospam_steved94@attbi.com> wrote in message news:<GrIv9.6803$iW.11642@rwcrnsc52.ops.asp.att.net>...
> "Sim Con" <sicon@hotmail.com> wrote in message
> news:b4a38a5f675eb2c7e9430d1b934558a4.110780@mygate.mailgate.org...
> > Hello! I need to build a cpu usage meter in ada95 for a windows system.
> > Any help? ^_^ Thanx in advance!!
> >
> 
> This isn't really an Ada question.  It is more of a Windows question.  I
> would suggest scouring the Win32 API's to find a function that returns CPU
> usage information.

You'd think so, but that would be too easy....

In fact, the right answer depends on what Windoze OS you are using. If
I remember correctly, Win9x has an API for it left over from the early
non-preemptive Windows days. However, that API is not available in NT
based OS's (NT, 2K, and XP). In those OS's, information like the list
of running processes and CPU utilization (basicly everything you can
get from perfmon) is stored in the registry, of all places. Its in a
special virtual key (HKEY_PERFORMANCE_DATA) that doesn't show up in
regedt32, and gets updated in realtime. Its also in a special format
that has to be parsed in a special way. Isn't that special! :-)

And of course this key isn't available to non NT-based OS's. So if you
want to write a program that works with both, you have to essentially
write your program twice, using two completely different methods and a
big "if NT" statement at the top. Thankfully these days you can
typically label Win9x systems "legacy" and refuse to support them, but
that's a recent development.

What's this I hear about Unix being fragmented? :-)



  reply	other threads:[~2002-10-30 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-29 15:51 Cpu usage in ada? Sim Con
2002-10-29 23:54 ` Karen
2002-10-30  3:38   ` SteveD
2002-10-30 14:24     ` Ted Dennison
2002-10-30  3:35 ` SteveD
2002-10-30 14:35   ` Ted Dennison [this message]
2002-10-30  4:56 ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox