feat:DoricPerf export anchor map

This commit is contained in:
pengfei.zhou 2021-07-19 16:40:42 +08:00 committed by osborn
parent 46eff0d904
commit 6bff1bd9a1
5 changed files with 35 additions and 1 deletions

View File

@ -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]);
AlertDialog.Builder builder = new AlertDialog.Builder(holder.itemView.getContext(), R.style.Theme_Doric_Modal);
builder.setTitle(String.format("%s %s", context.getContextId(), context.getSource()));

View File

@ -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);
}
}

View File

@ -113,6 +113,10 @@ public class DoricPerformanceProfile {
print(anchorName);
}
public Map<String, Long> getAnchorMap() {
return this.anchorMap;
}
private void print(final String anchorName) {
if (!enable) {
return;

View File

@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface DoricPerformanceProfile : NSObject
@property(nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *> *anchorMap;
- (instancetype)initWithName:(NSString *)name;
- (void)prepare:(NSString *)anchorName;

View File

@ -25,7 +25,6 @@
@interface DoricPerformanceProfile ()
@property(nonatomic, copy) NSString *name;
@property(nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *> *anchorMap;
@property(nonatomic, strong) dispatch_queue_t anchorQueue;
@property(nonatomic, assign) BOOL enable;
@property(nonatomic, strong) NSHashTable<id <DoricPerformanceAnchorHookProtocol>> *hooks;