Philippe Waroquiers 29252c77bb Add clo option the nr of entries in helgrind --history-level=full stack traces
The number of such entries was hardcoded to 8.
A new command line option -history-backtrace-size=number allows
to set the (max) number of entries to record.

Note that according
  perl perf/vg_perf --tools=helgrind --vg=. --vg=../trunk_untouched perf
this change (unexpectedly) improves some tests:
    - Running  tests in perf ----------------------------------------------
    -- bigcode1 --
    bigcode1 .         :0.08s  he: 2.0s (25.5x, -----)
    bigcode1 trunk_untouched:0.08s  he: 2.1s (25.9x, -1.5%)
    -- bigcode2 --
    bigcode2 .         :0.08s  he: 4.2s (52.2x, -----)
    bigcode2 trunk_untouched:0.08s  he: 4.2s (52.0x,  0.5%)
    -- bz2 --
    bz2      .         :0.40s  he: 6.5s (16.3x, -----)
    bz2      trunk_untouched:0.40s  he: 7.4s (18.5x,-14.0%)
    -- fbench --
    fbench   .         :0.15s  he: 2.0s (13.2x, -----)
    fbench   trunk_untouched:0.15s  he: 2.3s (15.5x,-17.7%)
    -- ffbench --
    ffbench  .         :0.16s  he: 3.7s (23.2x, -----)
    ffbench  trunk_untouched:0.16s  he: 3.7s (23.4x, -0.8%)
    -- heap --
    heap     .         :0.05s  he: 5.1s (102.8x, -----)
    heap     trunk_untouched:0.05s  he: 5.2s (104.6x, -1.8%)
    -- heap_pdb4 --
    heap_pdb4 .         :0.07s  he: 5.8s (82.9x, -----)
    heap_pdb4 trunk_untouched:0.07s  he: 5.8s (83.3x, -0.5%)
    -- many-loss-records --
    many-loss-records .         :0.01s  he: 1.0s (96.0x, -----)
    many-loss-records trunk_untouched:0.01s  he: 0.9s (95.0x,  1.0%)
    -- many-xpts --
    many-xpts .         :0.04s  he: 1.6s (38.8x, -----)
    many-xpts trunk_untouched:0.04s  he: 1.5s (38.5x,  0.6%)
    -- memrw --
    memrw    .         :0.06s  he: 2.5s (41.2x, -----)
    memrw    trunk_untouched:0.06s  he: 2.5s (41.2x,  0.0%)
    -- sarp --
    sarp     .         :0.02s  he: 4.0s (198.0x, -----)
    sarp     trunk_untouched:0.02s  he: 3.9s (196.5x,  0.8%)
    -- tinycc --
    tinycc   .         :0.10s  he: 7.1s (70.7x, -----)
    tinycc   trunk_untouched:0.10s  he: 7.6s (75.8x, -7.2%)
    -- Finished tests in perf ----------------------------------------------

    == 12 programs, 24 timings =================
2022-12-29 11:14:05 +01:00

145 lines
6.0 KiB
C

/*--------------------------------------------------------------------*/
/*--- Basic definitions for all of Helgrind. ---*/
/*--- hg_basics.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Helgrind, a Valgrind tool for detecting errors
in threaded programs.
Copyright (C) 2007-2017 OpenWorks Ltd
info@open-works.co.uk
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __HG_BASICS_H
#define __HG_BASICS_H
/*----------------------------------------------------------------*/
/*--- Very basic stuff ---*/
/*----------------------------------------------------------------*/
#define HG_(str) VGAPPEND(vgHelgrind_,str)
void* HG_(zalloc) ( const HChar* cc, SizeT n );
void HG_(free) ( void* p );
HChar* HG_(strdup) ( const HChar* cc, const HChar* s );
static inline Bool HG_(is_sane_ThreadId) ( ThreadId coretid ) {
return coretid >= 0 && coretid < VG_N_THREADS;
}
/*----------------------------------------------------------------*/
/*--- Command line options ---*/
/*----------------------------------------------------------------*/
/* Flags for controlling for which events sanity checking is done */
#define SCE_THREADS (1<<0) // Sanity check at thread create/join
#define SCE_LOCKS (1<<1) // Sanity check at lock events
#define SCE_BIGRANGE (1<<2) // Sanity check at big mem range events
#define SCE_ACCESS (1<<3) // Sanity check at mem accesses
#define SCE_LAOG (1<<4) // Sanity check at significant LAOG events
#define SCE_BIGRANGE_T 256 // big mem range minimum size
/* Enable/disable lock order checking. Sometimes it produces a lot of
errors, possibly genuine, which nevertheless can be very
annoying. */
extern Bool HG_(clo_track_lockorders);
/* When comparing race errors for equality, should the race address be
taken into account? For users, no, but for verification purposes
(regtesting) this is sometimes important. */
extern Bool HG_(clo_cmp_race_err_addrs);
/* Controls how much history to collect, in order to show conflicting
accesses. There are three levels:
0: "none": don't collect any history. Fastest, but means we can
only show one of the two stacks in a race.
1: "approx": collect one stack trace per (notional) segment, that
is, collect a stack trace for a thread every time its vector
clock changes. This facilitates showing the bounds of the
conflicting segment(s), with relatively small overhead.
2: "full": collect a stack trace every time the constraints for a
location change. This facilitates showing both stack traces in
a race, although can be very expensive in time and space
(depends on the rate that threads "drag" locations across
vector-clock-change boundaries ("dragovers"). This involves
collecting and storing large numbers of call stacks just in case
we might need to show them later, and so is expensive (although
very useful). */
extern UWord HG_(clo_history_level);
/* Controls how many IPs an history stack records. */
extern UInt HG_(clo_history_backtrace_size);
/* For full history level, determines how the stack trace is computed.
no : a stacktrace is always computed from scratch, typically
using the unwind information.
yes : a stacktrace might be derived from a previous captured stacktrace,
by applying a delta to the inner frame. This can significantly
speed up --history-level=full. Typically, a delta can be applied
if there was no 'flow call control' instruction (call, return, ...)
executed since the previous captured stacktrace. */
extern Bool HG_(clo_delta_stacktrace);
/* When doing "full" history collection, this determines the size of
the conflicting-access cache, measured in terms of maximum possible
number of elements in the previous-access map. Must be between 10k
amd 10 million. Default is 1 million. */
extern UWord HG_(clo_conflict_cache_size);
/* Sanity check level. This is an or-ing of
SCE_{THREADS,LOCKS,BIGRANGE,ACCESS,LAOG}. */
extern UWord HG_(clo_sanity_flags);
/* Treat heap frees as if the memory was written immediately prior to
the free. This shakes out races in which memory is referenced by
one thread, and freed by another, and there's no observable
synchronisation event to guarantee that the reference happens
before the free. */
extern Bool HG_(clo_free_is_write);
/* Controls the application of VTS pruning. There are three levels:
0: "never": VTS pruning is never done
1: "auto": (the default): VTS pruning is sometimes done after VTS
GCs, just frequently enough to keep space use under control, as
determined by heuristics in libhb_core.c.
2: "always": VTS pruning is done after every VTS GC. This is
mostly a big time waster, but minimises space use. */
extern UWord HG_(clo_vts_pruning);
/* When False, race checking ignores memory references which are to
the stack, which speeds things up a bit. Default: True. */
extern Bool HG_(clo_check_stack_refs);
#endif /* ! __HG_BASICS_H */
/*--------------------------------------------------------------------*/
/*--- end hg_basics.h ---*/
/*--------------------------------------------------------------------*/