Moved definition of FUNCTION_ALIGNMENT to a machine-dependent place.
Changed it from 4 to 16 for i386's. It can be anything for i386's, but compiler options limit it to a power of 2, and assembler and linker deficiencies limit it to a small power of 2 (<= 16). We use 16 in the kernel to get smaller tables (see Makefile.i386 and <machine/asmacros.h>). We still use the default of 4 in user mode. Use HISTCOUNTER instead of (*kcount) in the definition of KCOUNT() for consistency with other macros.
This commit is contained in:
parent
56bd74b435
commit
9f7ccdfa28
@ -38,6 +38,12 @@
|
||||
#define _MACHINE_PROFILE_H_
|
||||
|
||||
#ifdef KERNEL
|
||||
/*
|
||||
* Config generates something to tell the compiler to align functions on 16
|
||||
* byte boundaries. A strict alignment is good for keeping the tables small.
|
||||
*/
|
||||
#define FUNCTION_ALIGNMENT 16
|
||||
|
||||
/*
|
||||
* The kernel uses assembler stubs instead of unportable inlines.
|
||||
* This is mainly to save a little time when profiling is not enabled,
|
||||
@ -49,7 +55,7 @@
|
||||
#ifdef GUPROF
|
||||
#define CALIB_SCALE 1000
|
||||
#define KCOUNT(p,index) ((p)->kcount[(index) \
|
||||
/ (HISTFRACTION * sizeof(*(p)->kcount))])
|
||||
/ (HISTFRACTION * sizeof(HISTCOUNTER))])
|
||||
#define MCOUNT_DECL(s)
|
||||
#define MCOUNT_ENTER(s)
|
||||
#define MCOUNT_EXIT(s)
|
||||
@ -62,6 +68,8 @@
|
||||
|
||||
#else /* !KERNEL */
|
||||
|
||||
#define FUNCTION_ALIGNMENT 4
|
||||
|
||||
#define _MCOUNT_DECL static __inline void _mcount
|
||||
|
||||
#define MCOUNT \
|
||||
|
@ -38,6 +38,12 @@
|
||||
#define _MACHINE_PROFILE_H_
|
||||
|
||||
#ifdef KERNEL
|
||||
/*
|
||||
* Config generates something to tell the compiler to align functions on 16
|
||||
* byte boundaries. A strict alignment is good for keeping the tables small.
|
||||
*/
|
||||
#define FUNCTION_ALIGNMENT 16
|
||||
|
||||
/*
|
||||
* The kernel uses assembler stubs instead of unportable inlines.
|
||||
* This is mainly to save a little time when profiling is not enabled,
|
||||
@ -49,7 +55,7 @@
|
||||
#ifdef GUPROF
|
||||
#define CALIB_SCALE 1000
|
||||
#define KCOUNT(p,index) ((p)->kcount[(index) \
|
||||
/ (HISTFRACTION * sizeof(*(p)->kcount))])
|
||||
/ (HISTFRACTION * sizeof(HISTCOUNTER))])
|
||||
#define MCOUNT_DECL(s)
|
||||
#define MCOUNT_ENTER(s)
|
||||
#define MCOUNT_EXIT(s)
|
||||
@ -62,6 +68,8 @@
|
||||
|
||||
#else /* !KERNEL */
|
||||
|
||||
#define FUNCTION_ALIGNMENT 4
|
||||
|
||||
#define _MCOUNT_DECL static __inline void _mcount
|
||||
|
||||
#define MCOUNT \
|
||||
|
@ -68,12 +68,7 @@ struct gmonhdr {
|
||||
* addresses, so that each counter belongs to a unique function.
|
||||
* A lower density of counters would give less resolution but a
|
||||
* higher density would be wasted.
|
||||
*
|
||||
* Assume that function addresses are at least 4-byte-aligned.
|
||||
* It would be better to get the linker to align functions more
|
||||
* strictly so that we could use smaller tables.
|
||||
*/
|
||||
#define FUNCTION_ALIGNMENT 4
|
||||
#define HISTFRACTION (FUNCTION_ALIGNMENT / sizeof(HISTCOUNTER) == 0 \
|
||||
? 1 : FUNCTION_ALIGNMENT / sizeof(HISTCOUNTER))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user