/[base]/head/sys/i386/include/profile.h
ViewVC logotype

Log of /head/sys/i386/include/profile.h

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:

Revision 334528 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 2 09:59:27 2018 UTC (6 years, 1 month ago) by bde
File length: 5662 byte(s)
Diff to previous 334522
Oops, the last minute reduction in the clobber list for i386
MCOUNT_OVERHEAD() in r334522 was too agressive.  Only mcount exit
preserves %eax and %edx.


Revision 334522 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 2 05:48:44 2018 UTC (6 years, 1 month ago) by bde
File length: 5650 byte(s)
Diff to previous 334520
Fix high resolution kernel profiling just enough to not crash at boot
time, especially for SMP.  If configured, it turns itself on at boot
time for calibration, so is fragile even if never otherwise used.

Both types of kernel profiling were supposed to use a global spinlock
in the SMP case.  If hi-res profiling is configured (but not necessarily
used), this was supposed to be optimized by only using it when
necessary, and slightly more efficiently, in asm.  But it was not done
at all for mcount entry where it is necessary.  This caused crashes
in the SMP case when either type of profiling was enabled.  For mcount
exit, it only caused wrong times.  The times were wrongest with an
i8254 timer since using that requires exclusive access to the hardware.
The i8254 timer was too slow to use here 20 years ago and is much less
usable now, but it is the default for the SMP case since TSCs weren't
invariant when SMP was new.  Do the locking in all hi-res SMP cases for
simplicity.

Calibration uses special asms, and the clobber lists in these were sort
of inverted.  They contained the arg and return registers which are not
clobbered, but on amd64 they didn't contain the residue of the call-used
registers which may be clobbered (%r10 and %r11).  This usually caused
hangs at boot time.  This usually affected even the UP case.


Revision 334520 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 2 04:25:09 2018 UTC (6 years, 1 month ago) by bde
File length: 5674 byte(s)
Diff to previous 326123
Fix recent breakages of kernel profiling, mostly on i386 (high resolution
kernel profiling remains broken).

memmove() was broken using ALTENTRY().  ALTENTRY() is only different from
ENTRY() in the profiling case, and its use in that case was sort of
backwards.  The backwardness magically turned memmove() into memcpy()
instead of completely breaking it.  Only the high resolution parts of
profiling itself were broken.  Use ordinary ENTRY() for memmove().
Turn bcopy() into a tail call to memmove() to reduce complications.
This gives slightly different pessimizations and profiling lossage.
The pessimizations are minimized by not using a frame pointer() for
bcopy().

Calls to profiling functions from exception trampolines were not
relocated.  This caused crashes on the first exception.  Fix this using
function pointers.

Addresses of exception handlers in trampolines were not relocated.  This
caused unknown offsets in the profiling data.  Relocate by abusing
setidt_disp as for pmc although this is slower than necessary and
requires namespace pollution.  pmc seems to be missing some relocations.
Stack traces and lots of other things in debuggers need similar relocations.

Most user addresses were misclassified as unknown kernel addresses and
then ignored.  Treat all unknown addresses as user. Now only user
addresses in the kernel text range are significantly misclassified (as
known kernel addresses).

The ibrs functions didn't preserve enough registers.  This is the only
recent breakage on amd64.  Although these functions are written in
asm, in the profiling case they call profiling functions which are
mostly for the C ABI, so they only have to save call-used registers.
They also have to save arg and return registers in some cases and
actually save them in all cases to reduce complications.  They end up
saving all registers except %ecx on i386 and %r10 and %r11 on amd64.
Saving these is only needed for 1 caller on each of amd64 and i386.
Save them there.  This is slightly simpler.

Remove saving %ecx in handle_ibrs_exit on i386.  Both handle_ibrs_entry
and handle_ibrs_exit use %ecx, but only the latter needed to or did
save it.  But saving it there doesn't work for the profiling case.

amd64 has more automatic saving of the most common scratch registers
%rax, %rcx and %rdx (its complications for %r10 are from unusual use
of %r10 by SYSCALL).  Thus profiling of handle_ibrs_exit_rs() was not
broken, and I didn't simplify the saving by moving the saving of these
registers from it to the caller.


