FreeBSD Bugzilla – Attachment 199443 Details for
Bug 233396
In FreeBSD 11.x thread creation time is too much on Xeon Gold 5115 CPU
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
simple c code
demo_thread.c (text/plain), 1.01 KB, created by
Steevan
on 2018-11-22 05:17:01 UTC
(
hide
)
Description:
simple c code
Filename:
MIME Type:
Creator:
Steevan
Created:
2018-11-22 05:17:01 UTC
Size:
1.01 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <unistd.h> >#include <pthread.h> >#include <sys/time.h> > >void *myThreadFun(void *vargp) >{ >// sleep(1); > printf("Printing from demo for thread creation time \n"); > return NULL; >} > >void main(void) >{ > pthread_t thread_id; > unsigned long int usec, usec2, sec, sec2; > struct timeval tv, tv2; > struct timezone tz; > pthread_attr_t attr; > > pthread_attr_init(&attr); > pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); > > gettimeofday(&tv, &tz); // take time before creating thread > pthread_create(&thread_id, &attr, myThreadFun, NULL); > gettimeofday(&tv2, &tz); // take time after creation of thread > > pthread_join(thread_id, NULL); > usec = tv.tv_usec; > sec = tv.tv_sec; > usec2 = tv2.tv_usec; > sec2 = tv2.tv_sec; > printf("Thread creation time details are: \n"); > printf("Before: Sec %lu usec %lu After: Sec %lu usec %lu : SecDiff %lu UsecDiff %lu \n", sec, usec, sec2, usec2, sec2 - sec , usec2 - usec); > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 233396
: 199443