llvm-project/llvm/test/tools/llvm-profdata/show-order-error.proftext
Ellis Hoag 73eb9b3314
[InstrProf] Evaluate function order using test traces (#92451)
The `llvm-profdata order` command is used to compute a function order
using traces from the input profile. Add the `--num-test-traces` flag to
keep aside N traces to evalute this order. These test traces are assumed
to be the actual function execution order in some experiment. The output
is a number that represents how many page faults we got. Lower is
better.

I tested on a large profile I already had.
```
llvm-profdata order default.profdata --num-test-traces=30
# Ordered 149103 functions
# Total area under the page fault curve: 2.271827e+09
...
```

I also improved `TemporalProfTraceTy::createBPFunctionNodes()` in a few
ways:
* Simplified how `UN`s are computed
* Change how the initial `Node` order is computed
* Filter out rare and common `UN`s
* Output vector is an aliased argument instead of a return

These changes slightly improved the evaluation in my test.
```
llvm-profdata order default.profdata --num-test-traces=30
# Ordered 149103 functions
# Total area under the page fault curve: 2.268586e+09
...
```
2024-05-23 11:19:29 -07:00

28 lines
320 B
Plaintext

# RUN: not llvm-profdata order %s --num-test-traces=10 2>&1 | FileCheck %s
# CHECK: --num-test-traces must be smaller than the total number of traces
# Header
:ir
:temporal_prof_traces
# Num Traces
1
# Trace Stream Size:
1
# Weight
1
a, b
a
# Func Hash:
0x1234
# Num Counters:
1
# Counter Values:
101
b
0x5678
1
202