From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,212d0edbd5d28969 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-30 06:35:06 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: Cpu usage in ada? Date: 30 Oct 2002 06:35:05 -0800 Organization: http://groups.google.com/ Message-ID: <4519e058.0210300635.546116f1@posting.google.com> References: NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1035988506 25413 127.0.0.1 (30 Oct 2002 14:35:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 30 Oct 2002 14:35:06 GMT Xref: archiver1.google.com comp.lang.ada:30230 Date: 2002-10-30T14:35:06+00:00 List-Id: "SteveD" wrote in message news:... > "Sim Con" 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? :-)