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 ... ```
52 lines
476 B
Plaintext
52 lines
476 B
Plaintext
# RUN: llvm-profdata order %s --num-test-traces=1 | FileCheck %s
|
|
|
|
# CHECK: # Total area under the page fault curve: 4.000000e+00
|
|
|
|
# CHECK: a
|
|
# CHECK: b
|
|
# CHECK: c
|
|
# CHECK: x
|
|
|
|
# Header
|
|
:ir
|
|
:temporal_prof_traces
|
|
# Num Traces
|
|
4
|
|
# Trace Stream Size:
|
|
4
|
|
# Weight
|
|
1
|
|
a, main.c:b, c
|
|
# Weight
|
|
1
|
|
a, x, main.c:b, c
|
|
# Weight
|
|
1
|
|
a, main.c:b, c
|
|
# Weight
|
|
1
|
|
a, main.c:b, c, x
|
|
|
|
a
|
|
# Func Hash:
|
|
0x1234
|
|
# Num Counters:
|
|
1
|
|
# Counter Values:
|
|
101
|
|
|
|
main.c:b
|
|
0x5678
|
|
1
|
|
202
|
|
|
|
c
|
|
0xabcd
|
|
1
|
|
303
|
|
|
|
x
|
|
0xefff
|
|
1
|
|
404
|