WXApmForInstance.h 5.9 KB

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