Re: [PATCH v2] Import a new test, jitterz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 20 Apr 2020, Sebastian Andrzej Siewior wrote:

> On 2020-04-18 07:14:49 [-0700], trix@xxxxxxxxxx wrote:
> > --- /dev/null
> > +++ b/src/jitterz/jitterz.c
> > @@ -0,0 +1,400 @@
> …
> > +/*
> > + * jitterz
> > + *
> > + * Copyright 2019-2020 Tom Rix <trix@xxxxxxxxxx>
> > + *
> > + */
> > +
> > +#ifndef _GNU_SOURCE
> > +#define _GNU_SOURCE
> > +#endif
> 
> in general there is no need of that ifndef and this should be taken care
> by the build system (and refuse the build if _GNU_SOURCE makes no
> difference/ is not available). And then include the config.h (or so)
> first header file. 
> In rt-tests, the Makefile already adds this define to the CFLAGS.
> 
> …
> > +/* Returns clock ticks */
> > +static inline uint64_t time_stamp_counter(void)
> > +{
> > +	uint64_t ret = -1;
> > +#if defined(__i386__) || defined(__x86_64__)
> > +	uint32_t l, h;
> > +
> > +	__asm__ __volatile__("lfence");
> > +	__asm__ __volatile__("rdtsc" : "=a"(l), "=d"(h));
> > +	ret = ((uint64_t)h << 32) | l;
> > +#else
> > +	fprintf(stderr,
> > +		"Add a time_stamp_counter function for your arch here %s:%d\n",
> > +		__FILE__, __LINE__);
> > +	exit(1);
> > +#endif
> > +	return ret;
> > +}
> 
> I remember I complained about this in `queuelat' and it ended nowhere
> once it got merged.
> To repeat my question: Is there a reason not to use clock_gettime()?
> With VDSO there should be hardly any difference between this and
> clock_gettime().

I would agree with Sebastian there Tom, also easier to maintain.

Thanks

John

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux