subr_prof.c (35596) | subr_prof.c (37629) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 | 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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 |
34 * $Id: subr_prof.c,v 1.25 1998/04/15 17:46:23 bde Exp $ | 34 * $Id: subr_prof.c,v 1.26 1998/05/01 16:40:20 bde Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/sysproto.h> 40#include <sys/kernel.h> 41#include <sys/proc.h> 42#include <sys/resourcevar.h> --- 39 unchanged lines hidden (view full) --- 82#ifdef GUPROF 83 int cputime_overhead; 84 int empty_loop_time; 85 int i; 86 int mcount_overhead; 87 int mexitcount_overhead; 88 int nullfunc_loop_overhead; 89 int nullfunc_loop_profiled_time; | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/sysproto.h> 40#include <sys/kernel.h> 41#include <sys/proc.h> 42#include <sys/resourcevar.h> --- 39 unchanged lines hidden (view full) --- 82#ifdef GUPROF 83 int cputime_overhead; 84 int empty_loop_time; 85 int i; 86 int mcount_overhead; 87 int mexitcount_overhead; 88 int nullfunc_loop_overhead; 89 int nullfunc_loop_profiled_time; |
90 fptrint_t tmp_addr; | 90 uintfptr_t tmp_addr; |
91#endif 92 93 /* 94 * Round lowpc and highpc to multiples of the density we're using 95 * so the rest of the scaling (here and in gprof) stays in ints. 96 */ 97 p->lowpc = ROUNDDOWN((u_long)btext, HISTFRACTION * sizeof(HISTCOUNTER)); 98 p->highpc = ROUNDUP((u_long)etext, HISTFRACTION * sizeof(HISTCOUNTER)); --- 84 unchanged lines hidden (view full) --- 183 mexitcount_overhead = KCOUNT(p, PC_TO_I(p, tmp_addr)); 184 185 p->state = GMON_PROF_OFF; 186 stopguprof(p); 187 188 enable_intr(); 189 190 nullfunc_loop_profiled_time = 0; | 91#endif 92 93 /* 94 * Round lowpc and highpc to multiples of the density we're using 95 * so the rest of the scaling (here and in gprof) stays in ints. 96 */ 97 p->lowpc = ROUNDDOWN((u_long)btext, HISTFRACTION * sizeof(HISTCOUNTER)); 98 p->highpc = ROUNDUP((u_long)etext, HISTFRACTION * sizeof(HISTCOUNTER)); --- 84 unchanged lines hidden (view full) --- 183 mexitcount_overhead = KCOUNT(p, PC_TO_I(p, tmp_addr)); 184 185 p->state = GMON_PROF_OFF; 186 stopguprof(p); 187 188 enable_intr(); 189 190 nullfunc_loop_profiled_time = 0; |
191 for (tmp_addr = (fptrint_t)nullfunc_loop_profiled; 192 tmp_addr < (fptrint_t)nullfunc_loop_profiled_end; | 191 for (tmp_addr = (uintfptr_t)nullfunc_loop_profiled; 192 tmp_addr < (uintfptr_t)nullfunc_loop_profiled_end; |
193 tmp_addr += HISTFRACTION * sizeof(HISTCOUNTER)) 194 nullfunc_loop_profiled_time += KCOUNT(p, PC_TO_I(p, tmp_addr)); 195#define CALIB_DOSCALE(count) (((count) + CALIB_SCALE / 3) / CALIB_SCALE) 196#define c2n(count, freq) ((int)((count) * 1000000000LL / freq)) 197 printf("cputime %d, empty_loop %d, nullfunc_loop_profiled %d, mcount %d, mexitcount %d\n", 198 CALIB_DOSCALE(c2n(cputime_overhead, p->profrate)), 199 CALIB_DOSCALE(c2n(empty_loop_time, p->profrate)), 200 CALIB_DOSCALE(c2n(nullfunc_loop_profiled_time, p->profrate)), --- 257 unchanged lines hidden --- | 193 tmp_addr += HISTFRACTION * sizeof(HISTCOUNTER)) 194 nullfunc_loop_profiled_time += KCOUNT(p, PC_TO_I(p, tmp_addr)); 195#define CALIB_DOSCALE(count) (((count) + CALIB_SCALE / 3) / CALIB_SCALE) 196#define c2n(count, freq) ((int)((count) * 1000000000LL / freq)) 197 printf("cputime %d, empty_loop %d, nullfunc_loop_profiled %d, mcount %d, mexitcount %d\n", 198 CALIB_DOSCALE(c2n(cputime_overhead, p->profrate)), 199 CALIB_DOSCALE(c2n(empty_loop_time, p->profrate)), 200 CALIB_DOSCALE(c2n(nullfunc_loop_profiled_time, p->profrate)), --- 257 unchanged lines hidden --- |