网络性能分析中的时间分布与统计监测技术
1. 延迟时间生成与分布
在网络性能分析中,常常需要模拟查询的延迟时间。以下是一段用于生成延迟时间的代码:
int itab[NUM]; /* counts of observations within range slots */ int ii, jj; srand((unsigned int) getpid()); /* seed rand() */ /* ** Generate delay times */ for(ii=0; ii<MAX; ii++) { /* random values from .0 thru 1.0 */ random = rand() / (double) RAND_MAX; /* match a time slot */ for(jj=0; jj<NUM; jj++) { if(random <= probs[jj]) break; } /* random values within each slot */ random = rand() / (double) RAND_MAX; delay = (double) slots[jj] - (random * (double) slots[0]); /********************************************************/ /*** Send each query after the calculated delay ti