Home | History | Annotate | only in /src/lib/libc/gmon
History log of /src/lib/libc/gmon
RevisionDateAuthorComments
 1.16 29-Aug-2021  rillig libc: suppress lint warning for namespacing mismatch for _mcount

This is the last remaining instance of lint warning 215, which is about
implicitly defined functions. Since C99, these implicit declarations
have not been allowed anymore.
 1.15 30-May-2021  joerg Don't warn about frame pointer use for clang either.
 1.14 06-Jan-2019  christos branches: 1.14.6;
use the pico objects if we are making a PIC profiled library.
 1.13 05-Feb-2018  mrg branches: 1.13.2; 1.13.4;
copy the i386 workaround for amd64.
 1.12 04-Feb-2018  mrg fixes for GCC 6:

- -Wstrict-prototypes is not available for C++, so don't try to
ignore it for C++.
- remove many _DIAGASSERT() checks against not NULL for functions
with arguments with nonnull attributes. in two cases, leave
code behind that should set defaults to "(null)".
- use -Wno-error=frame-address for i386 mcount, as it seems valid
to assume the caller will have a frame.fair
 1.11 17-Sep-2014  joerg Use --no-warn only with GCC on MIPS.
 1.10 23-Jan-2011  matt Instead of testing for all mips variants, just use MACHINE_CPU.
 1.9 17-Dec-2009  mrg branches: 1.9.2;
don't warn about mcount on mips64* as well.

XXX: someone really should fix mips profile.h's MCOUNT!
 1.8 29-Jul-2008  lukem branches: 1.8.6; 1.8.12;
Disable assembler warnings on mipseb and mipsel for mcount.c
Workaround for PR#39192
 1.7 10-May-2004  thorpej branches: 1.7.26;
Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before dumping
the profile buffers.

Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.
 1.6 02-Jan-2002  briggs branches: 1.6.4;
We reference a monstartup(3), so let's actually make a link for it.
 1.5 05-Sep-2000  thorpej branches: 1.5.2;
Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.4 27-Feb-1995  cgd clean up Ids
 1.3 22-Dec-1994  cgd specify man pages the new way.
 1.2 14-May-1994  cgd rcsids. also, avoid floating point when picking scale value. doesn't
