/* This routine uses the read_current_timer() routine and gets the *loopsperjiffydirectly,insteadofguessingitusingdelay(). *Also,thiscodetriestohandlenon-maskableasynchronousevents *(likeSMIs)
*/ #define DELAY_CALIBRATION_TICKS ((HZ < 100) ? 1 : (HZ/100)) #define MAX_DIRECT_CALIBRATION_RETRIES 5
staticunsignedlong calibrate_delay_direct(void)
{ unsignedlong pre_start, start, post_start; unsignedlong pre_end, end, post_end; unsignedlong start_jiffies; unsignedlong timer_rate_min, timer_rate_max; unsignedlong good_timer_sum = 0; unsignedlong good_timer_count = 0; unsignedlong measured_times[MAX_DIRECT_CALIBRATION_RETRIES]; int max = -1; /* index of measured_times with max/min values or not set */ int min = -1; int i;
/* if range is within 12% let's take it */ if ((measured_times[max] - measured_times[min]) < maxdiff) return estimate;
/* ok - drop the worse value and try again... */
good_timer_sum = 0;
good_timer_count = 0; if ((measured_times[max] - estimate) <
(estimate - measured_times[min])) {
printk(KERN_NOTICE "calibrate_delay_direct() dropping " "min bogoMips estimate %d = %lu\n",
min, measured_times[min]);
measured_times[min] = 0;
min = max;
} else {
printk(KERN_NOTICE "calibrate_delay_direct() dropping " "max bogoMips estimate %d = %lu\n",
max, measured_times[max]);
measured_times[max] = 0;
max = min;
}
for (i = 0; i < MAX_DIRECT_CALIBRATION_RETRIES; i++) { if (measured_times[i] == 0) continue;
good_timer_count++;
good_timer_sum += measured_times[i]; if (measured_times[i] < measured_times[min])
min = i; if (measured_times[i] > measured_times[max])
max = i;
}
}
printk(KERN_NOTICE "calibrate_delay_direct() failed to get a good " "estimate for loops_per_jiffy.\nProbably due to long platform " "interrupts. Consider using \"lpj=\" boot option.\n"); return0;
} #else staticunsignedlong calibrate_delay_direct(void)
{ return0;
} #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.