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 I_APP_LAUNCH_SCENE_DATA_PROCESSOR_H 16 #define I_APP_LAUNCH_SCENE_DATA_PROCESSOR_H 17 18 #include <string> 19 20 namespace OHOS { 21 namespace HiviewDFX { 22 class IAppLaunchSceneDataProcessor { 23 public: 24 struct AppStartCheckPointData { 25 uint64_t time{0}; 26 std::string domain{""}; 27 std::string eventName{""}; 28 std::string bundleName{""}; 29 std::string abilityName{""}; 30 std::string processName{""}; 31 std::string pageUrl{""}; 32 std::string sceneId{""}; 33 std::string sourceType{""}; 34 uint64_t inputTime{0}; 35 uint64_t animationStartTime{0}; 36 uint64_t renderTime{0}; 37 uint64_t responseLatency{0}; 38 std::string moduleName{""}; 39 int32_t versionCode{0}; 40 std::string versionName{""}; 41 int32_t startType{0}; 42 uint64_t startupTime{0}; 43 int32_t startupAbilityType{0}; 44 int32_t startupExtensionType{0}; 45 int32_t callerUid{0}; 46 std::string callerProcessName{""}; 47 std::string callerBundleName{""}; 48 int32_t appPid{0}; 49 int32_t appUid{0}; 50 std::string windowName{""}; 51 uint64_t animationStartLatency{0}; 52 uint64_t animationEndLatency{0}; 53 uint64_t e2eLatency{0}; 54 int32_t bundleType{0}; 55 std::string note{""}; 56 }; 57 58 struct AppStartMetrics { 59 int32_t appPid{0}; 60 int32_t versionCode{0}; 61 std::string versionName{""}; 62 std::string processName{""}; 63 std::string bundleName{""}; 64 std::string abilityName{""}; 65 std::string pageUrl{""}; 66 std::string sceneId{""}; 67 int32_t startType{0}; 68 std::string sourceType{""}; 69 uint64_t inputTime{0}; 70 uint64_t happenTime{0}; 71 uint64_t responseLatency{0}; 72 uint64_t launcherToAmsStartAbilityDur{0}; 73 uint64_t amsStartAbilityToProcessStartDuration{0}; 74 uint64_t amsProcessStartToAppAttachDuration{0}; 75 uint64_t amsAppAttachToAppForegroundDuration{0}; 76 uint64_t amsStartAbilityToAppForegroundDuration{0}; 77 uint64_t amsAppFgToAbilityFgDur{0}; 78 uint64_t amsAbilityFgToWmsStartWinDur{0}; 79 uint64_t drawnLatency{0}; 80 uint64_t firstFrameDrawnLatency{0}; 81 uint64_t animationEndLatency{0}; //form animation_start to animation_end 82 uint64_t animationLatency{0}; //from input_time to animation_end 83 uint64_t e2eLatency{0}; 84 }; 85 86 class MetricReporter { 87 public: 88 virtual void ReportMetrics(const AppStartMetrics& metrics) = 0; 89 virtual ~MetricReporter() = default; 90 }; 91 public: 92 virtual void SetMetricReporter(MetricReporter* metricReporter) = 0; 93 virtual void ProcessSceneData(const AppStartCheckPointData& data) = 0; 94 virtual ~IAppLaunchSceneDataProcessor() = default; 95 }; 96 } // HiviewDFX 97 } // OHOS 98 #endif