cost much, only done once.
 1.1 14-May-1994  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 14-May-1994  cgd user-land profiling code.
 1.5.2.1 28-Jan-2002  nathanw Catch up to -current.
 1.6.4.1 11-May-2004  tron Pull up revision 1.7 (requested by thorpej in ticket #308):
Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before
dumping
the profile buffers.
Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.
 1.7.26.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.12.1 22-Dec-2009  mrg pullup from -current:
>revision 1.9
>date: 2009/12/17 06:54:51; author: mrg; state: Exp; lines: +3 -2
>don't warn about mcount on mips64* as well.
>
>XXX: someone really should fix mips profile.h's MCOUNT!
 1.8.6.2 29-Jul-2008  lukem Disable assembler warnings on mipseb and mipsel for mcount.c
Workaround for PR#39192
 1.8.6.1 29-Jul-2008  lukem file Makefile.inc was added on branch christos-time_t on 2008-07-29 14:20:13 +0000
 1.9.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.13.4.1 10-Jun-2019  christos Sync with HEAD
 1.13.2.1 18-Jan-2019  pgoyette Synch with HEAD
 1.14.6.1 31-May-2021  cjep sync with head
 1.37 06-May-2022  rin PR lib/56395
PR toolchain/56771

Fix profiling on CPUs that do not support unaligned memory access;
Allocate objects (referenced from struct gmonparam) with proper
alignments.

For monstartup(), objects are allocated on heap. Break is not
guaranteed to be aligned at all, unlike stack pointer.

For _m_gmon_alloc(), objects are allocated on anonymous memory.
p->tos is not aligned properly in general.

This fixes quasi-random crashes for *_profile tests, at least on
SH-4 and PowerPC 403 [1]. Also, no regression is observed for
others as far as I can see.

This change does not cause any ABI breakage, as long as application
uses proper pointers; use p->tos instead of evil pointer arithmetic
like (struct tostruct *)((char *)p->froms + p->fromssize) [2].

[1] Timeout should be increased for some tests. "pic" variants
still fail as expected. Dynamically-linked binaries also crash in
rtld for SH-4, but this seems different problem...

[2] This example did not work even before, since the order of
froms[] and tos[] is reversed depending on which of monstartup() or
_m_gmon_alloc() is used for allocation.
 1.36 03-Jul-2021  christos PR/56246: Yuichiro Naito: gprof(1) never show call graphs when profiling
multi-threaded application
 1.35 18-Sep-2014  christos make more descriptors that we open as close-on-exec
 1.34 13-Mar-2012  christos PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@
 1.33 05-Jan-2011  wiz branches: 1.33.6;
Fix fdleak in #ifdef DEBUG. Found by cppcheck.
 1.32 01-Mar-2010  christos - KNF
- fix hertz()
- fix error and warning messages
 1.31 17-Jan-2010  wiz Close log file handle after using it. Found by cppcheck.
 1.30 12-Feb-2009  lukem sign-compare fixes
 1.29 15-Oct-2006  christos branches: 1.29.28;
fix incomplete initializers
 1.28 04-Oct-2006  christos don't include <sys/param.h> twice.
 1.27 04-Oct-2006  dogcow use rownddown/rowndup in sys/param.h instead of their now-deleted UC equivs
formerly in sys/gmon.h.
 1.26 11-May-2006  mrg in _m_gmon_destructor(0 when traversing the list, add (void *) to the cast
chain.
 1.25 24-Jan-2006  christos fix debugging printf formats.
 1.24 24-Jan-2006  christos fix compilation with -DDEBUG
 1.23 29-Nov-2005  christos WARNS=4
 1.22 10-May-2004  thorpej Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before dumping
the profile buffers.

Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.
 1.21 07-Aug-2003  agc branches: 1.21.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.20 06-Apr-2003  dsl Use snprintf instead of hand crafted string copy and numeric conversion.
Avoids problems if/when the pid is greater than 999999.
(approved by christos)
 1.19 11-Nov-2002  thorpej Fix signed/unsigned comparison warnings.
 1.18 26-Apr-2002  christos disable profiling set{u,g}id binaries.
 1.17 19-Feb-2001  cgd branches: 1.17.2;
convert from __progname to getprogname()
 1.16 20-Dec-2000  christos fix nested extern
fix sbrk casts
 1.15 14-Jan-1999  kleink branches: 1.15.10;
* On architectures using ELF, and conditionally on those in transition, rename
_ASM_LABEL(cerror) and _ASM_LABEL(curbrk) to _C_LABEL(__cerror) and
_C_LABEL(__curbrk) (or their respective architecture-specific equivalents) to
avoid possible name clashes with identifiers used in user applications.
* Do the same for minbrk on all architectures to avoid a GCC-specific (and
on ELF architectures effectively useless) symbol reference renaming in MI code.
 1.14 13-Nov-1998  christos delint
 1.13 10-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.12 04-Jul-1998  kleink Prefer STDERR_FILENO over 2.
 1.11 03-Feb-1998  perry remove obsolete register declarations
 1.10 13-Jul-1997  christos Fix RCSID's
Use warn instead of perror()
Use "namespace.h"
Add missing prototypes
 1.9 22-Apr-1997  mrg be safe with buffers. KNF.
 1.8 23-Jan-1997  mrg - convert unsafe strcpy(), strcat() and sprintf() to the `n' versions.
- some KNF.
 1.7 19-Dec-1996  cgd use __inline and __asm, rather than inline and asm. By default (without -g)
lint won't accept the latter two, but will accept the former two as valid.
As far as gcc's concerned, they're the same.
 1.6 12-Jun-1996  cgd branches: 1.6.2;
use p->hashfraction when doing non-time-critical calculations, rather than
using HASHFRACTION directly. in time-critical calculations, if HASHFRACTION
is a power of two, check that p->hashfraction == HASHFRACTION and if so do
the calculation with the compiled-in value so that the compiler can optimize
out (potentially) expensive divisions. if p->hashfraction != HASHFRACTION,
actually do the division. This has the result that on machines with slow
division, the division can be optimized out of the common case, but that
if HASHFRACTION changes from the compiled-in value (for whatever reason),
profiling will still work. Changes suggested by Chris Torek.
 1.5 21-Nov-1995  jtc branches: 1.5.4;
Add support for PROFDIR environment variable
 1.4 04-Nov-1995  cgd kill a gratuitous cast of lowpc to an int
 1.3 27-Feb-1995  cgd clean up Ids
 1.2 14-May-1994  cgd branches: 1.2.4;
rcsids. also, avoid floating point when picking scale value. doesn't
cost much, only done once.
 1.1 14-May-1994  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 14-May-1994  cgd user-land profiling code.
 1.2.4.1 02-May-1995  jtc #include "namespace.h"
 1.5.4.1 12-Jun-1996  cgd pull up from trunk:
>use p->hashfraction when doing non-time-critical calculations, rather than
>using HASHFRACTION directly. in time-critical calculations, if HASHFRACTION
>is a power of two, check that p->hashfraction == HASHFRACTION and if so do
>the calculation with the compiled-in value so that the compiler can optimize
>out (potentially) expensive divisions. if p->hashfraction != HASHFRACTION,
>actually do the division. This has the result that on machines with slow
>division, the division can be optimized out of the common case, but that
>if HASHFRACTION changes from the compiled-in value (for whatever reason),
>profiling will still work. Changes suggested by Chris Torek.
 1.6.2.1 20-Sep-1996  jtc snapshot namespace cleanup: net, etc.
 1.15.10.1 26-Apr-2002  he Pull up revision 1.18 (requested by christos):
Refuse to open gmon.out file if we are set{u,g}id, and not executing
as the owner/group.
 1.17.2.2 11-Nov-2002  nathanw Catch up to -current
 1.17.2.1 21-Jun-2002  nathanw Catch up to -current.
 1.21.2.1 11-May-2004  tron Pull up revision 1.22 (requested by thorpej in ticket #308):
Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before
dumping
the profile buffers.
Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.
 1.29.28.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.33.6.1 17-Apr-2012  yamt sync with head
 1.18 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.17 06-May-2005  jmc The __used__ change doesn't work on 2.95/vax. Put an #ifdef back in for vax and
reverted it to __unused__ as it was before
 1.16 24-Apr-2005  christos Remove unused, -- just used is enough. From uwe.
 1.15 24-Apr-2005  christos Add a __used__ attribute next to the __unused__ attribute, because we don't
want the optimizer to get rid of the whole code erroneously (which happens
with -O6 on sparc64).
 1.14 10-May-2004  thorpej Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before dumping
the profile buffers.

Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.
 1.13 07-Aug-2003  agc branches: 1.13.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.12 05-Sep-2000  thorpej Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.11 13-Nov-1998  christos delint
 1.10 26-Mar-1998  cgd don't actually compile any code if building in a _STANDALONE environment
(e.g. libkern for boot blocks), since profiling support doesn't make
sense there.
 1.9 03-Feb-1998  perry remove obsolete register declarations
 1.8 13-Jul-1997  christos Fix RCSID's
Add unused attribute to _mcount, since it might be called from assembly.
 1.7 03-Jan-1997  cgd prototype mcount (or, whatever function is declared by _MCOUNT_DECL;
typically mcount()) before it is defined or used.
 1.6 29-Jun-1996  abrown Copy over from libkern:
> Prevent recursive invocation of mcount() while in kernel by setting profiling
> state to BUSY while in mcount(). This allows profiling to work when mcount()
> calls a profiled routine (for example, udiv on the SPARC).
 1.5 12-Jun-1996  cgd use p->hashfraction when doing non-time-critical calculations, rather than
using HASHFRACTION directly. in time-critical calculations, if HASHFRACTION
is a power of two, check that p->hashfraction == HASHFRACTION and if so do
the calculation with the compiled-in value so that the compiler can optimize
out (potentially) expensive divisions. if p->hashfraction != HASHFRACTION,
actually do the division. This has the result that on machines with slow
division, the division can be optimized out of the common case, but that
if HASHFRACTION changes from the compiled-in value (for whatever reason),
profiling will still work. Changes suggested by Chris Torek.
 1.4 12-Jun-1996  cgd s/KERNEL/_KERNEL/ to match libkern version.
 1.3 27-Feb-1995  cgd branches: 1.3.6;
clean up Ids
 1.2 14-May-1994  cgd rcsids. also, avoid floating point when picking scale value. doesn't
cost much, only done once.
 1.1 14-May-1994  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 14-May-1994  cgd user-land profiling code.
 1.3.6.2 12-Jun-1996  cgd pull up from trunk:
>use p->hashfraction when doing non-time-critical calculations, rather than
>using HASHFRACTION directly. in time-critical calculations, if HASHFRACTION
>is a power of two, check that p->hashfraction == HASHFRACTION and if so do
>the calculation with the compiled-in value so that the compiler can optimize
>out (potentially) expensive divisions. if p->hashfraction != HASHFRACTION,
>actually do the division. This has the result that on machines with slow
>division, the division can be optimized out of the common case, but that
>if HASHFRACTION changes from the compiled-in value (for whatever reason),
>profiling will still work. Changes suggested by Chris Torek.
 1.3.6.1 12-Jun-1996  cgd pull up from trunk:
s/KERNEL/_KERNEL/ to match libkern version
 1.13.2.1 11-May-2004  tron Pull up revision 1.14 (requested by thorpej in ticket #308):
Make gmon / mcount work properly for threaded applications by keeping
thread-specific gmonparam structures and then merging them before
dumping
the profile buffers.
Written by Nathan J. Williams, contributed by Wasabi Systems, Inc.
 1.10 11-Apr-2009  joerg Fix markup.
 1.9 07-Aug-2003  agc branches: 1.9.42;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.8 01-Oct-2002  wiz New sentence, new line. Correct punctuation. Use more markup.
 1.7 16-Sep-2001  wiz Remove some boring whitespace, sort sections.
 1.6 24-Oct-2000  erh branches: 1.6.2;
Document the PROFDIR environment variable.
 1.5 22-Mar-1999  garbled Last of the .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages. Wheee!
 1.4 05-Feb-1998  perry add LIBRARY section to man page
 1.3 27-Feb-1995  cgd clean up Ids
 1.2 14-May-1994  cgd rcsids. also, avoid floating point when picking scale value. doesn't
cost much, only done once.
 1.1 14-May-1994  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 14-May-1994  cgd user-land profiling code.
 1.6.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.9.42.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

RSS XML Feed