llvm/llvm/test/tools/llvm-profdata/memprof-basic.test

REQUIRES: x86_64-linux

To update the inputs used below run Inputs/update_memprof_inputs.sh /path/to/updated/clang
RUN: llvm-profdata show --memory %p/Inputs/basic.memprofraw --profiled-binary %p/Inputs/basic.memprofexe -o - | FileCheck %s

We expect 2 MIB entries, 1 each for the malloc calls in the program. Any
additional allocations which do not originate from the main binary are pruned.

CHECK:  MemprofProfile:
CHECK-NEXT:   Summary:
CHECK-NEXT:     Version: 4
CHECK-NEXT:     NumSegments: {{[0-9]+}}
CHECK-NEXT:     NumMibInfo: 2
CHECK-NEXT:     NumAllocFunctions: 1
CHECK-NEXT:     NumStackOffsets: 2
CHECK-NEXT:   Segments:
CHECK-NEXT:   -
CHECK-NEXT:     BuildId: {{[[:xdigit:]]+}}
CHECK-NEXT:     Start: 0x{{[[:xdigit:]]+}}
CHECK-NEXT:     End: 0x{{[[:xdigit:]]+}}
CHECK-NEXT:     Offset: 0x{{[[:xdigit:]]+}}
CHECK-NEXT:   -

CHECK:   Records:
CHECK-NEXT:   -
CHECK-NEXT:     FunctionGUID: {{[0-9]+}}
CHECK-NEXT:     AllocSites:
CHECK-NEXT:     -
CHECK-NEXT:       Callstack:
CHECK-NEXT:       -
CHECK-NEXT:         Function: {{[0-9]+}}
CHECK-NEXT:         SymbolName: main
CHECK-NEXT:         LineOffset: 1
CHECK-NEXT:         Column: 21
CHECK-NEXT:         Inline: 0
CHECK-NEXT:       MemInfoBlock:
CHECK-NEXT:         AllocCount: 1
CHECK-NEXT:         TotalAccessCount: 2
CHECK-NEXT:         MinAccessCount: 2
CHECK-NEXT:         MaxAccessCount: 2
CHECK-NEXT:         TotalSize: 10
CHECK-NEXT:         MinSize: 10
CHECK-NEXT:         MaxSize: 10
CHECK-NEXT:         AllocTimestamp: {{[0-9]+}}
CHECK-NEXT:         DeallocTimestamp: {{[0-9]+}}
CHECK-NEXT:         TotalLifetime: 0
CHECK-NEXT:         MinLifetime: 0
CHECK-NEXT:         MaxLifetime: 0
CHECK-NEXT:         AllocCpuId: {{[0-9]+}}
CHECK-NEXT:         DeallocCpuId: {{[0-9]+}}
CHECK-NEXT:         NumMigratedCpu: 0
CHECK-NEXT:         NumLifetimeOverlaps: 0
CHECK-NEXT:         NumSameAllocCpu: 0
CHECK-NEXT:         NumSameDeallocCpu: 0
CHECK-NEXT:         DataTypeId: {{[0-9]+}}
CHECK-NEXT:         TotalAccessDensity: 20
CHECK-NEXT:         MinAccessDensity: 20
CHECK-NEXT:         MaxAccessDensity: 20
CHECK-NEXT:         TotalLifetimeAccessDensity: 20000
CHECK-NEXT:         MinLifetimeAccessDensity: 20000
CHECK-NEXT:         MaxLifetimeAccessDensity: 20000
CHECK-NEXT:         AccessHistogramSize: 0
CHECK-NEXT:         AccessHistogram: 0
CHECK-NEXT:     -
CHECK-NEXT:       Callstack:
CHECK-NEXT:       -
CHECK-NEXT:         Function: {{[0-9]+}}
CHECK-NEXT:         SymbolName: main
CHECK-NEXT:         LineOffset: 4
CHECK-NEXT:         Column: 15
CHECK-NEXT:         Inline: 0
CHECK-NEXT:       MemInfoBlock:
CHECK-NEXT:         AllocCount: 1
CHECK-NEXT:         TotalAccessCount: 2
CHECK-NEXT:         MinAccessCount: 2
CHECK-NEXT:         MaxAccessCount: 2
CHECK-NEXT:         TotalSize: 10
CHECK-NEXT:         MinSize: 10
CHECK-NEXT:         MaxSize: 10
CHECK-NEXT:         AllocTimestamp: {{[0-9]+}}
CHECK-NEXT:         DeallocTimestamp: {{[0-9]+}}
CHECK-NEXT:         TotalLifetime: 0
CHECK-NEXT:         MinLifetime: 0
CHECK-NEXT:         MaxLifetime: 0
CHECK-NEXT:         AllocCpuId: {{[0-9]+}}
CHECK-NEXT:         DeallocCpuId: {{[0-9]+}}
CHECK-NEXT:         NumMigratedCpu: 0
CHECK-NEXT:         NumLifetimeOverlaps: 0
CHECK-NEXT:         NumSameAllocCpu: 0
CHECK-NEXT:         NumSameDeallocCpu: 0
CHECK-NEXT:         DataTypeId: {{[0-9]+}}
CHECK-NEXT:         TotalAccessDensity: 20
CHECK-NEXT:         MinAccessDensity: 20
CHECK-NEXT:         MaxAccessDensity: 20
CHECK-NEXT:         TotalLifetimeAccessDensity: 20000
CHECK-NEXT:         MinLifetimeAccessDensity: 20000
CHECK-NEXT:         MaxLifetimeAccessDensity: 20000
CHECK-NEXT:         AccessHistogramSize: 0
CHECK-NEXT:         AccessHistogram: 0