* time(1) incorrect (Re) ... times(3) strange; clock_t == long
@ 1996-02-29 9:53 froy
1996-02-29 14:43 ` Craig Groeschel
1996-02-29 15:42 ` Erik Troan
0 siblings, 2 replies; 4+ messages in thread
From: froy @ 1996-02-29 9:53 UTC (permalink / raw)
Erik> On Tue, 12 Dec 1995, Nigel Metheringham wrote:
> Imagine my suprise when I found that apparently the beast does
> infinite dhrystones per second.... some system!
Erik> We told you these Alpha's are fast!
> /usr/bin/time was returning 0 for sys and elapsed time under all
> circumstances - user time appeared OK.
> Recompiling (ie installing the SRPM and building it), fixed that.
> Presumably something in the kernel has changed???
> I am using a 1.3.46 kernel, built here.
Erik> I'm rebuilding it here as well. I'll make a new RPM available today
Erik> (time-1.6-3).
I replayed this time(1) story 2.5 months later, on my BLADE_0.3 platform.
I think it is [was] due to times(3) which uses [used] to return a
value in ~seconds, not in clock ticks unless redefining HZ to 1
(HZ is set to 1024 by <asm/param.h> for a "noname" board, & Digital Unix
uses the same setting).
Does anybody know how it has been fixed (e.g. by a change to the libraries,
to the system header files, to the kernel...) ?
I have also a question on clock_t: it's a `long' on BLADE_0.3 (<asm/types.h>)
but an `int' on Digital Unix (<sys/types.h>). While perhaps sometimes
hidden by the Alpha chip tolerant endianess, it should make a (small) hole in
binary compatibility of Linux/Alpha with Digital Unix. I'd like to
understand the advantage of preferring `long' to `int': is it because
Linux/Intel's clock_t is also `long' ?
Thanks a lot,
fred
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: time(1) incorrect (Re) ... times(3) strange; clock_t == long
1996-02-29 9:53 time(1) incorrect (Re) ... times(3) strange; clock_t == long froy
@ 1996-02-29 14:43 ` Craig Groeschel
1996-02-29 15:57 ` Fred Roy
1996-02-29 15:42 ` Erik Troan
1 sibling, 1 reply; 4+ messages in thread
From: Craig Groeschel @ 1996-02-29 14:43 UTC (permalink / raw)
> I replayed this time(1) story 2.5 months later, on my BLADE_0.3 platform.
> I think it is [was] due to times(3) which uses [used] to return a
No, I don't think it was the units. I think it was...
> I have also a question on clock_t: it's a `long' on BLADE_0.3 (<asm/types.h>)
> but an `int' on Digital Unix (<sys/types.h>). While perhaps sometimes
If you were to compile time(1) with "gcc -Wall" you would observe some
warnings about printf int/long mismatches. Fixing those up in the time
program made it return proper numbers.
Speaking of the Byte benchmarks, I fixed the "write an long, read an int"
problem in the pipe-based context switch test and sent diffs to the
maintainer of the Linux Benchmark page. The response I got was
> The code doesn't require a patch, BTW. Thousands have ran the code.
Oh well. My mistake I'm sure.
--
Craig E. Groeschel <craig@metrolink.com> Not speaking for my employer.
"Do not play this piece fast. It is never right to play Ragtime fast." Joplin
linux$ /bin/pwd: can't load library '/lib/libc.2.2.2'
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: time(1) incorrect (Re) ... times(3) strange; clock_t == long
1996-02-29 14:43 ` Craig Groeschel
@ 1996-02-29 15:57 ` Fred Roy
0 siblings, 0 replies; 4+ messages in thread
From: Fred Roy @ 1996-02-29 15:57 UTC (permalink / raw)
Craig >If you were to compile time(1) with "gcc -Wall" you would observe some
Craig >warnings about printf int/long mismatches. Fixing those up in the time
Craig >program made it return proper numbers.
I did it already, it does not change the times(3) behaviour... Consider the
following source code:
/* ----- */
#include <sys/times.h>
#include <unistd.h>
#include <stdio.h>
main() {
struct tms my_tms;
int slept;
long ret1, ret2;
slept=2;
printf("going to sleep %d sec...\n", slept);
ret1= (long)times(&my_tms);
slept=sleep((unsigned int)slept);
ret2= (long)times(&my_tms);
printf("before: times() returned %ld\n", ret1);
printf("after: times() returned %ld\n", ret2);
}
/* ----- */
When compiled on BLADE_0.3 then runned, it outputs (for example):
-----
going to sleep 2 sec...
before: times() returned 825630364
after: times() returned 825630366
-------
fred
P.S.: could somebody compile it on a recent RedHat AXP Linux and tell me if it
behaves the same way ? Thanks a lot.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: time(1) incorrect (Re) ... times(3) strange; clock_t == long
1996-02-29 9:53 time(1) incorrect (Re) ... times(3) strange; clock_t == long froy
1996-02-29 14:43 ` Craig Groeschel
@ 1996-02-29 15:42 ` Erik Troan
1 sibling, 0 replies; 4+ messages in thread
From: Erik Troan @ 1996-02-29 15:42 UTC (permalink / raw)
On Thu, 29 Feb 1996 froy@gr.osf.org wrote:
> I have also a question on clock_t: it's a `long' on BLADE_0.3 (<asm/types.h>)
> but an `int' on Digital Unix (<sys/types.h>). While perhaps sometimes
> hidden by the Alpha chip tolerant endianess, it should make a (small) hole in
> binary compatibility of Linux/Alpha with Digital Unix. I'd like to
> understand the advantage of preferring `long' to `int': is it because
> Linux/Intel's clock_t is also `long' ?
That's easy - we don't want our time to run out in 2020 (or whenever 32 bit
time runs out, which isn't so far in the future I can't grasp it). Now 64
bit time -- that'll last about 100 billion more years. That's more time then
I can easily comprehend, and I don't care a whit about what happens to the
world when it runs out (as the sun would have exploded about 95 billion
years earlier, give or take).
I don't think Linux will last quite that long.
Erik
-------------------------------------------------------------------------------
Always hoped that I'd be an apostle. Knew that I would make it if I tried.
Then when we retire we can write the gospels so they'll all talk about
us when we die. - "The Last Supper" from Jesus Christ Superstar
| Erik Troan = http://sunsite.unc.edu/ewt/ = ewt@sunsite.unc.edu |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-02-29 15:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-29 9:53 time(1) incorrect (Re) ... times(3) strange; clock_t == long froy
1996-02-29 14:43 ` Craig Groeschel
1996-02-29 15:57 ` Fred Roy
1996-02-29 15:42 ` Erik Troan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox