Ejemplo n.º 1
0
void Benchmark::Integer16_Test()
{
	double tmp(0);
	double Cur_Time(0);
	uint32_t loops=0;
	Stopwatch watch;
	
	watch.Start();
	for( ; Cur_Time < Time_Per_Test; ++loops, watch.Look( Cur_Time ), Status_Done( static_cast< uint32_t >( Status_Mul*Cur_Time  ))  )
	    tmp += Intern_Integer16_Test();
	  
	m_Integer16_Score = static_cast< uint32_t >(tmp/loops);
}
Ejemplo n.º 2
0
void Benchmark::Integer8_Test()
{
    double Score   ( 0 ),
           Cur_Time( 0 );
    uint32_t loops ( 0 );
    Stopwatch watch;
	
    watch.Start();
    for( ; Cur_Time < Time_Per_Test; ++loops, watch.Look( Cur_Time ), Status_Done( static_cast< uint32_t >( Status_Mul*Cur_Time  ))  )
        Score += Intern_Integer8_Test();
	  
    m_Integer8_Score = static_cast< uint32_t >(Score/loops);
}
Ejemplo n.º 3
0
void Benchmark::Fp128_Test()
{
	if( sizeof( long double ) != 16 )  
	    return;
	double tmp(0);
	double Cur_Time(0);
	uint32_t loops=0;
	Stopwatch watch;
	
	
	watch.Start();
	for( ; Cur_Time < Time_Per_Test; ++loops, watch.Look( Cur_Time ), Status_Done( static_cast< uint32_t >( Status_Mul*Cur_Time  ))  )
	    tmp += Intern_Fp128_Test();
	
	m_Fp128_Score = static_cast< uint32_t >(tmp/loops);
}
Ejemplo n.º 4
0
//todo: Use a typedef for the saving type
void Benchmark::Run()
{
		Stopwatch watch;
		uint32_t tmp_Time;
		if( ::Just_Mem_Test )
		    tmp_Time = Time_Per_Test * 5;
		else if( ::Just_Cpu_Test )
		    tmp_Time = Time_Per_Test * 7;
		else if( ::Just_MT_Test )
		    tmp_Time = Time_Per_Test * 1;
		else
		    tmp_Time = Time_Per_Test * 13;
		    
		if( No_Cpu_Test )
		    tmp_Time -= Time_Per_Test * 7;
		if( No_Mem_Test )
		    tmp_Time -= Time_Per_Test * 5;
		if( No_MT_Test )
		    tmp_Time -= Time_Per_Test * 1;
		
		
		const uint32_t Time( tmp_Time );
		uint32_t Loops(0);
		
		double   Re8int(0),
		         Re16int(0),
		         Re32int(0),
		         Re64int(0),
		         Re32Fp(0),
		         Re64Fp(0),
		         Re96Fp(0),
		         Re128Fp(0),
		         ReMemRW2(0),
		         ReMemRW4(0),
		         ReMemDA2(0),
		         ReMemDA4(0),
		         ReMemDA8(0),
		         ReMTMLuL(0);
		         
		double Cur_Time(0);
		Status_Done(0);
		watch.Start();
		for( ; Cur_Time < Time; ++Loops, watch.Look( Cur_Time ), Status_Done( static_cast< uint32_t >( (100.0/Time)*Cur_Time  )) )
		{
			if( !Just_Mem_Test && !Just_MT_Test  &&  !No_Cpu_Test)
			{
			    Re8int += static_cast< double > (Intern_Integer8_Test() );
			    if( m_Error )
			    	return;
			    Re16int += static_cast< double > (Intern_Integer16_Test() );
			    if( m_Error )
			    	return;
			    Re32int += static_cast< double > (Intern_Integer32_Test() );
			    if( m_Error )
			    	return;
			    Re64int += static_cast< double > (Intern_Integer64_Test() );
			
			    Re32Fp += static_cast< double > (Intern_Fp32_Test() );
			    if( m_Error )
			    	return;
			    Re64Fp += static_cast< double > (Intern_Fp64_Test() );
			    if( m_Error )
			    	return;
			    if( sizeof( long double ) == 12 )
			        Re96Fp += static_cast< double > (Intern_Fp96_Test() );
			    else if( sizeof( long double ) == 16 )
			        Re128Fp += static_cast< double > (Intern_Fp128_Test() );

			    if( m_Error )
			    	return;
			}
			if( !Just_Cpu_Test &&  !Just_MT_Test && !No_Mem_Test)
			{
			    ReMemRW2 += static_cast< double > (Intern_Mem_RW2_Test() );
			    if( m_Error )
				return;
			    ReMemRW4 += static_cast< double > (Intern_Mem_RW4_Test() );
			    if( m_Error )
			    	return;
			    ReMemDA2 += static_cast< double > (Intern_Mem_DA2_Test() );
			    if( m_Error )
			    	return;
			    ReMemDA8 += static_cast< double > (Intern_Mem_DA8_Test() );
			    if( m_Error )
			    	return;
			    ReMemDA4 += static_cast< double > (Intern_Mem_DA4_Test() ); 
			    if( m_Error )
			    	return;
			}
			if( !Just_Cpu_Test && !Just_Mem_Test  && !No_MT_Test )
			{
			    ReMTMLuL += static_cast< double > (Intern_MT_MLuL_Test() );
			    if( m_Error )
			        return;
			}
		}
		
		if( !Just_Mem_Test && !Just_MT_Test  && !No_Cpu_Test)
		{
		    //Todo:Change the cast to use the typedef!
		    m_Integer8_Score = static_cast< Benchmark::Score_Type >  ( (Re8int / static_cast<double> (Loops) )  );
		    m_Integer16_Score = static_cast< Benchmark::Score_Type > ( (Re16int / static_cast<double> (Loops) ) );
		    m_Integer32_Score = static_cast< Benchmark::Score_Type > ( (Re32int / Loops ) );
		    m_Integer64_Score = static_cast< Benchmark::Score_Type > ( (Re64int / static_cast<double> (Loops) ) );
		
		
		    m_Fp32_Score = static_cast< Benchmark::Score_Type >  ( (Re32Fp / static_cast<double> (Loops) ) );
		    m_Fp64_Score = static_cast< Benchmark::Score_Type >  ( (Re64Fp / static_cast<double> (Loops) ) );
		    m_Fp96_Score = static_cast< Benchmark::Score_Type >  ( (Re96Fp / static_cast<double> (Loops) ) );
		    m_Fp128_Score = static_cast< Benchmark::Score_Type > ( (Re128Fp / static_cast<double>(Loops) ) );
		}
		if( !Just_Cpu_Test  &&  !Just_MT_Test  && !No_Mem_Test)
		{
		    m_Mem_RW2_Score = static_cast< Benchmark::Score_Type > ( ReMemRW2 / Loops );
		    m_Mem_RW4_Score = static_cast< Benchmark::Score_Type > ( ReMemRW4 / Loops );
		    m_Mem_DA2_Score = static_cast< Benchmark::Score_Type > ( ReMemDA2 / Loops );
		    m_Mem_DA4_Score = static_cast< Benchmark::Score_Type > ( ReMemDA4 / Loops );
		    m_Mem_DA8_Score = static_cast< Benchmark::Score_Type > ( ReMemDA8 / Loops );
		}
		if( !Just_Cpu_Test && ! Just_Mem_Test && !No_MT_Test)
		{
			m_MT_MLuL_Score = static_cast< Benchmark::Score_Type > ( ReMTMLuL / Loops );
		}
	
	
}