1 /* 2 * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_PERF_INCLUDE_PERF_PROFILE_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_PERF_INCLUDE_PERF_PROFILE_H 18 19 #include <cstdint> 20 21 #include "singleton.h" 22 23 namespace OHOS { 24 namespace AppExecFwk { 25 class PerfProfile : public Singleton<PerfProfile> { 26 DECLARE_SINGLETON(PerfProfile); 27 28 public: 29 int64_t GetBmsLoadStartTime() const; 30 void SetBmsLoadStartTime(int64_t time); 31 32 int64_t GetBmsLoadEndTime() const; 33 void SetBmsLoadEndTime(int64_t time); 34 35 int64_t GetBundleScanStartTime() const; 36 void SetBundleScanStartTime(int64_t time); 37 38 int64_t GetBundleScanEndTime() const; 39 void SetBundleScanEndTime(int64_t time); 40 41 int64_t GetBundleDownloadStartTime() const; 42 void SetBundleDownloadStartTime(int64_t time); 43 44 int64_t GetBundleDownloadEndTime() const; 45 void SetBundleDownloadEndTime(int64_t time); 46 47 int64_t GetBundleInstallStartTime() const; 48 void SetBundleInstallStartTime(int64_t time); 49 int64_t GetBundleTotalInstallTime() const; 50 51 int64_t GetBundleInstallEndTime() const; 52 void SetBundleInstallEndTime(int64_t time); 53 54 int64_t GetBundleUninstallStartTime() const; 55 void SetBundleUninstallStartTime(int64_t time); 56 57 int64_t GetBundleUninstallEndTime() const; 58 void SetBundleUninstallEndTime(int64_t time); 59 60 int64_t GetBundleParseStartTime() const; 61 void SetBundleParseStartTime(int64_t time); 62 63 int64_t GetBundleParseEndTime() const; 64 void SetBundleParseEndTime(int64_t time); 65 66 int64_t GetAmsLoadStartTime() const; 67 void SetAmsLoadStartTime(int64_t time); 68 69 int64_t GetAmsLoadEndTime() const; 70 void SetAmsLoadEndTime(int64_t time); 71 72 int64_t GetAbilityLoadStartTime() const; 73 void SetAbilityLoadStartTime(int64_t time); 74 75 int64_t GetAbilityLoadEndTime() const; 76 void SetAbilityLoadEndTime(int64_t time); 77 78 int64_t GetAppForkStartTime() const; 79 void SetAppForkStartTime(int64_t time); 80 81 int64_t GetAppForkEndTime() const; 82 void SetAppForkEndTime(int64_t time); 83 84 bool GetPerfProfileEnabled() const; 85 void SetPerfProfileEnabled(bool enable); 86 87 void Reset(); 88 89 void Dump() const; 90 91 private: 92 int64_t bmsLoadStart_ = 0; 93 int64_t bmsLoadEnd_ = 0; 94 95 int64_t bundleScanStart_ = 0; 96 int64_t bundleScanEnd_ = 0; 97 98 int64_t bundleDownloadStart_ = 0; 99 int64_t bundleDownloadEnd_ = 0; 100 101 int64_t bundleInstallStart_ = 0; 102 int64_t bundleInstallEnd_ = 0; 103 int64_t bundleInstallTime_ = 0; 104 105 int64_t bundleUninstallStart_ = 0; 106 int64_t bundleUninstallEnd_ = 0; 107 108 int64_t bundleParseStart_ = 0; 109 int64_t bundleParseEnd_ = 0; 110 111 int64_t amsLoadStart_ = 0; 112 int64_t amsLoadEnd_ = 0; 113 114 int64_t abilityLoadStart_ = 0; 115 int64_t abilityLoadEnd_ = 0; 116 int64_t appForkStart_ = 0; 117 int64_t appForkEnd_ = 0; 118 119 bool enableProfile_ = true; 120 }; 121 } // namespace AppExecFwk 122 } // namespace OHOS 123 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_PERF_INCLUDE_PERF_PROFILE_H 124