#include <stdio.h>
#include <stdlib.h>
I'm including my code below. Also, here are my reported times:
Without RDTSC
real 0m1.008s
user 0m0.668s
sys 0m0.004s
With RDTSC
real 0m5.790s
user 0m3.956s
sys 0m0.016s
To turn on or off RDTSC see the rdtsc_rand line that says, "if (1)"
- Don
----------[ snip ]------------
#define rdtscll(val) \
__asm__ __volatile__("rdtsc" : "=A" (val))
unsigned long long rdtsc_rand(void);
/******************************************************/
unsigned long long rdtsc_rand(void)
{
static unsigned long long val=0x0000000011111111ULL;
unsigned long long new = 0llu;
if (1) {
rdtscll(new);
}
val ^= (val >> 15) ^ (val << 14) ^ 9 ^ new;
return val;
}
void kessel()
{
int i;
unsigned long long last = 0;
unsigned long long cur = 0;
for (i=100000000; i>0; i--) {
cur = rdtsc_rand();
if (i <= 10) {
printf("%20llu %20lld\n", cur, (int) cur - last);
}
last = cur;
}
}
int main(int argc, char **argv)
{
kessel();
return(0);
}
A van Kessel wrote:
I would like to mention that your generator is 64 bit and the other
That is correct.
My timings (Haven't profiled yet):
WITH TSC:
real 0m0.902s
user 0m0.870s
sys 0m0.002s
WITHOUT:
real 0m0.613s
user 0m0.582s
sys 0m0.000s
That's for 100 M random numbers.
And inlining would probably help a lot, too.
AvK
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/
_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/