Revision 326123 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 23 11:40:16 2017 UTC (6 years, 7 months ago) by kib
File length: 5366 byte(s)
Diff to previous 326023
Remove lint support from system headers and MD x86 headers.

Reviewed by:	dim, jhb
Discussed with:	imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D13156


Revision 326023 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 20 19:43:44 2017 UTC (6 years, 7 months ago) by pfg
File length: 5486 byte(s)
Diff to previous 314436
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


Revision 314436 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 28 23:42:47 2017 UTC (7 years, 4 months ago) by imp
File length: 5442 byte(s)
Diff to previous 214346
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96


Revision 214346 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 25 15:28:03 2010 UTC (13 years, 8 months ago) by jhb
File length: 5442 byte(s)
Diff to previous 180756
Use intr_disable() and intr_restore() instead of frobbing the flags register
directly to disable interrupts.

Reviewed by:	bde (earlier version)
MFC after:	2 weeks


Revision 180756 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 23 11:37:20 2008 UTC (15 years, 11 months ago) by luoqi
File length: 5468 byte(s)
Diff to previous 163735
Unbreak cc -pg support on i386. In gcc 4.2, %ecx is used as the arg pointer
when stack realignment is turned on (it is ALWAYS on for main), however
in a profiling build %ecx would be clobbered by mcount(), this would lead
to a segmentation fault when the code tries to reference any argument.
This fix changes mcount() to preserve %ecx.

PR:		bin/119709
Reviewed by:	bde
MFC after:	1 week


Revision 163735 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 28 11:03:03 2006 UTC (17 years, 8 months ago) by bde
File length: 5095 byte(s)
Diff to previous 163729
i386/include/profile.h:
Fixed a syntax error for the (!__KERNEL && !__GNUCLIKE_ASM) case in
rev.1.36.  Apparently, this case has never been reached even by lint.

Submitted by:	stefanf

{amd64,i386}/include/profile.h:
In case the above case is actually reached, break it properly by
providing null support that will fail at link time instead of a stub
that gives wrong (null) profiling at runtime.


