Sha256: d3aeaed39bd2739b36c4e8a06aa28546f40caa63222b5e67e2d2a94d8c6c8536

Contents?: true

Size: 415 Bytes

Versions: 3

Compression:

Stored size: 415 Bytes

Contents

#include <stdio.h>
#include <sys/types.h>

long long cpucycles_amd64tscfreq(void)
{
  unsigned long long result;
  asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax"
    : "=a" (result) ::  "%rdx");
  return result;
}

long long cpucycles_amd64tscfreq_persecond(void)
{
  long result = 0;
  size_t resultlen = sizeof(long);
  sysctlbyname("machdep.tsc_freq",&result,&resultlen,0,0);
  return result;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_nacl-0.1.2 ext/ruby_nacl/NaCl/cpucycles/amd64tscfreq.c
ruby_nacl-0.1.1 ext/ruby_nacl/NaCl/cpucycles/amd64tscfreq.c
ruby_nacl-0.1.0 ext/ruby_nacl/NaCl/cpucycles/amd64tscfreq.c