<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Does something like this suffice?<BR>
Seconds used by current process as a float (including sub-second resolution).<BR>
<BR>
<BR>
<A href="http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/runtime/POSIX/Attic/RTProcessPosix.i3?rev=1.1;content-type=text%2Fplain">http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/runtime/POSIX/Attic/RTProcessPosix.i3?rev=1.1;content-type=text%2Fplain</A><BR>
<BR>
<BR>
<A href="http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/runtime/POSIX/Attic/RTProcessPosixC.c?rev=1.7;content-type=text%2Fplain">http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/runtime/POSIX/Attic/RTProcessPosixC.c?rev=1.7;content-type=text%2Fplain</A><BR><BR><BR>
Notice it is in Attic.<BR>
<BR>
<BR>
If not, can you write your own similar?<BR>
<BR>
<BR>
The full getrusage has that huge struct.. seems best to not expose the whole thing but have folks write little C wrappers for just what they need. A portable wrapper would copy out all the fields, for "all the fields" defined as all the ones implemented by all systems. Only to have most users probably ignore most of them.<BR>
<BR>
<BR>
Notice the cruft:<BR>
<BR>
<BR>
struct_rusage = RECORD<BR> ru_utime: Utime.struct_timeval; (* user time used *)<BR> ru_stime: Utime.struct_timeval; (* system time used *)<BR> ru_maxrss: long;<BR> ru_ixrss: long; (* integral shared text size *)<BR> (* Unsupported in Linux 1.0:<BR> ru_ismrss: long; (* integral shared memory size*)<BR> ******************************)<BR><BR>
<BR>
kind of makes you wonder....when the FreeBSD path has stuff commented out because Linux 1.0 doesn't support it, which parts are correct?<BR>
And is it still correct in FreeBSD 5, 6, 7, 9, 10? (Did it get copied blindly to other directoryes, like maybe Darwin?)<BR>
<BR>
<BR>
I guess the only client used utime and stime (based on the code in the Attic).<BR>
Mistakes here -- such as commenting out fields that are actually there -- would generally result in stack corruption, which might be ok, on some days, on some systems, with some compilers, with some compiler flags, depending on what is nearby on the stack, and what it gets overwritten with. Very dangerous stuff..<BR>
<BR>
<BR>
For Win32, lookup GetProcessTimes and GetThreadTimes.<BR>
<BR>
<BR>
getrlimit doesn't look so problematic, at least based on the FreeBSD4 version.<BR>
<BR>
<BR>
(Something is really weird with mail encoding, could be me, using a variety of modern mail clients..)<BR>
<BR>
<BR>
- Jay<BR> <BR>> To: jay.krell@cornell.edu<BR>> Date: Fri, 24 Apr 2009 23:32:29 -0700<BR>> From: mika@async.caltech.edu<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] Uresource on freebsd 4?<BR>> <BR>> <BR>> I use it for timing programs (getrusage). Is there another way of<BR>> doing that in Modula-3?<BR>> <BR>> This declaration:<BR>> <BR>> <*EXTERNAL*> PROCEDURE getrusage (who: int; VAR rus: struct_rusage): int;<BR>> <BR>> I'm sure getrlimit is useful too.<BR>> <BR>> These things have been in Modula-3 for a long time...<BR>> <BR>> It's the only thing that's missing that I personally use. Except<BR>> for some disturbances in m3tk things are now compiling for me...<BR>> <BR>> Mika<BR>> <BR>> <BR>> Jay writes:<BR>> >--_55ac72c8-d027-4bd6-a303-434a73dcc5db_<BR>> >Content-Type: text/plain; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><BR>> >Do you need it?<BR>> ><BR>> >Is there a sufficient common/Uresource.i3?<BR>> ><BR>> >=20<BR>> ><BR>> >I generally removed whatever isn't used=2C and made the remainders portable=<BR>> >.<BR>> ><BR>> >I can look into restoring more=2C but what do you need and what is there? (=<BR>> >I can look.)<BR>> ><BR>> >=20<BR>> ><BR>> >=20<BR>> ><BR>> > - Jay<BR>> ><BR>> >=20<BR>> >> To: m3devel@elegosoft.com<BR>> >> Date: Fri=2C 24 Apr 2009 22:58:23 -0700<BR>> >> From: mika@async.caltech.edu<BR>> >> CC: mika@camembert.async.caltech.edu<BR>> >> Subject: [M3devel] Uresource on freebsd 4?<BR>> >>=20<BR>> >>=20<BR>> >> Is there any particular reason Uresource no longer exists on FreeBSD4?<BR>> >> The m3makefile<BR>> >>=20<BR>> >> m3core/src/unix/freebsd-4/m3makefile<BR>> >>=20<BR>> >> looks like the following=2C and Uresource isn't picked up anywhere else:<BR>> >>=20<BR>> >> if TRUE<BR>> >>=20<BR>> >> Module ("Usignal")<BR>> >> Interface ("Uucontext")<BR>> >>=20<BR>> >> else<BR>> >>=20<BR>> >> Interface ("Udir")<BR>> >> Interface ("Uerror")<BR>> >> %Interface ("Ugrp")<BR>> >> Interface ("Uipc")<BR>> >> Interface ("Umman")<BR>> >> Module ("Umsg")<BR>> >> Interface ("Unix")<BR>> >> Interface ("Uprocess")<BR>> >> Interface ("Upthread")<BR>> >> Interface ("Upwd")<BR>> >> Interface ("Uresource")<BR>> >> Interface ("Usem")<BR>> >> Interface ("Usched")<BR>> >> Interface ("Ushm")<BR>> >> Module ("Usignal")<BR>> >> Interface ("Ustat")<BR>> >> Interface ("Usocket")<BR>> >> Interface ("Usyslog")<BR>> >> Interface ("Utime")<BR>> >> Module ("Utypes")<BR>> >> Interface ("Uucontext")<BR>> >> Interface ("Uugid")<BR>> >> Interface ("Uuio")<BR>> >> Interface ("Uutsname")<BR>> >>=20<BR>> >> end<BR>> >>=20<BR>> ><BR>> >--_55ac72c8-d027-4bd6-a303-434a73dcc5db_<BR>> >Content-Type: text/html; charset="iso-8859-1"<BR>> >Content-Transfer-Encoding: quoted-printable<BR>> ><BR>> ><html><BR>> ><head><BR>> <style><BR>> >.hmmessage P<BR>> >{<BR>> >margin:0px=3B<BR>> >padding:0px<BR>> >}<BR>> >body.hmmessage<BR>> >{<BR>> >font-size: 10pt=3B<BR>> >font-family:Verdana<BR>> >}<BR>> ></style><BR>> ></head><BR>> ><body class=3D'hmmessage'><BR>> >Do you need it?<BR><BR>> >Is there a sufficient common/Uresource.i3?<BR><BR>> > =3B<BR><BR>> >I generally removed whatever isn't used=2C and made the remainders portable=<BR>> >.<BR><BR>> >I can look into restoring more=2C but what do you need and what is there? (=<BR>> >I can look.)<BR><BR>> > =3B<BR><BR>> > =3B<BR><BR>> > =3B- Jay<BR><BR> =3B<BR>>=3B To: m3devel@elegosoft.com<BR>>=3B=<BR>> > Date: Fri=2C 24 Apr 2009 22:58:23 -0700<BR>>=3B From: mika@async.caltech=<BR>> >.edu<BR>>=3B CC: mika@camembert.async.caltech.edu<BR>>=3B Subject: [M3d=<BR>> >evel] Uresource on freebsd 4?<BR>>=3B <BR>>=3B <BR>>=3B Is there any =<BR>> >particular reason Uresource no longer exists on FreeBSD4?<BR>>=3B The m3m=<BR>> >akefile<BR>>=3B <BR>>=3B m3core/src/unix/freebsd-4/m3makefile<BR>>=3B=<BR>> > <BR>>=3B looks like the following=2C and Uresource isn't picked up anywh=<BR>> >ere else:<BR>>=3B <BR>>=3B if TRUE<BR>>=3B <BR>>=3B Module ("Usigna=<BR>> >l")<BR>>=3B Interface ("Uucontext")<BR>>=3B <BR>>=3B else<BR>>=3B <=<BR>> >BR>>=3B Interface ("Udir")<BR>>=3B Interface ("Uerror")<BR>>=3B %Inte=<BR>> >rface ("Ugrp")<BR>>=3B Interface ("Uipc")<BR>>=3B Interface ("Umman")<B=<BR>> >R>>=3B Module ("Umsg")<BR>>=3B Interface ("Unix")<BR>>=3B Interface (=<BR>> >"Uprocess")<BR>>=3B Interface ("Upthread")<BR>>=3B Interface ("Upwd")<B=<BR>> >R>>=3B Interface ("Uresource")<BR>>=3B Interface ("Usem")<BR>>=3B Int=<BR>> >erface ("Usched")<BR>>=3B Interface ("Ushm")<BR>>=3B Module ("Usignal")=<BR>> ><BR>>=3B Interface ("Ustat")<BR>>=3B Interface ("Usocket")<BR>>=3B In=<BR>> >terface ("Usyslog")<BR>>=3B Interface ("Utime")<BR>>=3B Module ("Utypes=<BR>> >")<BR>>=3B Interface ("Uucontext")<BR>>=3B Interface ("Uugid")<BR>>=<BR>> >=3B Interface ("Uuio")<BR>>=3B Interface ("Uutsname")<BR>>=3B <BR>>=<BR>> >=3B end<BR>>=3B <BR></body><BR>> ></html>=<BR>> ><BR>> >--_55ac72c8-d027-4bd6-a303-434a73dcc5db_--<BR></body>
</html>