subr_prof.c (2956) | subr_prof.c (6009) |
---|---|
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.3 1994/08/02 07:42:32 davidg Exp $ | 34 * $Id: subr_prof.c,v 1.4 1994/09/21 21:58:39 bde Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> 40#include <sys/proc.h> 41#include <sys/user.h> 42#include <machine/cpu.h> 43 44#ifdef GPROF 45#include <sys/malloc.h> 46#include <sys/gmon.h> 47 | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> 40#include <sys/proc.h> 41#include <sys/user.h> 42#include <machine/cpu.h> 43 44#ifdef GPROF 45#include <sys/malloc.h> 46#include <sys/gmon.h> 47 |
48/* 49 * Froms is actually a bunch of unsigned shorts indexing tos 50 */ | |
51struct gmonparam _gmonparam = { GMON_PROF_OFF }; 52 | 48struct gmonparam _gmonparam = { GMON_PROF_OFF }; 49 |
50extern char btext[]; |
|
53extern char etext[]; 54 55void 56kmstartup() 57{ 58 char *cp; 59 struct gmonparam *p = &_gmonparam; 60 /* 61 * Round lowpc and highpc to multiples of the density we're using 62 * so the rest of the scaling (here and in gprof) stays in ints. 63 */ | 51extern char etext[]; 52 53void 54kmstartup() 55{ 56 char *cp; 57 struct gmonparam *p = &_gmonparam; 58 /* 59 * Round lowpc and highpc to multiples of the density we're using 60 * so the rest of the scaling (here and in gprof) stays in ints. 61 */ |
64 p->lowpc = ROUNDDOWN(KERNBASE, HISTFRACTION * sizeof(HISTCOUNTER)); | 62 p->lowpc = ROUNDDOWN((u_long)btext, HISTFRACTION * sizeof(HISTCOUNTER)); |
65 p->highpc = ROUNDUP((u_long)etext, HISTFRACTION * sizeof(HISTCOUNTER)); 66 p->textsize = p->highpc - p->lowpc; 67 printf("Profiling kernel, textsize=%d [%x..%x]\n", 68 p->textsize, p->lowpc, p->highpc); 69 p->kcountsize = p->textsize / HISTFRACTION; 70 p->hashfraction = HASHFRACTION; 71 p->fromssize = p->textsize / HASHFRACTION; 72 p->tolimit = p->textsize * ARCDENSITY / 100; --- 188 unchanged lines hidden --- | 63 p->highpc = ROUNDUP((u_long)etext, HISTFRACTION * sizeof(HISTCOUNTER)); 64 p->textsize = p->highpc - p->lowpc; 65 printf("Profiling kernel, textsize=%d [%x..%x]\n", 66 p->textsize, p->lowpc, p->highpc); 67 p->kcountsize = p->textsize / HISTFRACTION; 68 p->hashfraction = HASHFRACTION; 69 p->fromssize = p->textsize / HASHFRACTION; 70 p->tolimit = p->textsize * ARCDENSITY / 100; --- 188 unchanged lines hidden --- |