45 Commits

Author SHA1 Message Date
Nicholas Nethercote
40ab2f14db Flip the default value of --auto and --show-percs to yes.
In both `cg_annotate` and `callgrind_annotate`.
2020-02-21 09:40:23 +11:00
Andreas Arnez
7f63a88426 callgrind_annotate, cg_annotate: don't truncate function names at '#'
C++ function names can contain substrings like "{lambda()#1}".  But
callgrind_annotate and cg_annotate interpret the '#'-character as a
comment marker anywhere on each input line, and thus truncate such names
there.

On the other hand, the documentation in docs/cl-format.xml, states:

  Everywhere, comments on own lines starting with '#' are allowed.

This seems to imply that a comment line must start with '#' in the first
column.  Thus skip exactly such lines in the input file and don't handle
'#' as a comment marker anywhere else.

Signed-off-by: Philippe Waroquiers <philippe.waroquiers@skynet.be>
2019-11-03 17:39:36 +01:00
Mark Wielaard
461cc5c003 Cleanup GPL header address notices by using http://www.gnu.org/licenses/
Sync VEX/LICENSE.GPL with top-level COPYING file. We used 3 different
addresses for writing to the FSF to receive a copy of the GPL. Replace
all different variants with an URL <http://www.gnu.org/licenses/>.

The following files might still have some slightly different (L)GPL
copyright notice because they were derived from other programs:

- files under coregrind/m_demangle which come from libiberty:
  cplus-dem.c, d-demangle.c, demangle.h, rust-demangle.c,
  safe-ctype.c and safe-ctype.h
- coregrind/m_demangle/dyn-string.[hc] derived from GCC.
- coregrind/m_demangle/ansidecl.h derived from glibc.
- VEX files for FMA detived from glibc:
  host_generic_maddf.h and host_generic_maddf.c
- files under coregrin/m_debuginfo derived from LZO:
  lzoconf.h, lzodefs.h, minilzo-inl.c and minilzo.h
- files under coregrind/m_gdbserver detived from GDB:
  gdb/signals.h, inferiors.c, regcache.c, regcache.h,
  regdef.h, remote-utils.c, server.c, server.h, signals.c,
  target.c, target.h and utils.c

Plus the following test files:

- none/tests/ppc32/testVMX.c derived from testVMX.
- ppc tests derived from QEMU: jm-insns.c, ppc64_helpers.h
  and test_isa_3_0.c
- tests derived from bzip2 (with embedded GPL text in code):
  hackedbz2.c, origin5-bz2.c, varinfo6.c
- tests detived from glibc: str_tester.c, pth_atfork1.c
- test detived from GCC libgomp: tc17_sembar.c
- performance tests derived from bzip2 or tinycc (with embedded GPL
  text in code): bz2.c, test_input_for_tinycc.c and tinycc.c
2019-05-26 20:07:51 +02:00
Nicholas Nethercote
e6e8377521 Add a --show-percs option to cg_annotate and callgrind_annotate.
Because it's very useful. As part of this, the "percentage of events
annotated" numbers at the bottom of the output is changed to "events
annotated" so that --show-percs doesn't compute a percentage of a
percentage.

Example output lines:
```
4,967,137,442 (100.0%)  PROGRAM TOTALS

4,543 (25.23%)    17,566 ( 0.43%)    47,993 ( 0.92%) /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c

1 ( 0.01%) 2,000,001 (49.29%) 3,000,004 (57.36%)     for (int i = 0; i < 1000000; i++) {
```

The commit also adds some much-needed tests for cg_annotate and
callgrind_annotate.
2018-12-10 14:14:20 +11:00
Ivo Raisr
38edd50c0e Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16333
2017-05-04 15:09:39 +00:00
Julian Seward
adc2dafee9 Update copyright dates, to include 2015. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15577
2015-08-21 11:32:26 +00:00
Florian Krohm
7aefdaa6ef Update the copyright notice in files ending in '.in' because the
script change-copyright-year did not handle them.
Update the script as well.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14087
2014-06-23 19:33:45 +00:00
Nicholas Nethercote
3dbf8e07a7 Added cg_diff.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11193
2010-06-30 05:23:34 +00:00
Nicholas Nethercote
cb2518d934 Fix bug in the previous commit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11185
2010-06-22 03:50:08 +00:00
Nicholas Nethercote
dab7abbbee Allow negative numbers in the cachegrind.out.* file. Also protect against
division-by-zero.  Both are required for cg_diff (not yet committed) to work
properly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11184
2010-06-22 03:40:04 +00:00
Nicholas Nethercote
d218ab755b Make better use of references, allowing data structure updates to be more
localised.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11183
2010-06-22 03:34:54 +00:00
Nicholas Nethercote
c149a17389 Make usage messages given by -h and man pages consistent for the scripts.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10756
2009-08-09 23:27:00 +00:00
Nicholas Nethercote
88a2f8bed1 Thoroughly overhauled the Cachegrind manual chapter, mostly by putting
things in a more sensible order.  Also tweaked the Massif chapter a bit
more.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10730
2009-08-07 00:18:25 +00:00
Nicholas Nethercote
d6b40a390d Fixed up the log file mess throughout, including the docs. This killed
--log-file-qualifier and --log-file-exactly.