Revision 163729 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 28 07:59:11 2006 UTC (17 years, 8 months ago) by bde
File length: 5151 byte(s)
Diff to previous 143063
In MCOUNT_OVERHEAD(label), actually use the `label' parameter.  We were
still using the global label named "profil", and this worked accidentally
because all callers use the same name.


Revision 143063 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 2 21:33:29 2005 UTC (19 years, 4 months ago) by joerg
File length: 5152 byte(s)
Diff to previous 139790
netchild's mega-patch to isolate compiler dependencies into a central
place.

This moves the dependency on GCC's and other compiler's features into
the central sys/cdefs.h file, while the individual source files can
then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to
refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42.

By now, GCC and ICC (the Intel compiler) have been actively tested on
IA32 platforms by netchild.  Extension to other compilers is supposed
to be possible, of course.

Submitted by:	netchild
Reviewed by:	various developers on arch@, some time ago


Revision 139790 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 6 22:18:23 2005 UTC (19 years, 5 months ago) by imp
File length: 5202 byte(s)
Diff to previous 134398
/* -> /*- for copyright notices, minor format tweaks as necessary


Revision 134398 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 27 19:42:35 2004 UTC (19 years, 10 months ago) by marcel
File length: 5201 byte(s)
Diff to previous 129498
Move the kernel-specific logic to adjust frompc from MI to MD. For
these two reasons:
1. On ia64 a function pointer does not hold the address of the first
   instruction of a functions implementation. It holds the address
   of a function descriptor. Hence the user(), btrap(), eintr() and
   bintr() prototypes are wrong for getting the actual code address.
2. The logic forces interrupt, trap and exception entry points to
   be layed-out contiguously. This can not be achieved on ia64 and is
   generally just bad programming.

The MCOUNT_FROMPC_USER macro is used to set the frompc argument to
some kernel address which represents any frompc that falls outside
the kernel text range. The macro can expand to ~0U to bail out in
that case.
The MCOUNT_FROMPC_INTR macro is used to set the frompc argument to
some kernel address to represent a call to a trap or interrupt
handler. This to avoid that the trap or interrupt handler appear to
be called from everywhere in the call graph. The macro can expand
to ~0U to prevent adjusting frompc. Note that the argument is selfpc,
not frompc.

This commit defines the macros on all architectures equivalently to
the original code in sys/libkern/mcount.c. People can take it from
here...

Compile-tested on: alpha, amd64, i386, ia64 and sparc64
Boot-tested on: i386


Revision 129498 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 20 16:12:19 2004 UTC (20 years, 1 month ago) by bde
File length: 4846 byte(s)
Diff to previous 129445
Moved i386 asms to an i386 header.  The asms are for calibration of
high resolution kernel profiling (options GUPROF.  "U" in GUPROF stands
for microseconds resolution, but the resolution is now smaller than 1
nanosecond on multi-GHz machines and the accuracy is heading towards
1 nanosecond too).  Arches that support GUPROF must now provide certain
macros for the calibration.  GUPROF is now only supported for i386's,
so the absence of the new macros for other arches doesn't break anything
that wasn't already broken.  amd64's have uncommitted support for
GUPROF, and sparc64's have support that seems to be complete except
here (there was an #error for non-i386 cases; now there are undefined
macros).

Changed the asms a little:
- declare them as __volatile.  They must not be moved, and exporting a
  label across asms is technically incorrect, so try harder to stop gcc
  moving them.
- don't put the non-clobbered register "bx" in the clobber list.  The
  clobber lists are still more conservative than necessary.
- drop the non-support for gcc-1.  It just gave a better error message,
  and this is not useful since compiling with gcc-1 would cause thousands
  of worse error messages.
- drop the support for aout.


Revision 129445 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 19 16:04:26 2004 UTC (20 years, 1 month ago) by bde
File length: 4202 byte(s)
Diff to previous 129444
Fixed some style bugs (mainly misalignment of backslashes).


Revision 129444 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 19 15:41:26 2004 UTC (20 years, 1 month ago) by bde
File length: 4186 byte(s)
Diff to previous 128019
Moved most of the "MI" definitions and declarations from <machine/profile.h>
to <sys/gmon.h>.  Cleaned them up a little by not attempting to ifdef
for incomplete and out of date support for GUPROF in userland, as in
the sparc64 version.


Revision 128019 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 7 20:46:16 2004 UTC (20 years, 3 months ago) by imp
File length: 4901 byte(s)
Diff to previous 126891
Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson


Revision 126891 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 12 21:45:33 2004 UTC (20 years, 3 months ago) by trhodes
File length: 5138 byte(s)
Diff to previous 124180
These are changes to allow to use the Intel C/C++ compiler (lang/icc)
to build the kernel. It doesn't affect the operation if gcc.

Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as
icc v8 may define __GNUC__ some parts may look strange but are
necessary.

Additional changes:
 - in_cksum.[ch]:
   * use a generic C version instead of the assembly version in the !gcc
     case (ASM code breaks with the optimizations icc does)
     -> no bad checksums with an icc compiled kernel
     Help from:		andre, grehan, das
     Stolen from: 	alpha version via ppc version
     The entire checksum code should IMHO be replaced with the DragonFly
     version (because it isn't guaranteed future revisions of gcc will
     include similar optimizations) as in:
        ---snip---
          Revision  Changes    Path
          1.12      +1 -0      src/sys/conf/files.i386
          1.4       +142 -558  src/sys/i386/i386/in_cksum.c
          1.5       +33 -69    src/sys/i386/include/in_cksum.h
          1.5       +2 -0      src/sys/netinet/igmp.c
          1.6       +0 -1      src/sys/netinet/in.h
          1.6       +2 -0      src/sys/netinet/ip_icmp.c

          1.4       +3 -4      src/contrib/ipfilter/ip_compat.h
          1.3       +1 -2      src/sbin/natd/icmp.c
          1.4       +0 -1      src/sbin/natd/natd.c
          1.48      +1 -0      src/sys/conf/files
          1.2       +0 -1      src/sys/conf/files.amd64
          1.13      +0 -1      src/sys/conf/files.i386
          1.5       +0 -1      src/sys/conf/files.pc98
          1.7       +1 -1      src/sys/contrib/ipfilter/netinet/fil.c
          1.10      +2 -3      src/sys/contrib/ipfilter/netinet/ip_compat.h
          1.10      +1 -1      src/sys/contrib/ipfilter/netinet/ip_fil.c
          1.7       +1 -1      src/sys/dev/netif/txp/if_txp.c
          1.7       +1 -1      src/sys/net/ip_mroute/ip_mroute.c
          1.7       +1 -2      src/sys/net/ipfw/ip_fw2.c
          1.6       +1 -2      src/sys/netinet/igmp.c
          1.4       +158 -116  src/sys/netinet/in_cksum.c
          1.6       +1 -1      src/sys/netinet/ip_gre.c
          1.7       +1 -2      src/sys/netinet/ip_icmp.c
          1.10      +1 -1      src/sys/netinet/ip_input.c
          1.10      +1 -2      src/sys/netinet/ip_output.c
          1.13      +1 -2      src/sys/netinet/tcp_input.c
          1.9       +1 -2      src/sys/netinet/tcp_output.c
          1.10      +1 -1      src/sys/netinet/tcp_subr.c
          1.10      +1 -1      src/sys/netinet/tcp_syncache.c
          1.9       +1 -2      src/sys/netinet/udp_usrreq.c

          1.5       +1 -2      src/sys/netinet6/ipsec.c
          1.5       +1 -2      src/sys/netproto/ipsec/ipsec.c
          1.5       +1 -1      src/sys/netproto/ipsec/ipsec_input.c
          1.4       +1 -2      src/sys/netproto/ipsec/ipsec_output.c

          and finally remove
            sys/i386/i386        in_cksum.c
            sys/i386/include     in_cksum.h
        ---snip---
 - endian.h:
   * DTRT in C++ mode
 - quad.h:
   * we don't use gcc v1 anymore, remove support for it
   Suggested by:	bde (long ago)
 - assym.h:
   * avoid zero-length arrays (remove dependency on a gcc specific
     feature)
     This change changes the contents of the object file, but as it's
     only used to generate some values for a header, and the generator
     knows how to handle this, there's no impact in the gcc case.
   Explained by:	bde
   Submitted by:	Marius Strobl <marius@alchemy.franken.de>
 - aicasm.c:
   * minor change to teach it about the way icc spells "-nostdinc"
   Not approved by:	gibbs (no reply to my mail)
 - bump __FreeBSD_version (lang/icc needs to know about the changes)

Incarnations of this patch survive gcc compiles since a loooong time,
I use it on my desktop. An icc compiled kernel works since Nov. 2003
(exceptions: snd_* if used as modules), it survives a build of the
entire ports collection with icc.

Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.

Reviewed by:	-arch
Submitted by:	netchild


Revision 124180 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 6 18:49:54 2004 UTC (20 years, 6 months ago) by nectar
File length: 5025 byte(s)
Diff to previous 115659
Use ANSI C function definition for `_mcount' and remove `static'
prototype from header file.

