]> git.ipfire.org Git - thirdparty/valgrind.git/commit
Improve callgrind_annotate output.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 3 Oct 2018 00:00:10 +0000 (10:00 +1000)
committerNicholas Nethercote <nnethercote@mozilla.com>
Fri, 12 Oct 2018 10:35:53 +0000 (21:35 +1100)
commit331949c1c5cf78909a50c6b3559f36d9dcdeea79
tree0da999f272a756f64c7b62e4401bb373ef4ad350
parentca2f73592e8e74a5328df0a65e0831bc1fc6dd28
Improve callgrind_annotate output.

This commit makes two changes:

- it adds commas to call counts (e.g. `65658x` becomes `65,658x`);

- it sorts callers/callees in the tree by the --sort order.

An example, old output:
```
72,142,945  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x (65658x)
68,977,760  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x
       340  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:free (3x)
     4,564  >   /build/glibc-OTsEL5/glibc-2.27/nptl/pthread_mutex_unlock.c:pthread_mutex_unlock (163x)
 1,282,381  >   /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/strcmp.S:strcmp (12893x)
    13,310  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:calloc (4x)
       223  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_higher_prime_number (3x)
 1,741,689  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_name_match_p (16842x)
     5,705  >   /build/glibc-OTsEL5/glibc-2.27/nptl/../nptl/pthread_mutex_lock.c:pthread_mutex_lock (163x)

    51,454  < /build/glibc-OTsEL5/glibc-2.27/elf/../elf/dl-runtime.c:_dl_fixup (33x)
     2,456  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-sym.c:_dl_sym (2x)
100,313,502  < /build/glibc-OTsEL5/glibc-2.27/elf/../sysdeps/x86_64/dl-machine.h:_dl_relocate_object (39094x)
28,224,467  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x
72,142,945  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x (65658x)

[...]

  567        setLastUser(LastPMUses, P->getResolver()->getPMDataManager().getAsPass());
   18  => /home/njn/moz/rust0/src/llvm/include/llvm/IR/LegacyPassManagers.h:non-virtual thunk to llvm::FPPassManager::getAsPass() (9x)
1,971  => /home/njn/moz/rust0/src/llvm/lib/IR/LegacyPassManager.cpp:llvm::PMTopLevelManager::setLastUser(llvm::ArrayRef<llvm::Pass*>, llvm::Pass*)'2 (63x)
  108  => ???:non-virtual thunk to (anonymous namespace)::MPPassManager::getAsPass() (54x)
```

New output:
```
72,142,945  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x (65,658x)
68,977,760  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x
 1,741,689  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_name_match_p (16,842x)
 1,282,381  >   /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/strcmp.S:strcmp (12,893x)
    13,310  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:calloc (4x)
     5,705  >   /build/glibc-OTsEL5/glibc-2.27/nptl/../nptl/pthread_mutex_lock.c:pthread_mutex_lock (163x)
     4,564  >   /build/glibc-OTsEL5/glibc-2.27/nptl/pthread_mutex_unlock.c:pthread_mutex_unlock (163x)
       340  >   /build/glibc-OTsEL5/glibc-2.27/malloc/malloc.c:free (3x)
       223  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-misc.c:_dl_higher_prime_number (3x)

100,313,502  < /build/glibc-OTsEL5/glibc-2.27/elf/../sysdeps/x86_64/dl-machine.h:_dl_relocate_object (39,094x)
    51,454  < /build/glibc-OTsEL5/glibc-2.27/elf/../elf/dl-runtime.c:_dl_fixup (33x)
     2,456  < /build/glibc-OTsEL5/glibc-2.27/elf/dl-sym.c:_dl_sym (2x)
28,224,467  *  /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:_dl_lookup_symbol_x
72,142,945  >   /build/glibc-OTsEL5/glibc-2.27/elf/dl-lookup.c:do_lookup_x (65,658x)

[...]

  567        setLastUser(LastPMUses, P->getResolver()->getPMDataManager().getAsPass());
1,971  => /home/njn/moz/rust0/src/llvm/lib/IR/LegacyPassManager.cpp:llvm::PMTopLevelManager::setLastUser(llvm::ArrayRef<llvm::Pass*>, llvm::Pass*)'2 (63x)
  108  => ???:non-virtual thunk to (anonymous namespace)::MPPassManager::getAsPass() (54x)
   18  => /home/njn/moz/rust0/src/llvm/include/llvm/IR/LegacyPassManagers.h:non-virtual thunk to llvm::FPPassManager::getAsPass() (9x)
```
callgrind/callgrind_annotate.in