Skip to content
Snippets Groups Projects
llglsandbox.cpp 28.3 KiB
Newer Older

		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;

			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);
			}		
	LLGLSLShader::finishProfile(false);
simon's avatar
simon committed
	LLImageGL::deleteTextures(count, source);


	std::sort(results.begin(), results.end());

	F32 gbps = results[results.size()/2];

Richard Linden's avatar
Richard Linden committed
	LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to CPU timers" << LL_ENDL;
  
#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)
	{
		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;

Richard Linden's avatar
Richard Linden committed
		LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
Richard Linden's avatar
Richard Linden committed
		LL_INFOS() << "ARB_timer_query unavailable." << LL_ENDL;