Discussed with:	bde, maybe one year ago


Revision 115659 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 2 00:29:35 2003 UTC (21 years, 1 month ago) by obrien
File length: 5084 byte(s)
Diff to previous 103965
Use C99 compatable asm statements.


Revision 103965 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 25 13:46:23 2002 UTC (21 years, 9 months ago) by markm
File length: 5080 byte(s)
Diff to previous 103436
Fix a declaration that is actually supposed to be a macro definition.

Submitted by:	marius@alchemy.franken.de


Revision 103436 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 17 01:49:00 2002 UTC (21 years, 9 months ago) by peter
File length: 5062 byte(s)
Diff to previous 95195
Initiate deorbit burn for the i386-only a.out related support.  Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha


Revision 95195 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 21 10:49:00 2002 UTC (22 years, 2 months ago) by markm
File length: 5125 byte(s)
Diff to previous 92761
Stylify (mainly line up macro EOL-continuation \'s), and add a dummy
alternative for lint.


Revision 92761 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 20 05:48:58 2002 UTC (22 years, 3 months ago) by alfred
File length: 4948 byte(s)
Diff to previous 90024
Remove __P.


Revision 90024 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jan 31 13:49:55 2002 UTC (22 years, 5 months ago) by bde
File length: 5032 byte(s)
Diff to previous 85733
Finish revs.1.23 and 1.24 so that MCOUNT_ENTER really actually compiles
for SMP in the plain profiling case.  It seems to work too.

This error was not detected by LINT because LINT only compiles the
GUPROF profiling case, which is is a superset of the plain profiling
case for !SMP but which is so broken for SMP that the buggy code is
not compiled.


Revision 85733 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 30 15:04:57 2001 UTC (22 years, 8 months ago) by green
File length: 5008 byte(s)
Diff to previous 79734
Add kmupetext(), a function that expands the range of memory covered
by the profiler on a running system.  This is not done sparsely, as
memory is cheaper than processor speed and each gprof mcount() and
mexitcount() operation is already very expensive.

Obtained from:	NAI Labs CBOSS project
Funded by:	DARPA


Revision 79734 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 14 21:40:53 2001 UTC (22 years, 11 months ago) by jhb
File length: 4966 byte(s)
Diff to previous 78908
Fix MCOUNT_ENTER() so it actually compiles in the profiling case.

Pointy hat to:	me
Submitted by:	Danny J. Zerkel <dzerkel@columbus.rr.com>


Revision 78908 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 28 04:03:29 2001 UTC (23 years ago) by jhb
File length: 4965 byte(s)
Diff to previous 72200
Get kernel profiling on SMP systems closer to working by replacing the
mcount spin mutex with a very simple non-recursive spinlock implemented
using atomic operations.


Revision 72200 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 9 06:11:45 2001 UTC (23 years, 4 months ago) by bmilekic
File length: 4924 byte(s)
Diff to previous 71576
Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)


