yiguolei commented on code in PR #33690: URL: https://github.com/apache/doris/pull/33690#discussion_r1685881063
########## fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java: ########## @@ -53,54 +59,84 @@ public class RuntimeProfile { public static String MIN_TIME_PRE = "min "; public static String AVG_TIME_PRE = "avg "; public static String SUM_TIME_PRE = "sum "; + @SerializedName(value = "counterTotalTime") private Counter counterTotalTime; - private double localTimePercent; - + @SerializedName(value = "localTimePercent") + private double localTimePercent = 0; + @SerializedName(value = "infoStrings") private Map<String, String> infoStrings = Maps.newHashMap(); + @SerializedName(value = "infoStringsDisplayOrder") private List<String> infoStringsDisplayOrder = Lists.newArrayList(); - private ReentrantReadWriteLock infoStringsLock = new ReentrantReadWriteLock(); + private transient ReentrantReadWriteLock infoStringsLock = new ReentrantReadWriteLock(); + @SerializedName(value = "counterMap") private Map<String, Counter> counterMap = Maps.newConcurrentMap(); + @SerializedName(value = "childCounterMap") private Map<String, TreeSet<String>> childCounterMap = Maps.newConcurrentMap(); // protect TreeSet in ChildCounterMap - private ReentrantReadWriteLock counterLock = new ReentrantReadWriteLock(); - + private transient ReentrantReadWriteLock counterLock = new ReentrantReadWriteLock(); + @SerializedName(value = "childMap") private Map<String, RuntimeProfile> childMap = Maps.newConcurrentMap(); + @SerializedName(value = "childList") private LinkedList<Pair<RuntimeProfile, Boolean>> childList = Lists.newLinkedList(); - private ReentrantReadWriteLock childLock = new ReentrantReadWriteLock(); - + private transient ReentrantReadWriteLock childLock = new ReentrantReadWriteLock(); + @SerializedName(value = "planNodeInfos") private List<String> planNodeInfos = Lists.newArrayList(); - // name should not changed. - private final String name; + @SerializedName(value = "name") + private String name = ""; + @SerializedName(value = "timestamp") private Long timestamp = -1L; - + @SerializedName(value = "isDone") private Boolean isDone = false; + @SerializedName(value = "isCancel") private Boolean isCancel = false; - + // In pipelineX, we have explicitly split the Operator into sink and operator, + // and we can distinguish them using tags. + // In the old pipeline, we can only differentiate them based on their position + // in the profile, which is quite tricky and only transitional. + @SerializedName(value = "isSinkOperator") private Boolean isSinkOperator = false; - + @SerializedName(value = "nodeid") private int nodeid = -1; + public RuntimeProfile() { + init(); + } + public RuntimeProfile(String name) { - this.localTimePercent = 0; if (Strings.isNullOrEmpty(name)) { throw new RuntimeException("Profile name must not be null"); } this.name = name; this.counterTotalTime = new Counter(TUnit.TIME_NS, 0, 1); this.counterMap.put("TotalTime", counterTotalTime); + init(); } public RuntimeProfile(String name, int nodeId) { - this.localTimePercent = 0; if (Strings.isNullOrEmpty(name)) { throw new RuntimeException("Profile name must not be null"); } this.name = name; + this.nodeid = nodeId; this.counterTotalTime = new Counter(TUnit.TIME_NS, 0, 3); this.counterMap.put("TotalTime", counterTotalTime); - this.nodeid = nodeId; + init(); + } + + public static RuntimeProfile read(DataInput input) throws IOException { + return GsonUtils.GSON.fromJson(Text.readString(input), RuntimeProfile.class); + } + + public void write(DataOutput output) throws IOException { + Text.writeString(output, GsonUtils.GSON.toJson(this)); + } + + private void init() { Review Comment: init 函数,紧跟构造函数 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org