ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

11、网络性能分析中的时间分布与统计监测

11、网络性能分析中的时间分布与统计监测

网络性能分析中的时间分布与统计监测

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 dela
返回列表