Updated NEWS some in preparation for 3.3.0.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7202
2007-11-23 01:41:32 +00:00
Nicholas Nethercote
8cdbb6e02f minor tweak
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6851
2007-09-17 22:01:14 +00:00
Nicholas Nethercote
f4e68cda86 Add directory-reading of debug info to cachegrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6839
2007-09-17 00:41:07 +00:00
Julian Seward
5748ebe527 Add a new flag --cachegrind-log-file to cg_annotate, which tells it
precisely the name of the profile data file it should use (instead of
assuming cachegrind.out.<pid> where <pid> is specified by the --<pid>
flag).  The old mechanism is still supported though.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6573
2007-02-08 06:47:19 +00:00
Nicholas Nethercote
525ca8b1ee Removed the file format description from cg_annotate.in, because it's in the
Cachegrind docs.

Removed the Cachegrind tech docs, because they're so out of date to be
useless.  My PhD dissertation gives a much better description of how
Cachegrind works.  (I mentioned this in the Cachegrind user manual.)  The
only still-useful part of Cachegrind's tech docs, the output file format
description, I moved into the Cachegrind user manual.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6332
2006-10-21 22:22:59 +00:00
Nicholas Nethercote
f280fb47d2 - Update comments about Cachegrind file format.
- Be slightly more strict in accepting Cachegrind input files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6330
2006-10-21 18:22:35 +00:00
Nicholas Nethercote
9f216ffd28 Add the name of the input file to cg_annotate's output.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5401
2005-12-22 06:14:42 +00:00
Nicholas Nethercote
ddb8c4241a Fixed cg_annotate bug -- when using the --sort option the primary threshold
was set to zero and so no annotation was done.  

Also put the file format into this file, and some other tiny changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5396
2005-12-21 19:45:29 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00
Nicholas Nethercote
05cf8f1611 Replace out-of-date email address.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4322
2005-08-04 19:26:54 +00:00
Nicholas Nethercote
fe432113e6 A crucial, crucial change: update my email address.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3632
2005-05-08 02:10:27 +00:00
Nicholas Nethercote
05fe123a9e Update copyright notice for 2005 on all relevant files. Don't bother trying
to be selective about it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3303
2005-03-12 16:22:54 +00:00
Nicholas Nethercote
4c7cf81a28 Completely overhauled Cachegrind's data structures. With the new
scheme, there are two main structures:

1. The CC table holds a cost centre (CC) for every distinct source code
   line, as found using debug/symbol info.  It's arranged by files, then
   functions, then lines.

2. The instr-info-table holds certain important pieces of info about
   each instruction -- instr_addr, instr_size, data_size, its line-CC.
   A pointer to the instr's info is passed to the simulation functions,
   which is shorter and quicker than passing the pieces individually.

This is nice and simple.  Previously, there was a single data structure
(the BBCC table) which mingled the two purposes (maintaining CCs and
caching instruction info).  The CC stuff was done at the level of
instructions, and there were different CC types for different kinds of
instructions, and it was pretty yucky.  The two simple data structures
together are much less complex than the original single data structure.

As a result, we have the following general improvements:

- Previously, when code was unloaded all its hit/miss counts were stuck
  in a single "discard" CC, and so that code would not be annotated.  Now
  this code is profiled and annotatable just like all other code.

- Source code size is 27% smaller.  cg_main.c is now 1472 lines, down
  from 2174.  Some (1/3?) of this is from removing the special handling
  of JIFZ and general compaction, but most is from the data structure
  changes.  Happily, a lot of the removed code was nasty.

- Object code size (vgskin_cachegrind.so) is 15% smaller.

- cachegrind.out.pid size is about 90+% smaller(!)  Annotation time is
  accordingly *much* faster.  Doing cost-centres at the level of source
  code lines rather than instructions makes a big difference, since
  there's typically 2--3 instructions per source line.  Even better,
  when debug info is not present, entire functions (and even files) get
  collapsed into a single "???" CC.  (This behaviour is no different
  to what happened before, it's just the collapsing used to occur in the
  annotation script, rather than within Cachegrind.)  This is a huge win
  for stripped libraries.

- Memory consumption is about 10--20% less, due to fewer CCs.

