ticksize: привязка к первому ядру и проверка переполнения счётчика тактов

This commit is contained in:
parent 6c5ce07fdc
commit 0e773acb47

View File

@ -87,6 +87,9 @@ void latency_test( long ticksize_us, int event_ret, unsigned time_sec, int verbo
cps = SYSPAGE_ENTRY( qtime )->cycles_per_sec;
cps_us = SEC_TO_USEC / (double)cps;
// Attach handler to first CPU core
ThreadCtl( _NTO_TCTL_RUNMASK, (void *)1 );
int_event.sigev_notify = SIGEV_INTR;
// register an interrupt handler
@ -119,8 +122,13 @@ void latency_test( long ticksize_us, int event_ret, unsigned time_sec, int verbo
for ( i = 0; i < int_counter - 1; i++ )
{
delta_us = (double)(clk_time[i + 1] - clk_time[i]) * cps_us;
if ( verbose > 1 && delta_us > ticksize_us + 45.0 )
// Check for CPU counter overflow
if ( clk_time[i + 1] < clk_time[i] )
delta_us = ((double)(~(uint64_t)0 - clk_time[i] + clk_time[i + 1])) * cps_us;
else
delta_us = (double)(clk_time[i + 1] - clk_time[i]) * cps_us;
if ( verbose > 1 && delta_us > (ticksize_us + 50.0) )
printf( "idx %d delta %10.2lf stop %llx start %llx\n", i, delta_us, clk_time[i + 1], clk_time[i] );
if ( delta_max < delta_us )
@ -135,7 +143,7 @@ void latency_test( long ticksize_us, int event_ret, unsigned time_sec, int verbo
if ( verbose )
{
printf( "\nTotal measurements: %lu \n", int_counter);
printf( "\nTotal measurements: %lu \n", int_counter );
printf( "\nMinimum = %10.2lf mks\n", delta_min );
printf( "Maximum = %10.2lf mks\n", delta_max );
printf( "Average = %10.2lf mks\n", delta_avg );
@ -165,7 +173,7 @@ int main( int argc, char** argv )
switch ( opt )
{
case 't':
// System timer ticksize in us
// System timer ticksize in us
ticksize_us = strtoul( optarg, NULL, 0 );
break;