Flash drive speed
Hello dear iron lovers!
On the network, it is impossible to find information about the speed of a specific model of USB Flash drive (in common people flash drives). The reason for the secrecy of this information is not known to me.
A utility was developed to test the flash drive and send the results to the site.

The application is written in the .NET Framework 2.0. For low-level operations, a .dll module is written in C ++.
The goal was to evaluate the speed of reading and writing to a card blocks of different sizes. To solve this problem, I used the WinAPI functions: CreateFile, WriteFile and ReadFile. When creating the file, the FILE_FLAG_NO_BUFFERING flag was set, which indicates to the OS that you should not use any kind of file cache.
Here is the test for writing blocks:
I would be very grateful if you look at my UsbFlashSpeed.com project and point out the discovered flaws.
This post is for pre-testing the service and collecting criticisms! The announcement of the service will be later.
Problem
On the network, it is impossible to find information about the speed of a specific model of USB Flash drive (in common people flash drives). The reason for the secrecy of this information is not known to me.
Our decision
A utility was developed to test the flash drive and send the results to the site.

Benchmark
The application is written in the .NET Framework 2.0. For low-level operations, a .dll module is written in C ++.
The goal was to evaluate the speed of reading and writing to a card blocks of different sizes. To solve this problem, I used the WinAPI functions: CreateFile, WriteFile and ReadFile. When creating the file, the FILE_FLAG_NO_BUFFERING flag was set, which indicates to the OS that you should not use any kind of file cache.
Here is the test for writing blocks:
__declspec(dllexport) double WriteBench(LPCSTR path, long size, long count, char* ErrorMessage)
{
HRTimer timer; int i;
double elapsed;
HANDLE hFile; DWORD dwResult;
void* buffer = malloc(size);
memset(buffer, -1, size);
hFile = CreateFileA(path,
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_FLAG_NO_BUFFERING,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
sprintf((char*)ErrorMessage, "Could not open file (error %d)\n", GetLastError());
return 0;
}
timer.StartTimer();
for (i =0 ; i< count; i++){
if(!WriteFile(hFile, buffer, size, &dwResult, NULL))
{
sprintf((char*)ErrorMessage, "Could not write to file (error %d)\n", GetLastError());
return 0;
}
}
elapsed = timer.StopTimer();
CloseHandle(hFile);
DeleteFileA(path);
free(buffer);
return elapsed;
}
* This source code was highlighted with Source Code Highlighter.I would be very grateful if you look at my UsbFlashSpeed.com project and point out the discovered flaws.
This post is for pre-testing the service and collecting criticisms! The announcement of the service will be later.