blob: 99e5a759390d1b17d274a7355dc7d21f91a251d1 [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
David Sehr9e734c72018-01-04 17:56:19 -080024#include "dex/dex_file.h"
Mathieu Chartier2f794552017-06-19 10:58:08 -070025
26namespace art {
27
Andreas Gampe3913e482018-01-22 18:58:01 -080028class ProfileCompilationInfo;
29
Mathieu Chartier2f794552017-06-19 10:58:08 -070030struct BootImageOptions {
31 public:
32 // Threshold for classes that may be dirty or clean. The threshold specifies how
33 // many different profiles need to have the class before it gets added to the boot profile.
34 uint32_t image_class_theshold = 10;
35
36 // Threshold for classes that are likely to remain clean. The threshold specifies how
37 // many different profiles need to have the class before it gets added to the boot profile.
38 uint32_t image_class_clean_theshold = 3;
39
40 // Threshold for non-hot methods to be compiled. The threshold specifies how
41 // many different profiles need to have the method before it gets added to the boot profile.
42 uint32_t compiled_method_threshold = std::numeric_limits<uint32_t>::max();
43};
44
45// Merge a bunch of profiles together to generate a boot profile. Classes and methods are added
46// to the out_profile if they meet the options.
47void GenerateBootImageProfile(
48 const std::vector<std::unique_ptr<const DexFile>>& dex_files,
49 const std::vector<std::unique_ptr<const ProfileCompilationInfo>>& profiles,
50 const BootImageOptions& options,
51 bool verbose,
52 ProfileCompilationInfo* out_profile);
53
54} // namespace art
55
56#endif // ART_PROFMAN_BOOT_IMAGE_PROFILE_H_