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_EVENT_OBSERVER_H
16#define I_EVENT_OBSERVER_H
17
18namespace OHOS {
19namespace HiviewDFX {
20class IEventObserver {
21public:
22    struct AppStartInfo {
23        int32_t appPid{0};
24        int32_t versionCode{0};
25        std::string versionName{""};
26        std::string processName{""};
27        std::string bundleName{""};
28        std::string abilityName{""};
29        std::string pageUrl{""};
30        std::string sceneId{""};
31        int32_t startType{0};
32        std::string sourceType{""};
33        uint64_t inputTime{0};
34        uint64_t responseLatency{0};
35        uint64_t launcherToAmsStartAbilityDur{0};
36        uint64_t amsStartAbilityToProcessStartDuration{0};
37        uint64_t amsProcessStartToAppAttachDuration{0};
38        uint64_t amsAppAttachToAppForegroundDuration{0};
39        uint64_t amsStartAbilityToAppForegroundDuration{0};
40        uint64_t amsAppFgToAbilityFgDur{0};
41        uint64_t amsAbilityFgToWmsStartWinDur{0};
42        uint64_t drawnLatency{0};
43        uint64_t firstFrameDrawnLatency{0};
44        uint64_t animationLatency{0};
45        uint64_t e2eLatency{0};
46        unsigned int actionId{0};
47        unsigned int eventId{0};
48        std::string traceFileName{""};
49        std::string infoFileName{""};
50        uint64_t happenTime{0};
51    };
52
53    struct ScrollJankInfo {
54        int32_t appPid{0};
55        int32_t versionCode{0};
56        std::string versionName{""};
57        std::string bundleName{""};
58        std::string processName{""};
59        std::string abilityName{""};
60        std::string pageUrl{""};
61        std::string sceneId{""};
62        std::string bundleNameEx{""};
63        bool isFocus{false};
64        uint64_t startTime{0};
65        uint64_t duration{0};
66        int32_t totalAppFrames{0};
67        int32_t totalAppMissedFrames{0};
68        uint64_t maxAppFrameTime{0};
69        int32_t maxAppSeqMissedFrames{0};
70        bool isDisplayAnimator{false};
71        int32_t totalRenderFrames{0};
72        int32_t totalRenderMissedFrames{0};
73        uint64_t maxRenderFrameTime{0};
74        float averageRenderFrameTime{0};
75        int32_t maxRenderSeqMissedFrames{0};
76        bool isFoldDisp{false};
77        /* only for critical */
78        std::string traceFileName{""};
79        std::string infoFileName{""};
80        uint64_t happenTime{0};
81    };
82
83    virtual ~IEventObserver() = default;
84    virtual void PostAppStartEvent(const AppStartInfo& appStartInfo) = 0;
85    virtual void PostScrollJankEvent(const ScrollJankInfo& scrollJankInfo) = 0;
86};
87} // HiviewDFX
88} // OHOS
89#endif