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

18 Dec 1996 03:05:21 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
Original-Sender: [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).

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".