aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/eval/param_usage.h
blob: dcc8a0d4d08e1c634e3cc573789e93aa9b3a15d6 (plain) (blame)
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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vector>

namespace vespalib {
namespace eval {

class Function;

/**
 * Calculate the expected number of times each parameter will be
 * used. Note: Correlation between condition checks and effects of
 * short-circuit evaluation and constant value optimizations are not
 * taken into account.
 *
 * @return expected parameter usage per parameter
 * @param function the function to analyze
 **/
std::vector<double> count_param_usage(const Function &function);

/**
 * Calculate the probability that each parameter will be used. Note:
 * Correlation between condition checks and effects of short-circuit
 * evaluation and constant value optimizations are not taken into
 * account.
 *
 * @return parameter usage probability per parameter
 * @param function the function to analyze
 **/
std::vector<double> check_param_usage(const Function &function);

} // namespace vespalib::eval
} // namespace vespalib