本文整理汇总了C++中Performance::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Performance::end方法的具体用法?C++ Performance::end怎么用?C++ Performance::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Performance
的用法示例。
在下文中一共展示了Performance::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
using namespace asmjit;
Performance perf;
uint32_t kNumRepeats = 10;
uint32_t kNumIterations = 10000;
JitRuntime runtime;
X86Assembler a(&runtime);
X86Compiler c(&runtime);
uint32_t r, i;
// --------------------------------------------------------------------------
// [Bench - Opcode]
// --------------------------------------------------------------------------
perf.reset();
for (r = 0; r < kNumRepeats; r++) {
perf.start();
for (i = 0; i < kNumIterations; i++) {
asmgen::opcode(a);
void *p = a.make();
runtime.release(p);
a.reset();
}
perf.end();
}
printf("Opcode | Time: %-6u [ms] | Speed: %-9u [inst/s]\n",
perf.best, instPerMs(perf.best, kNumIterations, asmgen::kGenOpCodeInstCount));
// --------------------------------------------------------------------------
// [Bench - Blend]
// --------------------------------------------------------------------------
perf.reset();
for (r = 0; r < kNumRepeats; r++) {
perf.start();
for (i = 0; i < kNumIterations; i++) {
asmgen::blend(c);
void* p = c.make();
runtime.release(p);
c.reset();
}
perf.end();
}
printf("Blend | Time: %-6u [ms] | Speed: %-9u [inst/s]\n",
perf.best, instPerMs(perf.best, kNumIterations, asmgen::kGenBlendInstCount));
return 0;
}
示例2: runtime
static void benchX86(uint32_t arch, uint32_t callConv) {
using namespace asmjit;
Performance perf;
TestRuntime runtime(arch, callConv);
X86Assembler a(&runtime, arch);
X86Compiler c;
uint32_t r, i;
const char* archName = arch == kArchX86 ? "X86" : "X64";
// --------------------------------------------------------------------------
// [Bench - Opcode]
// --------------------------------------------------------------------------
size_t asmOutputSize = 0;
size_t cmpOutputSize = 0;
perf.reset();
for (r = 0; r < kNumRepeats; r++) {
asmOutputSize = 0;
perf.start();
for (i = 0; i < kNumIterations; i++) {
asmgen::opcode(a);
void *p = a.make();
runtime.release(p);
asmOutputSize += a.getCodeSize();
a.reset();
}
perf.end();
}
printf("%-12s (%s) | Time: %-6u [ms] | Speed: %7.3f [MB/s]\n",
"X86Assembler", archName, perf.best, mbps(perf.best, asmOutputSize));
// --------------------------------------------------------------------------
// [Bench - Blend]
// --------------------------------------------------------------------------
perf.reset();
for (r = 0; r < kNumRepeats; r++) {
cmpOutputSize = 0;
perf.start();
for (i = 0; i < kNumIterations; i++) {
c.attach(&a);
asmgen::blend(c);
c.finalize();
void* p = a.make();
runtime.release(p);
cmpOutputSize += a.getCodeSize();
a.reset();
}
perf.end();
}
printf("%-12s (%s) | Time: %-6u [ms] | Speed: %7.3f [MB/s]\n",
"X86Compiler", archName, perf.best, mbps(perf.best, cmpOutputSize));
}