FreeBSD Bugzilla – Attachment 154094 Details for
Bug 198462
The system stops calling SIGPROF handler after some time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
The test source.
test.cc (text/plain), 1.00 KB, created by
Ivan Kosarev
on 2015-03-09 17:57:22 UTC
(
hide
)
Description:
The test source.
Filename:
MIME Type:
Creator:
Ivan Kosarev
Created:
2015-03-09 17:57:22 UTC
Size:
1.00 KB
patch
obsolete
> >#include <pthread.h> >#include <stdio.h> >#include <stdlib.h> >#include <signal.h> >#include <sys/types.h> >#include <sys/time.h> >#include <unistd.h> >#include <errno.h> >#include <assert.h> >#include <string.h> > >volatile int Z = 0; >volatile int Z2 = 0; > >volatile int C = 0; >volatile int C2 = 0; > >static void handler(int sig) { > (void)sig; > > char buff[] = { (char)('0' + C++ % 10), '\n' }; > write(2, buff, 2); > > for(int i = 1; i < 10000000; i++) { > Z2 *= i; > } >} > >void loop() { > for(int i = 1; i < 10000000; i++) { > Z *= i; > } > > char buff[] = { '*', (char)('0' + C2++ % 10), '\n' }; > write(2, buff, 3); >} > >int main() { > struct sigaction act = {}; > act.sa_handler = &handler; > sigemptyset(&act.sa_mask); > if (sigaction(SIGPROF, &act, 0)) { > assert(0); > } > > itimerval t; > t.it_value.tv_sec = 0; > t.it_value.tv_usec = 100; > t.it_interval = t.it_value; > if (setitimer(ITIMER_PROF, &t, 0)) { > assert(0); > } > > for(int i = 0; i < 2000000; i++) { > loop(); > } > > fprintf(stderr, "DONE\n"); > > 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 198462
: 154094 |
154095