Newer
Older
David Parks
committed
glFinish();
}
F32 time = timer.getElapsedTimeF32();
if (c >= 0) // <-- ignore the first sample as it tends to be artificially slow
{
//store result in gigabytes per second
F32 gb = (F32) ((F64) (res*res*8*count))/(1000000000);
F32 gbps = gb/time;
David Parks
committed
if (!gGLManager.mHasTimerQuery && !busted_finish && gbps > 128.f)
{ //unrealistically high bandwidth for a card without timer queries, glFinish is probably ignored
busted_finish = true;
}
else
{
results.push_back(gbps);
}
}
}
gBenchmarkProgram.unbind();
LLGLSLShader::finishProfile(false);
std::sort(results.begin(), results.end());
F32 gbps = results[results.size()/2];
LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to CPU timers" << LL_ENDL;
davep
committed
#if LL_DARWIN
if (gbps > 512.f)
{
LL_INFOS() << "Memory bandwidth is improbably high and likely incorrect." << LL_ENDL;
//OSX is probably lying, discard result
gbps = -1.f;
}
#endif
if (gGLManager.mHasTimerQuery)
{
David Parks
committed
F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
F32 seconds = ms/1000.f;
F64 samples_drawn = res*res*count*samples;
F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
gbps = samples_sec*8;
LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
LL_INFOS() << "ARB_timer_query unavailable." << LL_ENDL;
return gbps;