Revision 71576 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 24 12:35:55 2001 UTC (23 years, 5 months ago) by jasone
File length: 4941 byte(s)
Diff to previous 55205
Convert all simplelocks to mutexes and remove the simplelock implementations.


Revision 55205 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 29 04:46:21 1999 UTC (24 years, 6 months ago) by peter
File length: 4928 byte(s)
Diff to previous 50477
Change #ifdef KERNEL to #ifdef _KERNEL in the public headers.  "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.


Revision 50477 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 28 01:08:13 1999 UTC (24 years, 10 months ago) by peter
File length: 4922 byte(s)
Diff to previous 38928
$Id$ -> $FreeBSD$


Revision 38928 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 7 23:32:00 1998 UTC (25 years, 10 months ago) by jdp
File length: 4964 byte(s)
Diff to previous 37629
Make profiling work for ELF.  gprof now autodetects the format of
the executable file, so it will work for both a.out and ELF format
files.  I have split the object format specific code into separate
source files.  It's cleaner than it was before, but it's still
pretty crufty.

Don't cheat on your make world for this update.  A lot of things
have to be rebuilt for it to work, including the compiler and all
of the profiled libraries.


Revision 37629 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 14 05:09:48 1998 UTC (25 years, 11 months ago) by bde
File length: 4894 byte(s)
Diff to previous 37542
Changed to the C9x draft spelling of the (unsigned) integral type
suitable for holding object pointers (ptrint_t -> uintptr_t).
Added corresponding signed type (intptr_t).  Changed/added
corresponding non-C9x types for function pointers to match.  Don't
use nonstandard types to implement these types, and don't comment
on them in <machine/types.h>.


