Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 299181 Details for
Bug 438975
gettimeofday is not monotonically increasing
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Test program from bz 245761; 245761 is not visible by all bugzilla accts...
clocktest.tar (text/plain), 10.00 KB, created by
Don Dutile (Red Hat)
on 2008-03-26 15:37:35 UTC
(
hide
)
Description:
Test program from bz 245761; 245761 is not visible by all bugzilla accts...
Filename:
MIME Type:
Creator:
Don Dutile (Red Hat)
Created:
2008-03-26 15:37:35 UTC
Size:
10.00 KB
patch
obsolete
>clocktest/0000775000076400007640000000000010655644241011542 5ustar rielrielclocktest/Makefile0000644000076400007640000000010410655643616013200 0ustar rielriel >clocktest: clocktest.c > cc -o clocktest clocktest.c -lpthread -lrt >clocktest/clocktest.c0000644000076400007640000000403110655644065013701 0ustar rielriel#include <stdio.h> >#include <stdlib.h> >#include <unistd.h> >#include <time.h> >#include <pthread.h> > > >struct timedata_tag { > pthread_t tid; > struct timespec tsp; >}; > >struct timedata_tag predata; > >pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; > >void *sub(void *p) >{ > pthread_t mytid; > struct timespec tsp; > struct timespec ptsp; > int count; > int loop; > > count = 0; > loop = 1; > mytid = pthread_self(); > printf("thread %d start\n", mytid); > > for ( ; ; ) { > pthread_mutex_lock(&lock); > clock_gettime(CLOCK_MONOTONIC, &ptsp); > for ( ; ; ) { > clock_gettime(CLOCK_MONOTONIC, &tsp); > if ( ptsp.tv_nsec != tsp.tv_nsec ) > break; > } > if ( > ( tsp.tv_sec < predata.tsp.tv_sec ) || > ( ( tsp.tv_sec == predata.tsp.tv_sec ) && > ( tsp.tv_nsec <= predata.tsp.tv_nsec ) ) > ) { > printf("time error\n"); > printf("=== predata ===\n"); > printf(" thread id : %d\n", predata.tid); > printf(" tv_sec : 0x%08x\n", predata.tsp.tv_sec); > printf(" tv_nsec : 0x%08x\n", predata.tsp.tv_nsec); > printf("=== my data ===\n"); > printf(" thread id : %d\n", mytid); > printf(" tv_sec : 0x%08x\n", tsp.tv_sec); > printf(" tv_nsec : 0x%08x\n", tsp.tv_nsec); > exit(1); > } > predata.tid = mytid; > predata.tsp = tsp; > pthread_mutex_unlock(&lock); >#if 0 > ++count; > if ( count == 100000 ) { > printf("%d times done ... at thread %d\n", loop * count, mytid); > ++loop; > count = 0; > } >#endif > } > > return 0; >} > >int main(int ac, char **av) >{ > int r; > pthread_t child; > pthread_attr_t attr; > int n; > int i; > > if ( ac >= 2 ) { > n = atoi(av[1]); > } else { > n = 2; > } > printf("create %d threads\n", n); > > r = sysconf(_SC_MONOTONIC_CLOCK); > printf("sysconf(_SC_MONOTONIC_CLOCK) = %d\n", r); > > if ( r == 0 ) { > printf("no monotonic clock\n"); > exit(1); > } > > predata.tid = pthread_self(); > clock_gettime(CLOCK_MONOTONIC, &predata.tsp); > > for ( i = 0; i < n; ++i ) { > pthread_attr_init(&attr); > r = pthread_create(&child, &attr, sub, 0); > if ( r != 0 ) { > printf("pthread_create error %d\n", r); > exit(1); > } > } > > for ( ; ; ) > sleep(100); > > return 0; >} >
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 438975
:
299179
| 299181 |
299213
|
299225
|
299226