Skip to content

Instantly share code, notes, and snippets.

@fcuny
Created July 12, 2015 04:20
Show Gist options
  • Save fcuny/313fb41e150dfb28a2f7 to your computer and use it in GitHub Desktop.
Save fcuny/313fb41e150dfb28a2f7 to your computer and use it in GitHub Desktop.
$ valgrind --tool=callgrind --simulate-cache=yes ./test
$ callgrind_annotate --auto=yes callgrind.out.11015 test.c
--------------------------------------------------------------------------------
-- User-annotated source: test.c
--------------------------------------------------------------------------------
Ir Dr Dw I1mr D1mr D1mw ILmr DLmr DLmw
. . . . . . . . . #include <stdio.h>
. . . . . . . . .
3 0 1 1 0 0 1 . . int main() {
. . . . . . . . . FILE *fh;
. . . . . . . . .
11 4 4 . . . . . . if ((fh = fopen("/etc/issue", "r")) == NULL) {
59,650 14,454 661 107 1,079 49 106 868 42 => /build/buildd/eglibc-2.19/libio/iofopen.c:fopen@@GLIBC_2.2.5 (1x)
752 240 101 0 5 0 0 4 . => /build/buildd/eglibc-2.19/elf/../sysdeps/x86_64/dl-trampoline.S:_dl_runtime_resolve (1x)
. . . . . . . . . perror("fopen");
. . . . . . . . . return 1;
. . . . . . . . . }
. . . . . . . . .
8 4 3 0 1 . . . . fclose(fh);
791 246 101 0 43 7 0 2 . => /build/buildd/eglibc-2.19/elf/../sysdeps/x86_64/dl-trampoline.S:_dl_runtime_resolve (1x)
1,142 349 185 50 16 0 50 . . => /build/buildd/eglibc-2.19/libio/iofclose.c:fclose@@GLIBC_2.2.5 (1x)
1 . . . . . . . . return 0;
2 2 0 0 1 . . . . }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment