delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/19/07:12:22

From: richardd AT cix DOT compulink DOT co DOT uk (Richard Donkin)
Subject: Re: No GetProcessTimes on Win 95 (was (Fwd) Re: Function t
19 Dec 1996 07:12:22 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <memo.700455.cygnus.gnu-win32@cix.compulink.co.uk>
Reply-To: richardd AT cix DOT compulink DOT co DOT uk
Original-To: fabio AT joplin DOT colorado DOT edu
Original-Cc: richardd AT cix DOT compulink DOT co DOT uk, gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

In-Reply-To: <199612180955 DOT CAA15121 AT joplin DOT colorado DOT edu>
> ->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: 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".


Richard
--
richardd AT cix DOT compulink DOT co DOT uk                http://www.inside-edge.co.uk/
Inside Edge Consultancy           Client/Server and Internet Applications
PGP key from:  pgp-public-keys AT keys DOT pgp DOT net  -or-  http://www.four11.com/

-
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