- Speed is not much changed -- the changes were not in the intensive
  parts, so the only likely change is a cache improvement due to using
  less memory.  SPEC experiments go -3 -- 10% faster, with the "average"
  being unchanged or perhaps a tiny bit faster.

I've tested it reasonably thoroughly, it seems extremely similar result
as the old version, which is highly encouraging.  (The results aren't
quite the same, because they are so sensitive to memory layout;  even
tiny changes to Cachegrind affect the results slightly.)

Some particularly nice changes that happened:

- No longer need an instrumentation prepass;  this is because CCs are not
  stored grouped by BB, and they're all the same size now.  (This makes
  various bits of code much simpler than before).

- The actions to take when a BB translation is discarded (due to the
  translation table getting full) are much easier -- just chuck all the
  instr-info nodes for the BB, without touching the CCs.

- Dumping the cachegrind.out.pid file at the end is much simpler, just
  because the CC data structure is much neater.

Some other, specific changes:

- Removed the JIFZ special handling, which never did what it was
  intended to do and just complicated things.  This changes the results
  for REP-prefixed instructions very slightly, but it's not important.

- Abbreviated the FP/MMX/SSE crap by being slightly laxer with size
  checking -- not an issue, since this checking was just a pale
  imitation of the stricter checking done in codegen anyway.

- Removed "fi" and "fe" handling from cg_annotate, no longer needed due
  to neatening of the CC-table.

- Factorised out some code a bit, so fewer monolithic slabs,
  particularly in SK_(instrument)().

- Just improved formatting and compacted code in general in various
  places.

- Removed the long-commented-out sanity checking code at the bottom.

Phew.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2458
2004-07-06 21:54:20 +00:00
Nicholas Nethercote
07b8e3438b Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177
2004-01-04 16:43:23 +00:00
Nicholas Nethercote
fb2d543ee8 Started to rescind the name "skin", replacing it with "tool". Did this in all
the places that normal users will see:

  - command line: --tool=foo (although --skin=foo still works)
  - docs: removed all traces (included renaming coregrind_skins.html to
    coregrind_tools.html)
  - in the usage messages
  - in error messages

