#include "stdafx.h"
#include "PrecisionTimer.h"
#include
#include
#include
using namespace std;
int main()
{
wstring Im = _T("C:\TestSkorost.bin");
wstring ImR = _T(".txt");
int i;
std::locale Loc = std::locale::global(std::locale("russian"));
__int64 DlNew = 1024; DlNew = DlNew * 1024; DlNew = DlNew * 1024; DlNew = DlNew * 20;
char *buf = NULL;
try { buf = new char[DlNew]; }
catch (...) { wcout << _T(" . :"); wcin >> i; return 0; };
wcout << _T(" :\n");
ofstream os(Im, std::ios::binary);
if (!os){wcout<< _T(" : C:\TestSkorost.bin ."); wcin >> i; return 0;};
CPrecisionTimer p; p.Start();
double tnw = p.GetMsCurrentTime();
os.write(buf, DlNew);
double tkw = p.GetMsCurrentTime();
os.close();
ifstream is(Im, std::ios::binary);
if (!is) { wcout << _T(" :C:\TestSkorost.bin "); wcin >> i; return 0;};
double tnr = p.GetMsCurrentTime();
is.read(buf, DlNew);
double tkr = p.GetMsCurrentTime();
is.close();
delete[] buf;
double Tr = (tkr - tnr), Tw = tkw - tnw;
double SkorR = (DlNew / Tr) / 1000, SkorW = (DlNew / Tw) / 1000;
wofstream osR(ImR);
if (!osR) { wcout << _T(" :'.txt' ."); wcin >> i; return 0; };
osR << _T(" = ") << (int)SkorR << _T(" \n") << _T(" = ") << (int)SkorW << _T(" ");
osR.close();
wcout<<_T(" , :");
wcin >> i;
return 0;
}