subr_prof.c (8fa0b743820f61c661ba5f3ea0e3be0dc137910e) | subr_prof.c (0067051fe7ec2efffec5f50f52bbc5699f955d64) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 526 unchanged lines hidden (view full) --- 535 wakeup(&p->p_profthreads); 536 stop = 0; 537 } 538 } 539 if (stop) 540 stopprofclock(p); 541 PROC_UNLOCK(p); 542} | 1/*- 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 526 unchanged lines hidden (view full) --- 535 wakeup(&p->p_profthreads); 536 stop = 0; 537 } 538 } 539 if (stop) 540 stopprofclock(p); 541 PROC_UNLOCK(p); 542} |
543 544#if (defined(__amd64__) || defined(__i386__)) && \ 545 defined(__GNUCLIKE_CTOR_SECTION_HANDLING) 546/* 547 * Support for "--test-coverage --profile-arcs" in GCC. 548 * 549 * We need to call all the functions in the .ctor section, in order 550 * to get all the counter-arrays strung into a list. 551 * 552 * XXX: the .ctors call __bb_init_func which is located in over in 553 * XXX: i386/i386/support.s for historical reasons. There is probably 554 * XXX: no reason for that to be assembler anymore, but doing it right 555 * XXX: in MI C code requires one to reverse-engineer the type-selection 556 * XXX: inside GCC. Have fun. 557 * 558 * XXX: Worrisome perspective: Calling the .ctors may make C++ in the 559 * XXX: kernel feasible. Don't. 560 */ 561typedef void (*ctor_t)(void); 562extern ctor_t _start_ctors, _stop_ctors; 563 564static void 565tcov_init(void *foo __unused) 566{ 567 ctor_t *p, q; 568 569 for (p = &_start_ctors; p < &_stop_ctors; p++) { 570 q = *p; 571 q(); 572 } 573} 574 575SYSINIT(tcov_init, SI_SUB_KPROF, SI_ORDER_SECOND, tcov_init, NULL); 576 577/* 578 * GCC contains magic to recognize calls to for instance execve() and 579 * puts in calls to this function to preserve the profile counters. 580 * XXX: Put zinging punchline here. 581 */ 582void __bb_fork_func(void); 583void 584__bb_fork_func(void) 585{ 586} 587 588#endif 589 | |