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