• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef LIBPANDAFILE_PGO_H
17 #define LIBPANDAFILE_PGO_H
18 
19 #include "file_items.h"
20 
21 namespace ark::panda_file::pgo {
22 
23 class ProfileOptimizer {
24 public:
25     ProfileOptimizer() = default;
26     ~ProfileOptimizer() = default;
27     static std::string GetNameInfo(const std::unique_ptr<BaseItem> &item);
28     void MarkProfileItem(std::unique_ptr<BaseItem> &item, bool setPgo) const;
29     bool ParseProfileData();
30     void ProfileGuidedRelayout(std::list<std::unique_ptr<BaseItem>> &items);
SetProfilePath(std::string & filePath)31     void SetProfilePath(std::string &filePath)
32     {
33         profileFilePath_ = std::move(filePath);
34     }
35 
36 private:
37     NO_COPY_SEMANTIC(ProfileOptimizer);
38     NO_MOVE_SEMANTIC(ProfileOptimizer);
39     std::string profileFilePath_;
40     std::vector<std::pair<std::string, std::string>> profileData_;
41 };
42 }  // namespace ark::panda_file::pgo
43 
44 #endif  // LIBPANDAFILE_PGO_H
45