core: remove scopeid overloads of perfmark
diff --git a/core/src/main/java/io/grpc/internal/ClientCallImpl.java b/core/src/main/java/io/grpc/internal/ClientCallImpl.java
index 1cab55a..6f4ec16 100644
--- a/core/src/main/java/io/grpc/internal/ClientCallImpl.java
+++ b/core/src/main/java/io/grpc/internal/ClientCallImpl.java
@@ -183,12 +183,11 @@
@Override
public void start(Listener<RespT> observer, Metadata headers) {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ClientCall.start");
+ PerfMark.taskStart(tag, "ClientCall.start");
try {
startInternal(observer, headers);
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -386,12 +385,11 @@
@Override
public void cancel(@Nullable String message, @Nullable Throwable cause) {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ClientCall.cancel");
+ PerfMark.taskStart(tag, "ClientCall.cancel");
try {
cancelInternal(message, cause);
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -426,12 +424,11 @@
@Override
public void halfClose() {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ClientCall.halfClose");
+ PerfMark.taskStart(tag, "ClientCall.halfClose");
try {
halfCloseInternal();
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -445,12 +442,11 @@
@Override
public void sendMessage(ReqT message) {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ClientCall.sendMessage");
+ PerfMark.taskStart(tag, "ClientCall.sendMessage");
try {
sendMessageInternal(message);
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -512,7 +508,6 @@
private class ClientStreamListenerImpl implements ClientStreamListener {
private final Listener<RespT> observer;
private boolean closed;
- private final long listenerScopeId = PerfTag.allocateNumericId();
public ClientStreamListenerImpl(Listener<RespT> observer) {
this.observer = checkNotNull(observer, "observer");
@@ -530,8 +525,7 @@
if (closed) {
return;
}
- PerfMark.taskStart(
- listenerScopeId, Thread.currentThread().getName(), tag, "ClientCall.headersRead");
+ PerfMark.taskStart(tag, "ClientCall.headersRead");
try {
observer.onHeaders(headers);
} catch (Throwable t) {
@@ -540,7 +534,7 @@
stream.cancel(status);
close(status, new Metadata());
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
}
@@ -561,11 +555,7 @@
GrpcUtil.closeQuietly(producer);
return;
}
- PerfMark.taskStart(
- listenerScopeId,
- Thread.currentThread().getName(),
- tag,
- "ClientCall.messagesAvailable");
+ PerfMark.taskStart(tag, "ClientCall.messagesAvailable");
try {
InputStream message;
while ((message = producer.next()) != null) {
@@ -584,7 +574,7 @@
stream.cancel(status);
close(status, new Metadata());
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
}
@@ -637,12 +627,11 @@
// We intentionally don't keep the status or metadata from the server.
return;
}
- PerfMark.taskStart(
- listenerScopeId, Thread.currentThread().getName(), tag, "ClientCall.closed");
+ PerfMark.taskStart(tag, "ClientCall.closed");
try {
close(savedStatus, savedTrailers);
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
}
@@ -659,8 +648,7 @@
@Override
public final void runInContext() {
- PerfMark.taskStart(
- listenerScopeId, Thread.currentThread().getName(), tag, "ClientCall.onReady");
+ PerfMark.taskStart(tag, "ClientCall.onReady");
try {
observer.onReady();
} catch (Throwable t) {
@@ -669,7 +657,7 @@
stream.cancel(status);
close(status, new Metadata());
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
}
diff --git a/core/src/main/java/io/grpc/internal/ServerCallImpl.java b/core/src/main/java/io/grpc/internal/ServerCallImpl.java
index 4f418ec..2713ea4 100644
--- a/core/src/main/java/io/grpc/internal/ServerCallImpl.java
+++ b/core/src/main/java/io/grpc/internal/ServerCallImpl.java
@@ -90,12 +90,11 @@
@Override
public void sendHeaders(Metadata headers) {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ServerCall.sendHeaders");
+ PerfMark.taskStart(tag, "ServerCall.sendHeaders");
try {
sendHeadersInternal(headers);
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -140,12 +139,11 @@
@Override
public void sendMessage(RespT message) {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ServerCall.sendMessage");
+ PerfMark.taskStart(tag, "ServerCall.sendMessage");
try {
sendMessageInternal(message);
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -194,12 +192,11 @@
@Override
public void close(Status status, Metadata trailers) {
- PerfMark.taskStart(
- tag.getNumericTag(), Thread.currentThread().getName(), tag, "ServerCall.close");
+ PerfMark.taskStart(tag, "ServerCall.close");
try {
closeInternal(status, trailers);
} finally {
- PerfMark.taskEnd(tag.getNumericTag(), Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -263,7 +260,6 @@
private final ServerCallImpl<ReqT, ?> call;
private final ServerCall.Listener<ReqT> listener;
private final Context.CancellableContext context;
- private final long listenerScopeId = PerfTag.allocateNumericId();
public ServerStreamListenerImpl(
ServerCallImpl<ReqT, ?> call, ServerCall.Listener<ReqT> listener,
@@ -292,11 +288,7 @@
return;
}
- PerfMark.taskStart(
- listenerScopeId,
- Thread.currentThread().getName(),
- call.tag,
- "ServerCall.messagesAvailable");
+ PerfMark.taskStart(call.tag, "ServerCall.messagesAvailable");
InputStream message;
try {
while ((message = producer.next()) != null) {
@@ -313,7 +305,7 @@
MoreThrowables.throwIfUnchecked(t);
throw new RuntimeException(t);
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -323,26 +315,18 @@
return;
}
- PerfMark.taskStart(
- listenerScopeId,
- Thread.currentThread().getName(),
- call.tag,
- "ServerCall.halfClosed");
+ PerfMark.taskStart(call.tag, "ServerCall.halfClosed");
try {
listener.onHalfClose();
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@Override
public void closed(Status status) {
- PerfMark.taskStart(
- listenerScopeId,
- Thread.currentThread().getName(),
- call.tag,
- "ServerCall.closed");
+ PerfMark.taskStart(call.tag, "ServerCall.closed");
try {
try {
if (status.isOk()) {
@@ -358,7 +342,7 @@
}
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
@@ -367,15 +351,11 @@
if (call.cancelled) {
return;
}
- PerfMark.taskStart(
- listenerScopeId,
- Thread.currentThread().getName(),
- call.tag,
- "ServerCall.closed");
+ PerfMark.taskStart(call.tag, "ServerCall.closed");
try {
listener.onReady();
} finally {
- PerfMark.taskEnd(listenerScopeId, Thread.currentThread().getName());
+ PerfMark.taskEnd();
}
}
}
diff --git a/core/src/main/java/io/grpc/perfmark/PerfMark.java b/core/src/main/java/io/grpc/perfmark/PerfMark.java
index 66936e0..feeeac0 100644
--- a/core/src/main/java/io/grpc/perfmark/PerfMark.java
+++ b/core/src/main/java/io/grpc/perfmark/PerfMark.java
@@ -43,23 +43,6 @@
public static void taskStart(PerfTag tag, @CompileTimeConstant String taskName) {}
/**
- * Start a Task with a Tag to identify it; a task represents some work that spans some time, and
- * you are interested in both its start time and end time.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param tag a Tag object associated with the task. See {@link PerfTag} for description. Don't
- * use 0 for the {@code numericTag} of the Tag object. 0 is reserved to represent that a task
- * does not have a numeric tag associated. In this case, you are encouraged to use {@link
- * #taskStart(String)} or {@link PerfTag#create(String)}.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static void taskStart(
- long scopeId, String scopeName, PerfTag tag, @CompileTimeConstant String taskName) {}
-
- /**
* Start a Task; a task represents some work that spans some time, and you are interested in both
* its start time and end time.
*
@@ -69,19 +52,6 @@
public static void taskStart(@CompileTimeConstant String taskName) {}
/**
- * Start a Task; a task represents some work that spans some time, and you are interested in both
- * its start time and end time.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static void taskStart(
- long scopeId, String scopeName, @CompileTimeConstant String taskName) {}
-
- /**
* Start a Task with a Tag to identify it and with a time threshold; a task represents some work
* that spans some time, and you are interested in both its start time and end time.
*
@@ -102,33 +72,6 @@
PerfTag tag, long minPeriodNanos, @CompileTimeConstant String taskName) {}
/**
- * Start a Task with a Tag to identify it and with a time threshold; a task represents some work
- * that spans some time, and you are interested in both its start time and end time.
- *
- * <p>Sometimes, you may be interested in only events that take more than a certain time
- * threshold. In such cases, you can use this method. A Task that takes less than the specified
- * threshold, along with all its sub-tasks, events, and additional tags will be discarded.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param tag a Tag object associated with the task. See {@link PerfTag} for description. Don't
- * use 0 for the {@code numericTag} of the Tag object. 0 is reserved to represent that a task
- * does not have a numeric tag associated. In this case, you are encouraged to use {@link
- * #taskStartWithMinPeriod(long, String)} or {@link PerfTag#create(String)}.
- * @param minPeriodNanos Tasks that takes less than the specified time period, in nanosecond, will
- * be discarded, along with its sub-tasks, events, and additional tags.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static void taskStartWithMinPeriod(
- long scopeId,
- String scopeName,
- PerfTag tag,
- long minPeriodNanos,
- @CompileTimeConstant String taskName) {}
-
- /**
* Start a Task with time threshold. A task represents some work that spans some time, and you are
* interested in both its start time and end time.
*
@@ -144,38 +87,10 @@
public static void taskStartWithMinPeriod(
long minPeriodNanos, @CompileTimeConstant String taskName) {}
- /**
- * Start a Task with time threshold. A task represents some work that spans some time, and you are
- * interested in both its start time and end time.
- *
- * <p>Sometimes, you may be interested in only events that take more than a certain time
- * threshold. In such cases, you can use this method. A task that takes less than the specified
- * threshold, along with all its sub-tasks, events, and additional tags will be discarded.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param minPeriodNanos Tasks that takes less than the specified time period, in nanosecond, will
- * be discarded, along with its sub-tasks, events, and additional tags.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static void taskStartWithMinPeriod(
- long scopeId, String scopeName, long minPeriodNanos, @CompileTimeConstant String taskName) {}
-
/** End a Task. See {@link #taskStart(PerfTag, String)}. */
public static void taskEnd() {}
/**
- * End a Task. See {@link #taskStart(PerfTag, String)}.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- */
- public static void taskEnd(long scopeId, String scopeName) {}
-
- /**
* Start a Task with a Tag to identify it in a try-with-resource statement; a task represents some
* work that spans some time, and you are interested in both its start time and end time.
*
@@ -193,27 +108,6 @@
}
/**
- * Start a Task with a Tag to identify it in a try-with-resource statement; a task represents some
- * work that spans some time, and you are interested in both its start time and end time.
- *
- * <p>Use this in a try-with-resource statement so that task will end automatically.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param tag a Tag object associated with the task. See {@link PerfTag} for description. Don't
- * use 0 for the {@code numericTag} of the Tag object. 0 is reserved to represent that a task
- * does not have a numeric tag associated. In this case, you are encouraged to use {@link
- * #task(String)} or {@link PerfTag#create(String)}.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static PerfMarkTask task(
- long scopeId, String scopeName, PerfTag tag, @CompileTimeConstant String taskName) {
- return AUTO_DO_NOTHING;
- }
-
- /**
* Start a Task it in a try-with-resource statement; a task represents some work that spans some
* time, and you are interested in both its start time and end time.
*
@@ -227,23 +121,6 @@
}
/**
- * Start a Task it in a try-with-resource statement; a task represents some work that spans some
- * time, and you are interested in both its start time and end time.
- *
- * <p>Use this in a try-with-resource statement so that task will end automatically.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static PerfMarkTask task(
- long scopeId, String scopeName, @CompileTimeConstant String taskName) {
- return AUTO_DO_NOTHING;
- }
-
- /**
* Start a Task with a Tag to identify it, and with time threshold, in a try-with-resource
* statement; a task represents some work that spans some time, and you are interested in both its
* start time and end time.
@@ -269,38 +146,6 @@
}
/**
- * Start a Task with a Tag to identify it, and with time threshold, in a try-with-resource
- * statement; a task represents some work that spans some time, and you are interested in both its
- * start time and end time.
- *
- * <p>Use this in a try-with-resource statement so that task will end automatically.
- *
- * <p>Sometimes, you may be interested in only events that take more than a certain time
- * threshold. In such cases, you can use this method. A task that takes less than the specified
- * threshold, along with all its sub-tasks, events, and additional tags will be discarded.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param tag a Tag object associated with the task. See {@link PerfTag} for description. Don't
- * use 0 for the {@code numericTag} of the Tag object. 0 is reserved to represent that a task
- * does not have a numeric tag associated. In this case, you are encouraged to use {@link
- * #taskWithMinPeriod(long, String)} or {@link PerfTag#create(String)}.
- * @param minPeriodNanos Tasks that takes less than the specified time period, in nanosecond, will
- * be discarded, along with its sub-tasks, events, and additional tags.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static PerfMarkTask taskWithMinPeriod(
- long scopeId,
- String scopeName,
- PerfTag tag,
- long minPeriodNanos,
- @CompileTimeConstant String taskName) {
- return AUTO_DO_NOTHING;
- }
-
- /**
* Start a Task with time threshold in a try-with-resource statement; a task represents some work
* that spans some time, and you are interested in both its start time and end time.
*
@@ -320,29 +165,6 @@
return AUTO_DO_NOTHING;
}
- /**
- * Start a Task with time threshold in a try-with-resource statement; a task represents some work
- * that spans some time, and you are interested in both its start time and end time.
- *
- * <p>Use this in a try-with-resource statement so that task will end automatically.
- *
- * <p>Sometimes, you may be interested in only events that take more than a certain time
- * threshold. In such cases, you can use this method. A task that takes less than the specified
- * threshold, along with all its sub-tasks, events, and additional tags will be discarded.
- *
- * @param scopeId The scope of the task. The scope id is used to join task starting and ending
- * across threads. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param minPeriodNanos Tasks that takes less than the specified time period, in nanosecond, will
- * be discarded, along with its sub-tasks, events, and additional tags.
- * @param taskName The name of the task. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this task.
- */
- public static PerfMarkTask taskWithMinPeriod(
- long scopeId, String scopeName, long minPeriodNanos, @CompileTimeConstant String taskName) {
- return AUTO_DO_NOTHING;
- }
-
static final PerfMarkTask AUTO_DO_NOTHING = new PerfMarkTask() {
@Override
public void close() {}
@@ -364,25 +186,6 @@
public static void event(PerfTag tag, @CompileTimeConstant String eventName) {}
/**
- * Records an Event with a Tag to identify it.
- *
- * <p>An Event is different from a Task in that you don't care how much time it spanned. You are
- * interested in only the time it happened.
- *
- * @param scopeId The scope of the event. The scope id is used to associated the event with a
- * particular scope. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param tag a Tag object associated with the task. See {@link PerfTag} for description. Don't
- * use 0 for the {@code numericTag} of the Tag object. 0 is reserved to represent that a task
- * does not have a numeric tag associated. In this case, you are encouraged to use {@link
- * #event(String)} or {@link PerfTag#create(String)}.
- * @param eventName The name of the event. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this event.
- */
- public static void event(
- long scopeId, String scopeName, PerfTag tag, @CompileTimeConstant String eventName) {}
-
- /**
* Records an Event.
*
* <p>An Event is different from a Task in that you don't care how much time it spanned. You are
@@ -394,20 +197,6 @@
public static void event(@CompileTimeConstant String eventName) {}
/**
- * Records an Event.
- *
- * <p>An Event is different from a Task in that you don't care how much time it spanned. You are
- * interested in only the time it happened.
- *
- * @param scopeId The scope of the event. The scope id is used to associate the event with a
- * particular scope. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param eventName The name of the event. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this event.
- */
- public static void event(long scopeId, String scopeName, @CompileTimeConstant String eventName) {}
-
- /**
* Add an additional tag to the last task that was started.
*
* <p>A tag is different from an Event or a task in that clients don't care about the time at
@@ -422,24 +211,4 @@
* Otherwise, instrumentation result will show "(invalid name)" for this tag.
*/
public static void tag(PerfTag tag, @CompileTimeConstant String tagName) {}
-
- /**
- * Add an additional tag to the last task that was started.
- *
- * <p>A tag is different from an Event or a task in that clients don't care about the time at
- * which this tag is added. Instead, it allows clients to associate an additional tag to the
- * current Task.
- *
- * @param scopeId The scope of the tag. The scope id is used to associate a tag with a particular
- * scope. The scope id must be a positive number.
- * @param scopeName The name of the scope.
- * @param tag a Tag object associated with the task. See {@link PerfTag} for description. Don't
- * use 0 for the {@code numericTag} of the Tag object. 0 is reserved to represent that a task
- * does not have a numeric tag associated. In this case, you are encouraged to use {@link
- * PerfTag#create(String)}.
- * @param tagName The name of the tag. <b>This parameter must be a compile-time constant!</b>
- * Otherwise, instrumentation result will show "(invalid name)" for this tag.
- */
- public static void tag(
- long scopeId, String scopeName, PerfTag tag, @CompileTimeConstant String tagName) {}
}