Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor quality of life improvements for PerfMark #182

Merged
merged 4 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/main/java/io/perfmark/PerfMark.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@
* @author Carl Mastrangelo
*/
public final class PerfMark {

/**
* Turns on or off PerfMark recording. Don't call this method too frequently; while neither on nor
* off have very high overhead, transitioning between the two may be slow.
*
* @param value {@code true} to enable PerfMark recording, or {@code false} to disable it.
* @return If the enabled value was changed.
*/
@CanIgnoreReturnValue
public static boolean setEnabled(boolean value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ protected void onTaskEnd(Mark mark, boolean unmatchedStart, boolean unmatchedEnd

@Override
protected void onAttachTag(Mark mark) {
if (taskStack.isEmpty()) {
// In a mark list of only links (i.e. no starts or ends) it's possible there are no tasks
// to bind to. This is probably due to not calling link() correctly.
logger.fine("Tag not associated with any task");
return;
}
TaskStart taskStart = taskStack.peekLast();
TraceEvent taskEvent = traceEvents.get(taskStart.traceEventIdx);
TraceEvent.TagMap args = taskEvent.args();
Expand Down Expand Up @@ -490,7 +496,7 @@ protected void onLink(Mark mark) {
if (taskStack.isEmpty()) {
// In a mark list of only links (i.e. no starts or ends) it's possible there are no tasks
// to bind to. This is probably due to not calling link() correctly.
logger.warning("Link not associated with any task");
logger.fine("Link not associated with any task");
return;
}
LinkTuple linkTuple =
Expand Down