WXApmForInstance.h
5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import <Foundation/Foundation.h>
#import "WXJSExceptionInfo.h"
#pragma mark - const static string
extern NSString* const WEEX_PAGE_TOPIC;
/************** properties *****************/
extern NSString* const KEY_PROPERTIES_ERROR_CODE;
extern NSString* const KEY_PAGE_PROPERTIES_BIZ_ID;
extern NSString* const KEY_PAGE_PROPERTIES_BUBDLE_URL;
extern NSString* const KEY_PAGE_PROPERTIES_JSLIB_VERSION;
extern NSString* const KEY_PAGE_PROPERTIES_WEEX_VERSION;
extern NSString* const KEY_PAGE_PROPERTIES_REQUEST_TYPE;
extern NSString* const KEY_PAGE_PROPERTIES_Z_CACHE_INFO;
extern NSString* const KEY_PAGE_PROPERTIES_JS_FM_INIT;
extern NSString* const KEY_PAGE_PROPERTIES_BUNDLE_TYPE;
extern NSString* const KEY_PAGE_PROPERTIES_CONTAINER_NAME;
extern NSString* const KEY_PAGE_PROPERTIES_INSTANCE_TYPE;
extern NSString* const KEY_PAGE_PROPERTIES_PARENT_PAGE;
extern NSString* const KEY_PAGE_PROPERTIES_RENDER_TYPE;
///************** stages *****************/
extern NSString* const KEY_PAGE_STAGES_START;
extern NSString* const KEY_PAGE_STAGES_DOWN_BUNDLE_START;
extern NSString* const KEY_PAGE_STAGES_DOWN_BUNDLE_END;
extern NSString* const KEY_PAGE_STAGES_RENDER_ORGIGIN;
extern NSString* const KEY_PAGE_STAGES_LOAD_BUNDLE_START;
extern NSString* const KEY_PAGE_STAGES_LOAD_BUNDLE_END;
extern NSString* const KEY_PAGE_STAGES_CREATE_FINISH;
extern NSString* const KEY_PAGE_STAGES_FSRENDER;
extern NSString* const KEY_PAGE_STAGES_NEW_FSRENDER;
extern NSString* const KEY_PAGE_STAGES_INTERACTION;
extern NSString* const KEY_PAGE_STAGES_DESTROY;
///************** stats *****************/
extern NSString* const KEY_PAGE_STATS_BUNDLE_SIZE;
extern NSString* const KEY_PAGE_STATS_FS_CALL_JS_TIME;
extern NSString* const KEY_PAGE_STATS_FS_CALL_JS_NUM;
extern NSString* const KEY_PAGE_STATS_FS_TIMER_NUM;
extern NSString* const KEY_PAGE_STATS_FS_CALL_NATIVE_TIME;
extern NSString* const KEY_PAGE_STATS_FS_CALL_NATIVE_NUM;
extern NSString* const KEY_PAGE_STATS_FS_CALL_EVENT_NUM;
extern NSString* const KEY_PAGE_STATS_FS_REQUEST_NUM;
extern NSString* const KEY_PAGE_STATS_SCROLLER_NUM;
extern NSString* const KEY_PAGE_STATS_CELL_EXCEED_NUM;
extern NSString* const KEY_PAGE_STATS_CELL_UN_RE_USE_NUM;
extern NSString* const KEY_PAGE_STATS_CELL_DATA_UN_RECYCLE_NUM;
extern NSString* const KEY_PAGE_STATS_EMBED_COUNT;
extern NSString* const KEY_PAGE_STATS_LARGE_IMG_COUNT;
extern NSString* const KEY_PAGE_STATS_MAX_DEEP_VIEW;
extern NSString* const KEY_PAGE_STATS_MAX_DEEP_DOM;
extern NSString* const KEY_PAGE_STATS_MAX_COMPONENT_NUM;
extern NSString* const KEY_PAGE_STATS_WRONG_IMG_SIZE_COUNT;
extern NSString* const KEY_PAGE_STATS_IMG_UN_RECYCLE_NUM;
extern NSString* const KEY_PAGE_STATS_I_SCREEN_VIEW_COUNT;
extern NSString* const KEY_PAGE_STATS_I_ALL_VIEW_COUNT;
extern NSString* const KEY_PAGE_STATS_I_COMPONENT_CREATE_COUNT;
extern NSString* const KEY_PAGE_ANIM_BACK_NUM;
extern NSString* const KEY_PAGE_TIMER_BACK_NUM;
extern NSString* const KEY_PAGE_STATS_ACTUAL_DOWNLOAD_TIME;
extern NSString* const KEY_PAGE_STATS_IMG_LOAD_NUM;
extern NSString* const KEY_PAGE_STATS_IMG_LOAD_SUCCESS_NUM;
extern NSString* const KEY_PAGE_STATS_IMG_LOAD_FAIL_NUM;
extern NSString* const KEY_PAGE_STATS_NET_NUM;
extern NSString* const KEY_PAGE_STATS_NET_SUCCESS_NUM;
extern NSString* const KEY_PAGE_STATS_NET_FAIL_NUM;
extern NSString* const KEY_PAGE_STAGES_FIRST_INTERACTION_VIEW;
extern NSString* const KEY_PAGE_STATS_BODY_RATIO;
///************** value *****************/
extern NSString* const VALUE_ERROR_CODE_DEFAULT;
@interface WXApmForInstance : NSObject
@property (nonatomic, assign) BOOL isFSEnd;
@property (nonatomic,assign) BOOL isOpenApm;
@property (nonatomic, assign) BOOL isStartRecord;
@property (nonatomic, assign) BOOL hasAddView;
@property (nonatomic, assign) BOOL isDegrade;
@property (nonatomic, assign) BOOL isStartRender;
@property (nonatomic,assign) BOOL hasRecordFirstInterationView;
@property (nonatomic, assign) BOOL isDownLoadFailed;
@property (nonatomic,assign) double pageRatio;
#pragma mark - basic method
- (void) onEvent:(NSString *)name withValue:(id)value;
- (void) onStage:(NSString *)name;
- (void) onStageWithTime:(NSString*)name time:(long)unixTime;
- (void) setProperty:(NSString *)name withValue:(id)value;
- (void) setStatistic:(NSString *)name withValue:(double)value;
#pragma mark - instance record
- (void) startRecord:(NSString*) instanceId;
- (void) endRecord;
- (void) updateFSDiffStats:(NSString *)name withDiffValue:(double)diff;
- (void) updateDiffStats:(NSString *)name withDiffValue:(double)diff;
- (void) updateMaxStats:(NSString *)name curMaxValue:(double)maxValue;
- (void) updateExtInfoFromResponseHeader:(NSDictionary*) extInfo;
- (void) forceSetInteractionTime:(long) unixTime;
#pragma mark - called by IWXHttpAdapter implementer
- (void) actionNetRequest;
- (void) actionNetRequestResult:(bool)succeed withErrorCode:(NSString*)errorCode;
#pragma mark - called by IWXImgLoaderAdapter implementer
- (void) actionImgLoad;
- (void) actionImgLoadResult:(bool)succeed withErrorCode:(NSString*)errorCode;
#pragma mark record top5 errorMsg
- (void) recordErrorMsg:(WXJSExceptionInfo *)exception;
- (NSDictionary<NSString*,NSNumber*>*) stageDic;
#pragma mark templateinfo
- (NSString*) templateInfo;
@end