toplev.c and HZ (was: gcc-2.8.0 released)

Eric Dana edana@bgs.com
Fri Jan 23 16:33:00 GMT 1998


On Thu, 22 Jan 1998, David T. McWherter wrote:

> Hmmm...C compilers should initialize statics to a 'zero' value
> by default, no?  That was my understanding of the specs the
> last time I read 'em, anyways...
> 
> Perhaps there are compilers that don't implement things that
> way?
> 
> -David
> dtm@waterw.com
After re-reading the spec, I stand corrected. Tnx...

--Eric--


> 
> On Wed, 21 Jan 1998, Eric Dana wrote:
> 
> > When using 'static int tick', please initialize tick = 0.
> > 
> > On Tue, 20 Jan 1998, John Carr wrote:
> > 
> > > 
> > > I use this patch to fix the HZ problem.  It also is a slight
> > > optimization on earlier versions of Solaris because it calls
> > > sysconf only once (HZ is a macro which calls sysconf, so there
> > > was one extra system call per call to get_run_time).
> > > 
> > > Tue Jan 20 09:28:11 1998  John Carr  <jfc@mit.edu>
> > > 
> > > 	* toplev.c (get_run_time): Call sysconf(_SC_CLK_TCK), when available,
> > > 	to get clock rate.
> > > 
> > > *** toplev.c.egcs	Sun Jan 18 09:42:28 1998
> > > --- toplev.c	Sun Jan 18 11:07:37 1998
> > > ***************
> > > *** 1024,1029 ****
> > > --- 1028,1042 ----
> > >     else
> > >       return (clock() * 1000);
> > >   #else /* not _WIN32 */
> > > + #ifdef _SC_CLK_TCK
> > > +   {
> > > +     static int tick;
> > The above should be:
> >         static int tick = 0; /* this will initialize tick only once */
> > > +     if (tick == 0)
> > > +       tick = 1000000 / sysconf(_SC_CLK_TCK);
> > > +     times (&tms);
> > > +     return (tms.tms_utime + tms.tms_stime) * tick;
> > > +   }
> > > + #else
> > >   #ifdef USG
> > >     times (&tms);
> > >     return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
> > > ***************
> > > *** 1037,1042 ****
> > > --- 1050,1056 ----
> > >     return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
> > >   #endif	/* VMS */
> > >   #endif	/* USG */
> > > + #endif  /* _SC_CLK_TCK */
> > >   #endif	/* _WIN32 */
> > >   #endif	/* __BEOS__ */
> > >   }
> > > 
> > 
> > 
> > Eric Dana
> > BGS Systems Inc.
> > 
> 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>        David T. McWherter     dtm@waterw.com
> 



More information about the Gcc mailing list