delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/18/03:05:21

From: fabio AT joplin DOT colorado DOT edu (Fabio Somenzi)
Subject: Re: No GetProcessTimes on Win 95 (was (Fwd) Re: Function t
18 Dec 1996 03:05:21 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199612180955.CAA15121.cygnus.gnu-win32@joplin.colorado.edu>
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

->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: Fabio AT Colorado DOT EDU
Boulder CO 80309-0425  | WWW:   http://vlsi.colorado.edu/~fabio
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019