Calin Juravle | 998c216 | 2015-12-21 15:39:33 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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_COMPILER_PROFILE_ASSISTANT_H_ |
| 18 | #define ART_COMPILER_PROFILE_ASSISTANT_H_ |
| 19 | |
| 20 | #include <string> |
| 21 | #include <vector> |
| 22 | |
| 23 | #include "jit/offline_profiling_info.cc" |
| 24 | |
| 25 | namespace art { |
| 26 | |
| 27 | class ProfileAssistant { |
| 28 | public: |
| 29 | // Process the profile information present in the given files. Returns true |
| 30 | // if the analysis ended up successfully (i.e. no errors during reading, |
| 31 | // merging or writing of profile files). |
| 32 | // |
| 33 | // If the returned value is true and there is a significant difference between |
| 34 | // profile_files and reference_profile_files: |
| 35 | // - profile_compilation_info is set to a not null object that |
| 36 | // can be used to drive compilation. It will be the merge of all the data |
| 37 | // found in profile_files and reference_profile_files. |
| 38 | // - the data from profile_files[i] is merged into |
| 39 | // reference_profile_files[i] and the corresponding backing file is |
| 40 | // updated. |
| 41 | // |
| 42 | // If the returned value is false or the difference is insignificant, |
| 43 | // profile_compilation_info will be set to null. |
| 44 | // |
| 45 | // Additional notes: |
| 46 | // - as mentioned above, this function may update the content of the files |
| 47 | // passed with the reference_profile_files. |
| 48 | // - if reference_profile_files is not empty it must be the same size as |
| 49 | // profile_files. |
| 50 | static bool ProcessProfiles( |
| 51 | const std::vector<std::string>& profile_files, |
| 52 | const std::vector<std::string>& reference_profile_files, |
| 53 | /*out*/ ProfileCompilationInfo** profile_compilation_info); |
| 54 | |
| 55 | private: |
| 56 | DISALLOW_COPY_AND_ASSIGN(ProfileAssistant); |
| 57 | }; |
| 58 | |
| 59 | } // namespace art |
| 60 | |
| 61 | #endif // ART_COMPILER_PROFILE_ASSISTANT_H_ |