Subject: Re: No GetProcessTimes on Win 95 (was (Fwd) Re: Function t
From: [email-masked] (Richard Donkin)

19 Dec 1996 07:12:22 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Original-To: [email-masked]
Original-Cc: [email-masked], [email-masked]
Original-Sender: [email-masked]

In-Reply-To: <[email-masked]>
> ->To quote directly from "Advanced Windows" by Jeffrey Richter (Microsoft
> ->Press), as included on the "Microsoft Press Programmer's Bookshelf for
> ->Windows 95" CD-ROM:
> ->
> ->   Unfortunately, the GetThreadTimes and GetProcessTimes functions are 
> > not
> ->   functional in Windows 95. If you call either of these functions in 
> > Windows 95,
> ->   they return FALSE. A subsequent call to GetLastError returns a value 
> > of 120
> ->   (ERROR_CALL_NOT_IMPLEMENTED), which indicates that these functions
> ->   are valid only in Windows NT.
> ->
> ->   There is no reliable mechanism for an application to determine how 
> > much CPU
> ->   time a thread or process has used under Windows 95.
> ->
> ->This doesn't necessarily mean there is no way to get a
> ->reasonable number most of the time. But it does mean that
> ->it's probably too difficult to spend time implementing
> ->unless you really really really need it.
> ->
> ->Colin.
> 
> Well, I guess that back in 1995 per-process CPU time was too advanced
> for your average OS :-)
> 
> Seriously, thanks Colin for the info. I guess at this point I'd be happy
> to have a solution that is portable and degrades gracefully. For
> instance, a function that reports elapsed time if process time cannot
> be measured. I was thinking that getrusage would be the right function
> to use for that purpose, because it returns a status value (unlike times).

There are tools on Win95 that measure per-process and even per-thread CPU 
time, possibly via undocumented APIs.  As I type, my mail program has used 5 
mins 59 seconds of CPU time, for example, according to WinTop, which is part 
of the Microsoft Kernel Toys.  You can download these from www.microsoft.com 
- can't remember the URL but the filename is krnltoys.exe and it is probably 
findable from www.shareware.com etc.  There is no source, though.
 
> If getrusage is implemented on top of GetProcessTimes (I've no idea
> whether that's the case), then it should be easy to test the return
> value of the latter and possibly call GetLastError. In case of failure
> errno may be set to EINVAL.
> 
> Currently, getrusage returns 0 on Win95, even though the times reported are
> wrong.
> 
> Fabio
> --
> Fabio Somenzi          | Phone: 303-492-3466
> University of Colorado | Fax:   303-492-2758
> ECE Dept.              | Email: [email-masked]
> Boulder CO 80309-0425  | WWW:   http://vlsi.colorado.edu/~fabio
> -
> For help on using this list, send a message to
> "[email-masked]" with one line of text: "help".

Richard
--
[email-masked]                http://www.inside-edge.co.uk/
Inside Edge Consultancy           Client/Server and Internet Applications
PGP key from:  [email-masked]  -or-  http://www.four11.com/

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".