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 APP_MONITOR_DATA_CONVERTER_H
16 #define APP_MONITOR_DATA_CONVERTER_H
17 
18 #include "XperfEvt.h"
19 #include "IAppThrExecutor.h"
20 
21 using AppEvtData = IAppThrExecutor::AppEvtData;
22 
23 class AppMonitorDataConverter {
24 public:
ConvertXperfEvtToAppEvtData(const XperfEvt & evt)25     static AppEvtData ConvertXperfEvtToAppEvtData(const XperfEvt& evt)
26     {
27         AppEvtData appEvtData;
28         appEvtData.time = evt.time;
29         appEvtData.domain = evt.domain;
30         appEvtData.eventName = evt.eventName;
31         appEvtData.bundleName= evt.bundleName;
32         appEvtData.abilityName = evt.abilityName;
33         appEvtData.processName = evt.processName;
34         appEvtData.pageUrl = evt.pageUrl;
35         appEvtData.sceneId = evt.sceneId;
36         appEvtData.sourceType = evt.sourceType;
37         appEvtData.inputTime = evt.inputTime;
38         appEvtData.animationStartTime = evt.animationStartTime;
39         appEvtData.renderTime = evt.renderTime;
40         appEvtData.responseLatency = evt.responseLatency;
41         appEvtData.moduleName = evt.moduleName;
42         appEvtData.versionCode = evt.versionCode;
43         appEvtData.versionName = evt.versionName;
44         appEvtData.startType = evt.startType;
45         appEvtData.startupTime = evt.startupTime;
46         appEvtData.startupAbilityType = evt.startupAbilityType;
47         appEvtData.startupExtensionType = evt.startupExtensionType;
48         appEvtData.callerBundleName = evt.callerBundleName;
49         appEvtData.callerUid = evt.callerUid;
50         appEvtData.callerProcessName = evt.callerProcessName;
51         appEvtData.appPid = evt.appPid;
52         appEvtData.appUid = evt.appUid;
53         appEvtData.windowName = evt.windowName;
54         appEvtData.bundleType = evt.bundleType;
55         appEvtData.animationEndLatency = evt.animationEndLatency;
56         appEvtData.e2eLatency = evt.e2eLatency;
57         appEvtData.exitTime = evt.exitTime;
58         appEvtData.exitResult = evt.exitResult;
59         appEvtData.exitPid = evt.exitPid;
60         appEvtData.note = evt.note;
61         appEvtData.animationStartLatency = evt.animationStartLatency;
62 
63         return appEvtData;
64     }
65 };
66 #endif