File: memprof-merge.test

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (48 lines) | stat: -rw-r--r-- 1,474 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
REQUIRES: x86_64-linux

The input memprof and instrumented raw profiles were generated from the following source code:

```
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
  char *x = (char *)malloc(10);
  memset(x, 0, 10);
  free(x);
  x = (char *)malloc(10);
  memset(x, 0, 10);
  free(x);
  return 0;
}
```

Steps to collect the memprof raw profile and the instrprof raw profile:

```
# Collect instrprof profile with name compression disabled since some buildbots
# do not have zlib.
clang -mllvm -enable-name-compression=false -fprofile-generate source.c -o instr.out
./instr.out
mv *.profraw basic.profraw

# Collect memprof profile.
clang -fuse-ld=lld -Wl,--no-rosegment -gmlt -fdebug-info-for-profiling \
      -fmemory-profile -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer \
      -fno-optimize-sibling-calls -m64 -Wl,-build-id -no-pie \
      source.c -o basic.memprofexe

env MEMPROF_OPTIONS=log_path=stdout ./basic.memprofexe > basic.memprofraw
```

RUN: llvm-profdata merge %p/Inputs/basic.profraw %p/Inputs/basic.memprofraw --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof
RUN: llvm-profdata show %t.prof | FileCheck %s

For now we only check the validity of the instrumented profile since we don't
have a way to display the contents of the memprof indexed format yet.

CHECK: Instrumentation level: IR  entry_first = 0
CHECK: Total functions: 1
CHECK: Maximum function count: 1
CHECK: Maximum internal block count: 0