Revision 37542 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 10 09:26:41 1998 UTC (25 years, 11 months ago) by bde
File length: 4946 byte(s)
Diff to previous 37540
Oops, fptrint_t still needs to be declared in <machine/profile.h> in the
!KERNEL case.  The kludge to get it declared in libc/gmon/mcount.c wasn't
sufficient because fptrint_t is used in <sys/gmon.h>.


Revision 37540 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 10 02:27:16 1998 UTC (26 years ago) by bde
File length: 4849 byte(s)
Diff to previous 33047
Added a kernel-only typedef (ptrint_t) giving an integral type that is
least unsuitable for holding an object pointer.  This should have been
used to fix warnings about casts between pointers and ints on alphas.

Moved corresponding existing general typedef (fptrint_t) for function
pointers from the i386 <machine/profile.h> to a kernel-only typedef
in <machine/types.h>.  Kludged libc/gmon/mcount.c so that it can
still see this typedef.


Revision 33047 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 3 20:32:38 1998 UTC (26 years, 5 months ago) by bde
File length: 4942 byte(s)
Diff to previous 31723
Ifdefed use of a GNU feature.


Revision 31723 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 15 02:18:35 1997 UTC (26 years, 6 months ago) by tegge
File length: 4918 byte(s)
Diff to previous 28921
Add support for low resolution SMP kernel profiling.

  - A nonprofiling version of s_lock (called s_lock_np) is used
    by mcount.

  - When profiling is active, more registers are clobbered in
    seemingly simple assembly routines. This means that some
    callers needed to save/restore extra registers.

  - The stack pointer must have space for a 'fake' return address
    in idle, to avoid stack underflow.


Revision 28921 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 30 08:08:10 1997 UTC (26 years, 10 months ago) by fsmp
File length: 4780 byte(s)
Diff to previous 22975
Another round of lock pushdown.
Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel.
UP kernel expects that this is enough to guarantee exclusive access to
regions of code bracketed by these 2 functions.
Add a simplelock to bracket clock accesses in clock.c: clock_lock.

Help from:	Bruce Evans <bde@zeta.org.au>


Revision 22975 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 22 09:48:43 1997 UTC (27 years, 4 months ago) by peter
File length: 4646 byte(s)
Diff to previous 22639
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.


Revision 22639 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 13 10:47:29 1997 UTC (27 years, 4 months ago) by bde
File length: 4651 byte(s)
Diff to previous 21673
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.


Revision 21673 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 14 07:20:47 1997 UTC (27 years, 5 months ago) by jkh
File length: 4430 byte(s)
Diff to previous 19000
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.


Revision 19000 - (view) (download) (annotate) - [select for diffs]
Modified Thu Oct 17 19:32:31 1996 UTC (27 years, 8 months ago) by bde
File length: 4471 byte(s)
Diff to previous 17879
Improved non-statistical (GUPROF) profiling:
- use a more accurate and more efficient method of compensating for
  overheads.  The old method counted too much time against leaf
  functions.
- normally use the Pentium timestamp counter if available.
  On Pentiums, the times are now accurate to within a couple of cpu
  clock cycles per function call in the (unlikely) event that there
  are no cache misses in or caused by the profiling code.
- optionally use an arbitrary Pentium event counter if available.
- optionally regress to using the i8254 counter.
- scaled the i8254 counter by a factor of 128.  Now the i8254 counters
  overflow slightly faster than the TSC counters for a 150MHz Pentium :-)
  (after about 16 seconds).  This is to avoid fractional overheads.

files.i386:
permon.c temporarily has to be classified as a profiling-routine
because a couple of functions in it may be called from profiling code.

options.i386:
- I586_CTR_GUPROF is currently unused (oops).
- I586_PMC_GUPROF should be something like 0x70000 to enable (but not
  use unless prof_machdep.c is changed) support for Pentium event
  counters.  7 is a control mode and the counter number 0 is somewhere
  in the 0000 bits (see perfmon.h for the encoding).

profile.h:
- added declarations.
- cleaned up separation of user mode declarations.

prof_machdep.c:
Mostly clock-select changes.  The default clock can be changed by
editing kmem.  There should be a sysctl for this.

subr_prof.c:
- added copyright.
- calibrate overheads for the new method.
- documented new method.
- fixed races and and machine dependencies in start/stop code.

mcount.c:
Use the new overhead compensation method.

gmon.h:
- changed GPROF4 counter type from unsigned to int.  Oops, this should
  be machine-dependent and/or int32_t.
- reorganized overhead counters.

Submitted by:	Pentium event counter changes mostly by wollman


Revision 17879 - (view) (download) (annotate) - [select for diffs]
Modified Wed Aug 28 20:15:32 1996 UTC (27 years, 10 months ago) by bde
File length: 3958 byte(s)
Diff to previous 13157
Cleaned up interrupt masking by declaring the state variable in a
machine-dependent macro and passing it to all machine-dependent
macros.

Eliminated the state variable for the GUPROF case.


Revision 13157 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jan 1 17:11:21 1996 UTC (28 years, 6 months ago) by bde
File length: 3850 byte(s)
Diff to previous 13107
Fixed user-mode mcount which I broke in the previous revision.
Do it the old way for now.

Moved recent additions around a lot to minimise ifdefs.

Added prototypes.


Revision 13107 - (view) (download) (annotate) - [select for diffs]
Modified Fri Dec 29 15:30:05 1995 UTC (28 years, 6 months ago) by bde
File length: 3456 byte(s)
Diff to previous 2801
Implemented non-statistical kernel profiling.  This is based on
looking at a high resolution clock for each of the following events:
function call, function return, interrupt entry, interrupt exit,
and interesting branches.  The differences between the times of
these events are added at appropriate places in a ordinary histogram
(as if very fast statistical profiling sampled the pc at those
places) so that ordinary gprof can be used to analyze the times.

gmon.h:
Histogram counters need to be 4 bytes for microsecond resolutions.
They will need to be larger for the 586 clock.
The comments were vax-centric and wrong even on vaxes.  Does anyone
disagree?

gprof4.c:
The standard gprof should support counters of all integral sizes
and the size of the counter should be in the gmon header.  This
hack will do until then.  (Use gprof4 -u to examine the results
of non-statistical profiling.)

config/*:
Non-statistical profiling is configured with `config -pp'.
`config -p' still gives ordinary profiling.

kgmon/*:
Non-statistical profiling is enabled with `kgmon -B'.  `kgmon -b'
still enables ordinary profiling (and distables non-statistical
profiling) if non-statistical profiling is configured.


Revision 2801 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 15 16:27:14 1994 UTC (29 years, 9 months ago) by paul
File length: 2767 byte(s)
Diff to previous 2166
Added MCOUNT_ENTER and MCOUNT_EXIT macros to profile.h

Removed inb function since it's more correctly in pio.h

Copied write_eflags and read_eflags over from npx.c

(Some changes to the macros suggested by Bruce were not made at this
time since his suggestions probably apply to all the macros and
these inlined/macro definitions need a lot of cleaning up at some
point in the future.)

Reviewed by:	Bruce


Revision 2166 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 21 04:55:31 1994 UTC (29 years, 10 months ago) by paul
File length: 2650 byte(s)
Diff to previous 1817
Made idempotent.
Reviewed by:
Submitted by:


Revision 1817 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 2 07:55:43 1994 UTC (29 years, 11 months ago) by dg
File length: 2526 byte(s)
Diff to previous 1544
Added $Id$


Revision 1544 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 25 01:34:38 1994 UTC (30 years, 1 month ago) by rgrimes
File length: 2518 byte(s)
Copied from: vendor/CSRG/dist/sys/i386/include/profile.h revision 1543
Diff to previous 1543
This commit was generated by cvs2svn to compensate for changes in r1543,
which included commits to RCS files with non-trunk default branches.


Revision 1543 - (view) (download) (annotate) - [select for diffs]
Added Wed May 25 01:34:38 1994 UTC (30 years, 1 month ago) by rgrimes
Original Path: vendor/CSRG/dist/sys/i386/include/profile.h
File length: 2518 byte(s)
BSD 4.4 Lite Kernel Sources


This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27