Skip to content

Commit 98e017a

Browse files
authored
record sum of responding time for the debug session (#211)
* 1. record sum of responding time for the debug session * fix a typo
1 parent 5c4bbd2 commit 98e017a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/UsageDataSession.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class UsageDataSession {
4141
private Map<String, Integer> breakpointCountMap = new HashMap<>();
4242
private Map<Integer, RequestEvent> requestEventMap = new HashMap<>();
4343
private Map<String, Integer> userErrorCount = new HashMap<>();
44+
private Map<String, Integer> commandPerfCountMap = new HashMap<>();
4445
private List<String> eventList = new ArrayList<>();
4546

4647
public static String getSessionGuid() {
@@ -114,6 +115,7 @@ public void recordResponse(Response response) {
114115
requestEventMap.remove(response.request_seq);
115116
}
116117
long duration = responseMillis - requestMillis;
118+
commandPerfCountMap.compute(command, (k, v) -> (v == null ? 0 : v.intValue()) + (int) duration);
117119

118120
if (!response.success || duration > RESPONSE_MAX_DELAY_MS) {
119121
Map<String, Object> props = new HashMap<>();
@@ -139,6 +141,7 @@ public void submitUsageData() {
139141
props.put("commandCount", JsonUtils.toJson(commandCountMap));
140142
props.put("breakpointCount", JsonUtils.toJson(breakpointCountMap));
141143
props.put("userErrorCount", JsonUtils.toJson(userErrorCount));
144+
props.put("commandPerfCount", JsonUtils.toJson(commandPerfCountMap));
142145
if (jdiEventSequenceEnabled) {
143146
synchronized (eventList) {
144147
props.put("jdiEventSequence", JsonUtils.toJson(eventList));

0 commit comments

Comments
 (0)