examples/Qt/ISFEditor/fftreal/stopwatch/ClockCycleCounter.cpp
/*
==============================================================================
Name: compute_clk_mul
Description:
	This function, only for PowerPC/MacOS computers, computes the multiplier
	required to deduce clock cycles from the internal counter.
Throws: Nothing
==============================================================================
*/
compute_clk_mul
Description:
This function, only for PowerPC/MacOS computers, computes the multiplier
required to deduce clock cycles from the internal counter.
Throws: Nothing
compute_clk_mul Description : This function only for PowerPC / MacOS computers computes the multiplier required to deduce clock cycles from the internal counter . Throws : Nothing
void	ClockCycleCounter::compute_clk_mul ()
{
	assert (! _init_flag);
#if defined (__MACOS__)
	long				clk_speed_mhz = CurrentProcessorSpeed ();
	const Int64		clk_speed =
		static_cast <Int64> (clk_speed_mhz) * (1000L*1000L);
	const double	start_time_s = stopwatch_ClockCycleCounter_get_time_s ();
	start ();
	const double	duration = 0.01;	
	while (stopwatch_ClockCycleCounter_get_time_s () - start_time_s < duration)
	{
		continue;
	}
	const double	stop_time_s = stopwatch_ClockCycleCounter_get_time_s ();
	stop ();
	const double	diff_time_s = stop_time_s - start_time_s;
	const double	nbr_cycles = diff_time_s * static_cast <double> (clk_speed);
	const Int64		diff_time_c = _state - _start_time;
	const double	clk_mul = nbr_cycles / static_cast <double> (diff_time_c);
	_clk_mul = round_int (clk_mul);
#endif	
}
void ClockCycleCounter :: compute_clk_mul ( ) { assert ( ! _init_flag ) ; #if defined ( __MACOS__ ) long clk_speed_mhz = CurrentProcessorSpeed ( ) ; const Int64 clk_speed = static_cast < Int64 > ( clk_speed_mhz ) * ( 1000L * 1000L ) ; const double start_time_s = stopwatch_ClockCycleCounter_get_time_s ( ) ; start ( ) ; const double duration = 0.01 ; while ( stopwatch_ClockCycleCounter_get_time_s ( ) - start_time_s < duration ) { continue ; } const double stop_time_s = stopwatch_ClockCycleCounter_get_time_s ( ) ; stop ( ) ; const double diff_time_s = stop_time_s - start_time_s ; const double nbr_cycles = diff_time_s * static_cast < double > ( clk_speed ) ; const Int64 diff_time_c = _state - _start_time ; const double clk_mul = nbr_cycles / static_cast < double > ( diff_time_c ) ; _clk_mul = round_int ( clk_mul ) ; #endif }
Name: compute_clk_mul
Description:
This function, only for PowerPC/MacOS computers, computes the multiplier
required to deduce clock cycles from the internal counter.
Name : compute_clk_mul Description : This function only for PowerPC / MacOS computers computes the multiplier required to deduce clock cycles from the internal counter .
// Seconds
 // __MACOS__
