I have written a multithreaded C code for LinkedList. I am trying to measure the throughput and latency of the code. For measuring throughput, here is my code
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();
And for latency it is as follows
void * thread1(void * args)
{
clock_t begin = clock();
/* LinkedList Operations */
clock_t begin = clock();
}
Am I measuring this two parameters correctly or is there some other way to do it?
Thanks in advance!