0
我为LinkedList编写了一个多线程的C代码。我正在尝试测量代码的吞吐量和延迟。吞吐量的测量,这里是我的代码测量代码的吞吐量和延迟
clock_t begin = clock();
pthread_create (&t1, NULL, thread1, (void *)head);
pthread_create (&t2, NULL, thread2, (void *)head);
pthread_create (&t3, NULL, thread3, (void *)head);
pthread_create (&t4, NULL, thread4, (void *)head);
pthread_join (t1, NULL);
pthread_join (t2, NULL);
pthread_join (t3, NULL);
pthread_join (t4, NULL);
clock_t end = clock();
而对于延迟其计算方法如下
void * thread1(void * args)
{
clock_t begin = clock();
/* LinkedList Operations */
clock_t begin = clock();
}
我是不是正确测量这两个参数或者是有一些其他的方式来做到这一点?
在此先感谢!
[复制](http://stackoverflow.com/a/5249150/5058676) – evaitl