eclipse-ee4j / eclipse-ee4j/jersey

Please double check your tracing statistic logic

Open
#3,711 1 comment 0 reactions 0 assignees View on GitHub
Type: Improvement
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

In TracingInfo:

for (int i = 0; i < messages.length; i++) {
final Message message = messageList.get(i);
final StringBuilder textSB = new StringBuilder();
// event
textSB.append(String.format("%-11s ", message.getEvent().category()));
// duration
textSB.append('[')
.append(formatDuration(message.getDuration()))
.append(" / ")
.append(formatDuration(fromTimestamp, message.getTimestamp()))
.append(" ms |")
.append(formatPercent(message.getDuration(), toTimestamp - fromTimestamp))
.append(" %] ");
// text
textSB.append(message.toString());
messages[i] = textSB.toString();
}

This logic is actually not correct.

Since your message time measurement is in sequence.

Some message are summary message which wrap others.

So, startTime is not reliable:

` final long fromTimestamp = messageList.get(0).getTimestamp() - messageList.get(0).getDuration();`

Say we have time sequences:

t1, t2, t3, t4

You might use (t3-t2) as first message and (t4-t1) as the second one.
In this case, t2 is not the very start time.

Thanks
Leon

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.