1 /* 2 * Copyright (c) 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 #ifndef XPERF_EVT_H 16 #define XPERF_EVT_H 17 18 #include <string> 19 #include <map> 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 using JlogArgMap = std::map<std::string, std::string>; 24 25 // Animator info struct 26 struct BasicInfo { 27 int32_t uniqueId{0}; 28 int32_t versionCode{0}; 29 std::string versionName{""}; 30 std::string sceneId{""}; 31 std::string moduleName{""}; 32 std::string processName{""}; 33 std::string abilityName{""}; 34 std::string pageUrl{""}; 35 std::string sourceType{""}; 36 std::string bundleNameEx{""}; 37 }; 38 39 struct CommonInfo { 40 int32_t appPid{0}; 41 uint64_t startTime{0}; 42 uint64_t durition{0}; 43 int32_t totalFrames{0}; 44 int32_t totalMissedFrames{0}; 45 uint64_t maxFrameTime{0}; 46 int32_t maxSeqMissedFrames{0}; 47 float averageFrameTime{0}; 48 bool isFoldDisp{false}; 49 bool isDisplayAnimator{false}; 50 uint64_t happenTime{0}; 51 }; 52 53 struct AnimatorInfo { 54 BasicInfo basicInfo; 55 CommonInfo commonInfo; 56 }; 57 58 struct XperfEvt { 59 int32_t actionId{0}; 60 time_t tvSec{0}; 61 int tvNsec{0}; 62 int32_t pid{0}; 63 int32_t tid{0}; 64 int32_t uid{0}; 65 int32_t appPid{0}; 66 unsigned int logId{0}; 67 int64_t uptime{0}; 68 int64_t rltime{0}; 69 int datalen{0}; 70 char* message{nullptr}; 71 char* arg1{nullptr}; 72 int arg2{0}; 73 char* arg3{nullptr}; 74 JlogArgMap argMap; 75 std::string domain{""}; 76 std::string eventName{""}; 77 std::string eventType{""}; 78 std::string appName{""}; 79 std::string pName{""}; 80 std::string uiName{""}; 81 std::string appVersion{""}; 82 std::string bundleName{""}; 83 // activitySwitch resp 84 std::string sourceType{""}; 85 int32_t versionCode{0}; 86 uint64_t eventTime{0}; 87 std::string pageUrl{""}; 88 std::string sceneId{""}; 89 uint64_t inputTime{0}; 90 uint64_t animStartTime{0}; 91 uint64_t renderTime{0}; 92 uint64_t responseLatency{0}; 93 uint64_t e2eLatency{0}; 94 uint64_t animationLatency{0}; 95 // activitySwitch end 96 // for boot 97 std::string reason{""}; 98 std::string isFirst{""}; 99 std::string detailedTime{""}; 100 uint64_t totalTime{0}; 101 uint64_t bootLoaderLatency{0}; 102 // for power on 103 uint32_t state{0}; 104 std::string wakeUpType{""}; 105 uint64_t powerStateLatency{0}; 106 // for app startup 107 std::string abilityName{""}; 108 std::string processName{""}; 109 uint64_t animationStartTime{0}; 110 std::string moduleName{""}; 111 std::string versionName{""}; 112 int32_t startType{0}; 113 uint64_t startupTime{0}; 114 int32_t startupAbilityType{0}; 115 int32_t startupExtensionType{0}; 116 std::string callerBundleName{""}; 117 int32_t callerUid{0}; 118 std::string callerProcessName{""}; 119 std::string windowName{""}; 120 int32_t bundleType{0}; 121 uint64_t animationStartLatency{0}; 122 uint64_t animationEndLatency{0}; 123 uint64_t time{0}; 124 int32_t appUid{0}; 125 // Animator info 126 AnimatorInfo animatorInfo; 127 // for app exit 128 uint64_t exitTime{0}; 129 int32_t exitResult{0}; 130 int32_t exitPid{0}; 131 std::string note{""}; 132 // for screen switch 133 uint64_t screenId{0}; 134 std::string scenePanelName{""}; 135 std::string rotationStartTime{""}; 136 uint64_t rotationDuration{0}; 137 // for screen lock 138 std::string packageName{""}; 139 bool isVerifySuccess{false}; 140 uint64_t verifyCostTime{0}; 141 // for PC quick wake 142 uint64_t kernelStartTime{0}; 143 uint64_t kernelEndTime{0}; 144 int32_t wakeState{0}; 145 std::string beginTime{""}; 146 std::string endTime{""}; 147 // for skip frame time 148 uint64_t skippedFrameTime{0}; 149 // for dh jank frame 150 uint64_t dhHappenTimeJank{0}; 151 uint64_t dhTotalTimeSpentJank{0}; 152 std::string dhPackageNameJank{""}; 153 std::string dhVersionJank{""}; 154 // DH_COMPOSE_JANK_FRAME_INNER 155 uint64_t dhStartTimeSeqJank{0}; 156 uint64_t dhEndTimeSeqJank{0}; 157 uint64_t skipFrameSeqJank{0}; 158 uint64_t vsyncIntervalSeqJank{0}; 159 // for dh app start 160 int32_t missionId{0}; 161 int32_t taskId{0}; 162 uint64_t timestamp{0}; 163 uint64_t happenTime{0}; 164 // for app associated start 165 std::string calleeProcessName{""}; 166 std::string calleeBundleName{""}; 167 // for fold expand 168 int32_t powerOnScreen{0}; 169 int32_t powerOffScreen{0}; 170 // for perf factory 171 std::string testTitle{""}; 172 // for limit frequency 173 int32_t clientId{0}; 174 int32_t resId{0}; 175 int64_t config{0}; 176 bool onOffTag{false}; 177 // for shader malfunction 178 int32_t malFunctionPid{0}; 179 std::string malFunctionProcessName{""}; 180 std::string malFunctionHashCode{""}; 181 int32_t malFunctionCompileTime{0}; 182 int64_t malFunctionTimeStamp{0}; 183 int32_t malFunctionPartFlag{0}; 184 // for shader stats 185 int32_t statsPid{0}; 186 std::string statsProcessName{""}; 187 int32_t statsNonSkiaTotal{0}; 188 int64_t statsTimeStamp{0}; 189 int32_t statsPartFlag{0}; 190 // for webview page load 191 int64_t navigationId{0}; 192 int64_t navigationStart{0}; 193 uint32_t redirectCount{0}; 194 int64_t redirectStart{0}; 195 int64_t redirectEnd{0}; 196 int64_t fetchStart{0}; 197 int64_t workerStart{0}; 198 int64_t domainLookupStart{0}; 199 int64_t domainLookupEnd{0}; 200 int64_t connectStart{0}; 201 int64_t secureConnectStart{0}; 202 int64_t connectEnd{0}; 203 int64_t requestStart{0}; 204 int64_t responseStart{0}; 205 int64_t responseEnd{0}; 206 int64_t domInteractive{0}; 207 int64_t domContentLoadedEventStart{0}; 208 int64_t domContentLoadedEventEnd{0}; 209 int64_t loadEventStart{0}; 210 int64_t loadEventEnd{0}; 211 int64_t firstPaint{0}; 212 int64_t firstContentfulPaint{0}; 213 int64_t largestContentfulPaint{0}; 214 // for webview dynamic frame drop 215 uint16_t startTime{0}; 216 uint16_t duration{0}; 217 uint32_t totalAppFrames{0}; 218 uint64_t totalAppMissedFrames{0}; 219 uint64_t maxAppFrameTime{0}; 220 // for webview audio frame drop 221 uint32_t audioBlankFrameCount{0}; 222 // for webview video frame drop 223 uint32_t videoFrameDroppedCount{0}; 224 uint64_t videoFrameDroppedDuration{0}; 225 // for hitch time ratio 226 uint64_t uiStartTime{0}; 227 uint64_t rsStartTime{0}; 228 uint64_t hitchTime{0}; 229 float hitchTimeRatio{0}; 230 bool isFoldDisp{false}; 231 }; 232 } // HiviewDFX 233 } // OHOS 234 #endif