blob: d02e408cd527d8b6e9fa1cbb89015f3306e41928 [file] [log] [blame]
Mathieu Chartier2f794552017-06-19 10:58:08 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_PROFMAN_BOOT_IMAGE_PROFILE_H_
18#define ART_PROFMAN_BOOT_IMAGE_PROFILE_H_
19
20#include <limits>
21#include <memory>
22#include <vector>
23
24#include "dex_file.h"
25#include "jit/profile_compilation_info.h"
26
27namespace art {
28
29struct BootImageOptions {
30 public:
31 // Threshold for classes that may be dirty or clean. The threshold specifies how
32 // many different profiles need to have the class before it gets added to the boot profile.
33 uint32_t image_class_theshold = 10;
34
35 // Threshold for classes that are likely to remain clean. The threshold specifies how
36 // many different profiles need to have the class before it gets added to the boot profile.
37 uint32_t image_class_clean_theshold = 3;
38
39 // Threshold for non-hot methods to be compiled. The threshold specifies how
40 // many different profiles need to have the method before it gets added to the boot profile.
41 uint32_t compiled_method_threshold = std::numeric_limits<uint32_t>::max();
42};
43
44// Merge a bunch of profiles together to generate a boot profile. Classes and methods are added
45// to the out_profile if they meet the options.
46void GenerateBootImageProfile(
47 const std::vector<std::unique_ptr<const DexFile>>& dex_files,
48 const std::vector<std::unique_ptr<const ProfileCompilationInfo>>& profiles,
49 const BootImageOptions& options,
50 bool verbose,
51 ProfileCompilationInfo* out_profile);
52
53} // namespace art
54
55#endif // ART_PROFMAN_BOOT_IMAGE_PROFILE_H_