1 // BenchCon.cpp 2 3 #include "StdAfx.h" 4 5 #include "../Common/Bench.h" 6 7 #include "BenchCon.h" 8 #include "ConsoleClose.h" 9 10 struct CPrintBenchCallback: public IBenchPrintCallback 11 { 12 FILE *_file; 13 14 void Print(const char *s); 15 void NewLine(); 16 HRESULT CheckBreak(); 17 }; 18 19 void CPrintBenchCallback::Print(const char *s) 20 { 21 fputs(s, _file); 22 } 23 24 void CPrintBenchCallback::NewLine() 25 { 26 fputc('\n', _file); 27 } 28 29 HRESULT CPrintBenchCallback::CheckBreak() 30 { 31 return NConsoleClose::TestBreakSignal() ? E_ABORT: S_OK; 32 } 33 34 HRESULT BenchCon(DECL_EXTERNAL_CODECS_LOC_VARS 35 const CObjectVector<CProperty> &props, UInt32 numIterations, FILE *f) 36 { 37 CPrintBenchCallback callback; 38 callback._file = f; 39 return Bench(EXTERNAL_CODECS_LOC_VARS 40 &callback, NULL, props, numIterations, true); 41 } 42