All pastes #462501 Raw Edit

Untitled

public c v1 · immutable
#462501 ·published 2007-04-28 10:13 UTC
rendered paste body
#include <windows.h>#include <cstdio>__declspec(naked)unsigned __int64 __cdecl rdtsc(void){	__asm	{		rdtsc		ret       ; return value at EDX:EAX	}}int main(int argc, char *argv[]){	unsigned __int64 begin;	unsigned __int64 end;	unsigned __int64 result = 0;//	unsigned __int64 overhead = 0;	int  number = 1 << 16;	int  temp;	int  i;	printf("Number: %d\n", number);//	overhead = rdtsc();//	for (int i = 0; i < 1<<16; i++);//	overhead -= rdtsc();	for (i = 0; i < 1<<16; i++)	{		begin = rdtsc();		temp = number % 2;		end = rdtsc();		result += end - begin;	}	printf("Ticks: %f\n", result / ((float)(1<<16)));	system("PAUSE");}