voidcalc_cycle_measure_overhead()
{
unsignedint cycle_cold, cycle_warm;
cycle_cold= TSCL;
cycle_cold = TSC_getDelay(cycle_cold);
cycle_warm= TSCL;
cycle_warm = TSC_getDelay(cycle_warm);
cycle_measure_overhead = (cycle_cold + cycle_warm)/2;
}
#define TSC_getDelay(startTSC) ((unsignedint)((0xFFFFFFFFl+TSCL)- (unsignedlonglong)startTSC)+ 1)
#define TSC_count_cycle_from(startTSC) (TSC_getDelay(startTSC)- cycle_measure_overhead)
问题:
1. cycle_measure_overhead = (cycle_cold + cycle_warm)/2;为什么要求一个均值?
2. #define TSC_getDelay(startTSC) ((unsigned int)((0xFFFFFFFFl+TSCL)- (unsigned long long)startTSC)+ 1)为什么要写成这种形式,不是直接用TSCL
Thomas Yang1:
TSC第一次统计和之后统计时的 delay不一样,求一个平均值,相当于平滑下,或者说避免第一次测的不准
user1534243:
回复 Thomas Yang1:
好的谢谢