[ofw][patch][WinVerbs tests] Re: fix IPv6related connectionproblem

Sean Hefty sean.hefty at intel.com
Mon Feb 23 10:59:18 PST 2009


How about replacing get_cycles() with something like this?

static __inline UINT64 get_cycles()
{
	LARGE_INTEGER counter;
	static UINT64 base_adj = 0;
	static UINT64 running_adj = 0;

	if (base_adj == 0) {
		int i;

		QueryPerformanceCounter(&counter);
		base_adj = counter.QuadPart;
		for (i = 0; i < (1 << 16) - 2; i++) {
			QueryPerformanceCounter(&counter);
		}
		QueryPerformanceCounter(&counter);
		base_adj = (counter.QuadPart - base_adj) >> 16;
	}

	QueryPerformanceCounter(&counter);

	running_adj += base_adj;
	return counter.QuadPart - running_adj;
}

- Sean




More information about the ofw mailing list