本文整理汇总了C++中Statistics::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ Statistics::Add方法的具体用法?C++ Statistics::Add怎么用?C++ Statistics::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistics
的用法示例。
在下文中一共展示了Statistics::Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompilationTimeAnalysis
void Api::CompilationTimeAnalysis(const string& kernelSourceFile) {
cout << "CompilationTimeAnalysis(\"" << kernelSourceFile << "\"): " << endl;
string code = "";
if (!LoadFile(CL_SRC_PATH_PREFIX + kernelSourceFile, code)) {
cerr << "Could not find source file " << kernelSourceFile << endl;
return;
}
Statistics<int64_t> stats;
auto compilerParams = GetCompilerFlags<float>();
shared_ptr<cl::Program> program;
for (int i = 0; i < COMPILE_ITERATIONS; ++i) {
_timer.Remember();
program = _controller->BuildFromSourceStr(code, compilerParams);
stats.Add(_timer.Diff());
if (program.get() == nullptr) {
cerr << "Failed to compile program from source." << endl;
return;
}
}
cout << "Compilation from source, avg: " << stats.Mean() << ", deviation: " << stats.Deviation<int64_t>()
<< ", max: " << stats.Max() << ", min: " << stats.Min() << endl;
stats.Clear();
vector<char> binary;
_controller->SavePlatformSpecificBinary(program, binary);
for (int i = 0; i < COMPILE_ITERATIONS; ++i) {
_timer.Remember();
program = _controller->BuildFromBinary(binary, compilerParams);
stats.Add(_timer.Diff());
if (program.get() == nullptr) {
cerr << "Failed to compile program from binary." << endl;
return;
}
}
cout << "Compilation from binary, avg: " << stats.Mean() << ", deviation: " << stats.Deviation<int64_t>()
<< ", max: " << stats.Max() << ", min: " << stats.Min() << endl;
}