Also did in in some places that I judged were unlikely to cause clashes with
existing workspaces:

  - in the header comments of many files (eg. "This file is part of Memcheck, a
    Valgrind tool for...")
  - in the regtests script
  - in the .supp files
  - in AUTHORS
  - in README_MISSING_SYSCALL_OR_IOCTL

Also update the AUTHORS file to mention Jeremy.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2027
2003-11-14 17:47:54 +00:00
Nicholas Nethercote
7dede6c740 Operator change. No difference in behaviour, but avoids a warning with Perl
5.8.0.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1713
2003-07-04 15:59:49 +00:00
Nicholas Nethercote
fe1f67595b Couple of minor fixes:
- don't keel over if run on an empty file
  - abort if the "summary:" line is missing;  previously it gave a warning
    and tried to keep going but then other things broke.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1572
2003-04-29 11:16:46 +00:00
Nicholas Nethercote
ac7027c441 Updated copyright notices for 2003. Only 4 months late.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526
2003-04-15 14:58:06 +00:00
Julian Seward
802a40daea Don't assume Perl lives in /usr/bin; do a proper test for it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1389
2002-12-22 19:32:23 +00:00
Nicholas Nethercote
718d2a417c Changed some out-of-date instances of "vg_annotate" into "cg_annotate".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1316
2002-11-14 16:18:55 +00:00
Nicholas Nethercote
089e7e3bcb Updated file descriptions in the copyright notices to reflect the core/skin
split.  Each skin now has its own two-line description.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1166
2002-10-02 13:26:35 +00:00
Nicholas Nethercote
afebe61b37 Files updated, added and removed in order to turn the ERASER branch into HEAD
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1086
2002-09-23 09:36:25 +00:00
Nicholas Nethercote
7c06858a4f vg_annotate.in:
- fixed a bug that was breaking the --threshold option.

vg_cachesim.c:
    - fixed a bug that meant instructions that didn't have a line number in the
      debug info were being written in cachegrind.out with whatever was the
      last known line number.  Now using 0.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@403
2002-06-10 15:31:16 +00:00
Nicholas Nethercote
b859182c44 Removed the need for the user to generate a cache simulation -- now do
automatic cache configuration detection using the CPUID instruction.
This can be overridden from the command-line if necessary.

vg_include.h:
    - added the cache_t type and UNDEFINED_CACHE macro

    - added command line args (of type cache_t) allowing manual override of
      I1/D1/L2 configuration

    - added log2(), which is generally useful

vg_main.c, valgrind.in, cachegrind.in:
    - added handling of the new --{I1,D1,L2}=<size>,<assoc>,<line_size>
      options

vg_cachesim.c:
    - lots of stuff for auto-detecting cache configuration with CPUID.
      Only handles Intel and AMD chips at the moment, and possibly not all of
      them.  Falls back onto defaults if anything goes wrong, and the configs
      can be manually overridden from the command line anyway.

    - now not printing cache summary stats if verbosity == 0.  Still writing
      cachegrind.out, though.

vg_cachesim_gen.c:
    - new file containing stuff shared by the I1/D1/L2 simulations

vg_cachesim_{I1,D1,L2}:
    - removed most of it;  each now just calls a macro defined in
      vg_cachesim_gen.c

vg_cachegen:
    - has been cvs removed as it is no longer needed.

Makefile.am:
    - added vg_cachesim_gen.c

    - removed vg_cachegen

configure.in:
    - removed vg_cachegen


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@400
2002-06-08 13:36:03 +00:00
Julian Seward
1ece8474f2 Update author attributions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@350
2002-06-01 23:43:49 +00:00
Nicholas Nethercote
ab8de9f4f7 Fix incredibly stupid bug.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@270
2002-05-15 14:30:55 +00:00
Nicholas Nethercote
8cbe9082c5 Expanded --sort option to take threshold args with the event names. Lets you
do things like "show functions covering 99% of all D2mr events *and* 99% of all
D2mw events" - before you could only choose the threshold for one.

Useful for me, but probably no-one else.  Still mentioned it in the docs,
though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@269
2002-05-13 20:27:54 +00:00
Nicholas Nethercote
ea2c63ce9e Removed description of cachegrind.out file format, since it's now in the tech
docs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@199
2002-05-03 17:54:51 +00:00
Dirk Mueller
303554e3ad fix for auto-annotating C++ method names (they have :'s in it)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@191
2002-05-01 21:52:05 +00:00
Nicholas Nethercote
ee24852e5a Right-justifying event names instead of left-justifying; easier to read when
large numbers are involved and the columns are wide.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@174
2002-04-30 11:34:54 +00:00
Julian Seward
7558b43cf5 Config/build/install vg_annotate and vg_cachegen correctly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@169
2002-04-29 17:27:07 +00:00
Nicholas Nethercote
fcc45a9e85 New files:
- vg_cachesim.c
  - vg_cachesim_{I1,D1,L2}.c
  - vg_annotate.in
  - vg_cachegen.in

Changes to existing files:

  - valgrind/valgrind.in, added option:

        --cachesim=no|yes       [no]

  - Makefile/Makefile.am:
        * added vg_cachesim.c to valgrind_so_SOURCES var
        * added vg_cachesim_I1.c, vg_cachesim_D1.c, vg_cachesim_L2.c to
          noinst_HEADERS var
        * added vg_annotate, vg_cachegen to 'bin_SCRIPTS' var, and added empty
          targets for them

  - vg_main.c:
        * added two offsets for cache sim functions (put in positions 17a,17b)
        * added option handling (detection of --cachesim=yes which turns off of
          --instrument);
        * added calls to cachesim initialisation/finalisation functions

  - vg_mylibc: added some system call wrappers (for chmod, open_write, etc) for
    file writing

  - vg_symtab2.c:
        * allow it to read symbols if either of --instrument or --cachesim is
          used
        * made vg_symtab2.c:vg_what_{line,fn}_is_this extern, renaming it as
          VG_(what_line_is_this) (and added to vg_include.h)
        * completely rewrote the read loop in vg_read_lib_symbols, fixing
          several bugs.  Much better now, although probably not perfect.  It's
          also relatively fragile -- I'm using the "die immediately if anything
          unexpected happens" approach.

  - vg_to_ucode.c:
        * in VG_(disBB), patching in x86 instruction size into extra4b field of
          JMP instructions at the end of basic blocks if --cachesim=yes.
          Shifted things around to do this;  also had to fiddle around with
          single-step stuff to get this to work, by not sticking extra JMPs on
          the end of the single-instruction block if there was already one
          there (to avoid breaking an assertion in vg_cachesim.c).  Did a
          similar thing to avoid an extra JMP on huge basic blocks that are
          split.

  - vg_translate.c:
        * if --cachesim=yes call the cachesim instrumentation phase
        * made some functions extern and renamed:
                allocCodeBlock() --> VG_(allocCodeBlock)()
                freeCodeBlock()  --> VG_(freeCodeBlock)()
                copyUInstr()     --> VG_(copyUInstr)()
          (added to vg_include.h too)

  - vg_include.c: declared
        * cachesim offsets
        * exports of vg_cachesim.c
        * added four new profiling events (increasing VGP_M_CCS to 24 -- I kept
          the spare ones)
        * added comment about UInstr.extra4b field being used for instr size in
          JMPs for cache simulation

  - docs/manual.html:
        * Added --cachesim option to section 2.5.
        * Added cache profiling stuff as section 7.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@168
2002-04-29 16:03:24 +00:00