test2.c

text/plain

Filename: test2.c
Type: text/plain
Part: 0
Message: Re: BUG #17288: PSQL bug with COPY command (Windows)
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <time.h>

int main()
{
	int i;
	clock_t t1, t2, t3;
	HANDLE hFile;
	BY_HANDLE_FILE_INFORMATION fiData;
	char path[MAX_PATH];
	//FILE* stream;

	//freopen_s(&stream, "1.txt", "a", stdout);

	hFile = (HANDLE)_get_osfhandle(_fileno(stdout));

	t1 = clock();

	for (i = 0; i < 10000; i++)
		GetFileInformationByHandle(hFile, &fiData);

	t2 = clock();

	for (i = 0; i < 10000; i++)
		GetFinalPathNameByHandleA(hFile, path, MAX_PATH, VOLUME_NAME_NT);

	t3 = clock();

	printf("GetFileInformationByHandle: %d, "
		   "GetFinalPathNameByHandleA: %d\n", t2 - t1, t3 - t2);
	return 0;
}