feat:DoricPerf export anchor map
This commit is contained in:
		| @@ -398,6 +398,16 @@ public class DoricDevActivity extends AppCompatActivity implements DoricDev.Stat | |||||||
|                             } |                             } | ||||||
|                         }); |                         }); | ||||||
|                     } |                     } | ||||||
|  |                     if (DoricRegistry.isEnablePerformance()) { | ||||||
|  |                         actionMap.put("Performance", new DialogInterface.OnClickListener() { | ||||||
|  |                             @Override | ||||||
|  |                             public void onClick(DialogInterface dialog, int which) { | ||||||
|  |                                 Map<String, Long> anchorMap = context.getPerformanceProfile().getAnchorMap(); | ||||||
|  |  | ||||||
|  |                                 ((Activity) v.getContext()).finish(); | ||||||
|  |                             } | ||||||
|  |                         }); | ||||||
|  |                     } | ||||||
|                     final String[] items = actionMap.keySet().toArray(new String[0]); |                     final String[] items = actionMap.keySet().toArray(new String[0]); | ||||||
|                     AlertDialog.Builder builder = new AlertDialog.Builder(holder.itemView.getContext(), R.style.Theme_Doric_Modal); |                     AlertDialog.Builder builder = new AlertDialog.Builder(holder.itemView.getContext(), R.style.Theme_Doric_Modal); | ||||||
|                     builder.setTitle(String.format("%s %s", context.getContextId(), context.getSource())); |                     builder.setTitle(String.format("%s %s", context.getContextId(), context.getSource())); | ||||||
|   | |||||||
| @@ -0,0 +1,19 @@ | |||||||
|  | package pub.doric.devkit.ui; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import android.os.Bundle; | ||||||
|  |  | ||||||
|  | import androidx.annotation.Nullable; | ||||||
|  | import androidx.appcompat.app.AppCompatActivity; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @Description: pub.doric.devkit.ui | ||||||
|  |  * @Author: pengfei.zhou | ||||||
|  |  * @CreateDate: 2021/7/19 | ||||||
|  |  */ | ||||||
|  | public class DoricDevPerfActivity extends AppCompatActivity { | ||||||
|  |     @Override | ||||||
|  |     protected void onCreate(@Nullable Bundle savedInstanceState) { | ||||||
|  |         super.onCreate(savedInstanceState); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -113,6 +113,10 @@ public class DoricPerformanceProfile { | |||||||
|         print(anchorName); |         print(anchorName); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public Map<String, Long> getAnchorMap() { | ||||||
|  |         return this.anchorMap; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     private void print(final String anchorName) { |     private void print(final String anchorName) { | ||||||
|         if (!enable) { |         if (!enable) { | ||||||
|             return; |             return; | ||||||
|   | |||||||
| @@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN | |||||||
|  |  | ||||||
|  |  | ||||||
| @interface DoricPerformanceProfile : NSObject | @interface DoricPerformanceProfile : NSObject | ||||||
|  | @property(nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *> *anchorMap; | ||||||
|  |  | ||||||
| - (instancetype)initWithName:(NSString *)name; | - (instancetype)initWithName:(NSString *)name; | ||||||
|  |  | ||||||
| - (void)prepare:(NSString *)anchorName; | - (void)prepare:(NSString *)anchorName; | ||||||
|   | |||||||
| @@ -25,7 +25,6 @@ | |||||||
| 
 | 
 | ||||||
| @interface DoricPerformanceProfile () | @interface DoricPerformanceProfile () | ||||||
| @property(nonatomic, copy) NSString *name; | @property(nonatomic, copy) NSString *name; | ||||||
| @property(nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *> *anchorMap; |  | ||||||
| @property(nonatomic, strong) dispatch_queue_t anchorQueue; | @property(nonatomic, strong) dispatch_queue_t anchorQueue; | ||||||
| @property(nonatomic, assign) BOOL enable; | @property(nonatomic, assign) BOOL enable; | ||||||
| @property(nonatomic, strong) NSHashTable<id <DoricPerformanceAnchorHookProtocol>> *hooks; | @property(nonatomic, strong) NSHashTable<id <DoricPerformanceAnchorHookProtocol>> *hooks; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user