Skip to content
Permalink
Browse files

move to perfmark from grpc

  • Loading branch information...
carl-mastrangelo committed May 9, 2019
1 parent c08d9cb commit 783630d78a0166296aa7c449284f4eb0fadf9cf5
Showing with 118 additions and 121 deletions.
  1. +1 −1 .gitignore
  2. +5 −1 api/src/jmh/java/io/{grpc/contrib → }/perfmark/EnabledBenchmark.java
  3. +2 −2 api/src/main/java/io/{grpc/contrib → }/perfmark/Internal.java
  4. +12 −3 api/src/main/java/io/{grpc/contrib → }/perfmark/Link.java
  5. +1 −3 api/src/main/java/io/{grpc/contrib → }/perfmark/NoopGenerator.java
  6. +1 −5 api/src/main/java/io/{grpc/contrib → }/perfmark/NoopMarkHolderProvider.java
  7. +5 −7 api/src/main/java/io/{grpc/contrib → }/perfmark/PerfMark.java
  8. +4 −1 api/src/main/java/io/{grpc/contrib → }/perfmark/PerfMarkCloseable.java
  9. +3 −8 api/src/main/java/io/{grpc/contrib → }/perfmark/PerfMarkStorage.java
  10. +18 −13 api/src/main/java/io/{grpc/contrib → }/perfmark/Tag.java
  11. +1 −1 api/src/main/java/io/{grpc/contrib → }/perfmark/package-info.java
  12. +1 −3 build.gradle
  13. +0 −3 implapi/build.gradle
  14. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/Generator.java
  15. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/Internal.java
  16. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/Mark.java
  17. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/MarkHolder.java
  18. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/MarkHolderProvider.java
  19. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/MarkList.java
  20. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/Marker.java
  21. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/SecretMarkerFactory.java
  22. +1 −1 implapi/src/main/java/io/{grpc/contrib/perfmark/impl → perfmark}/package-info.java
  23. +2 −2 java6/src/main/java/io/{grpc/contrib → }/perfmark/java6/Internal.java
  24. +2 −2 java6/src/main/java/io/{grpc/contrib → }/perfmark/java6/SecretVolatileGenerator.java
  25. +1 −1 java6/src/main/java/io/{grpc/contrib → }/perfmark/java6/package-info.java
  26. +0 −5 java7/build.gradle
  27. +1 −1 java7/src/jmh/java/io/{grpc/contrib → }/perfmark/java7/MethodHandleGeneratorBenchmark.java
  28. +2 −2 java7/src/main/java/io/{grpc/contrib → }/perfmark/java7/Internal.java
  29. +2 −2 java7/src/main/java/io/{grpc/contrib → }/perfmark/java7/SecretMethodHandleGenerator.java
  30. +1 −1 java7/src/main/java/io/{grpc/contrib → }/perfmark/java7/package-info.java
  31. +4 −4 java9/src/jcstress/java/io/{grpc/contrib → }/perfmark/java9/PerfMarkStorageStress.java
  32. +2 −1 java9/src/jmh/java/io/{grpc/contrib → }/perfmark/java9/VarHandleGeneratorBenchmark.java
  33. +3 −2 java9/src/jmh/java/io/{grpc/contrib → }/perfmark/java9/VarHandleMarkHolderBenchmark.java
  34. +0 −3 java9/src/main/java/io/grpc/contrib/perfmark/java9/package-info.java
  35. +4 −4 java9/src/main/java/io/{grpc/contrib → }/perfmark/java9/PackageAccess.java
  36. +5 −5 java9/src/main/java/io/{grpc/contrib → }/perfmark/java9/VarHandleMarkHolder.java
  37. +3 −0 java9/src/main/java/io/perfmark/java9/package-info.java
  38. +16 −15 java9/src/test/java/io/{grpc/contrib → }/perfmark/java9/PerfMarkStorageTest.java
  39. +7 −11 java9/src/test/java/io/{grpc/contrib → }/perfmark/java9/PerfMarkStressTest.java
@@ -12,7 +12,7 @@ target
bazel-bin
bazel-examples
bazel-genfiles
bazel-grpc-java
bazel-perfmark
bazel-out
bazel-testlogs

@@ -1,5 +1,9 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import io.perfmark.Link;
import io.perfmark.PerfMark;
import io.perfmark.PerfMarkCloseable;
import io.perfmark.Tag;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -1,7 +1,7 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

/**
* Internal class for accessing package protected methods of the perfmark api. If you need to use
* Internal class for accessing package protected methods of the PerfMark API. If you need to use
* this class, please file an issue on GitHub first with your use case.
*/
public final class Internal {
@@ -1,6 +1,5 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import io.grpc.contrib.perfmark.impl.Mark;
import java.util.concurrent.atomic.AtomicLong;

/**
@@ -28,6 +27,16 @@ long getId() {

@Override
public String toString() {
return "Link{id=" + id + "}";
return "Link(" + id + ")";
}

/**
* Equality on Links is not well defined, since the created tag can depend on if PerfMark was
* enabled at the time of creation.
*/
@Override
@Deprecated // Don't use equality on links
public boolean equals(Object obj) {
return super.equals(obj);
}
}
@@ -1,6 +1,4 @@
package io.grpc.contrib.perfmark;

import io.grpc.contrib.perfmark.impl.Generator;
package io.perfmark;

/**
* Noop Generator for use when no other generator can be used.
@@ -1,9 +1,5 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import io.grpc.contrib.perfmark.impl.Mark;
import io.grpc.contrib.perfmark.impl.MarkHolder;
import io.grpc.contrib.perfmark.impl.MarkHolderProvider;
import io.grpc.contrib.perfmark.impl.Marker;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
@@ -1,10 +1,8 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import static io.grpc.contrib.perfmark.impl.Generator.GEN_OFFSET;
import static io.perfmark.Generator.GEN_OFFSET;

import com.google.errorprone.annotations.CompileTimeConstant;
import io.grpc.contrib.perfmark.impl.Generator;
import io.grpc.contrib.perfmark.impl.Marker;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.logging.Level;
@@ -21,7 +19,7 @@
Queue<Throwable> failures = new ArrayDeque<Throwable>();
try {
Class<? extends Generator> clz =
Class.forName("io.grpc.contrib.perfmark.java7.SecretMethodHandleGenerator$MethodHandleGenerator")
Class.forName("io.perfmark.java7.SecretMethodHandleGenerator$MethodHandleGenerator")
.asSubclass(Generator.class);
gen = clz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException e) {
@@ -38,7 +36,7 @@
if (gen == null) {
try {
Class<? extends Generator> clz =
Class.forName("io.grpc.contrib.perfmark.java9.PackageAccess$VarHandleGenerator")
Class.forName("io.perfmark.java9.PackageAccess$VarHandleGenerator")
.asSubclass(Generator.class);
gen = clz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException e) {
@@ -56,7 +54,7 @@
if (gen == null) {
try {
Class<? extends Generator> clz =
Class.forName("io.grpc.contrib.perfmark.java6.PackageAccess$VolatileGenerator")
Class.forName("io.perfmark.java6.PackageAccess$VolatileGenerator")
.asSubclass(Generator.class);
gen = clz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException e) {
@@ -1,10 +1,13 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import com.google.errorprone.annotations.CompileTimeConstant;
import java.io.Closeable;

public abstract class PerfMarkCloseable implements Closeable {

/**
* {@link #close()} does not throw a checked exception.
*/
@Override
public abstract void close();

@@ -1,10 +1,5 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import io.grpc.contrib.perfmark.impl.Mark;
import io.grpc.contrib.perfmark.impl.MarkHolder;
import io.grpc.contrib.perfmark.impl.MarkHolderProvider;
import io.grpc.contrib.perfmark.impl.MarkList;
import io.grpc.contrib.perfmark.impl.Marker;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
@@ -22,7 +17,7 @@
public final class PerfMarkStorage {

static final long NO_THREAD_ID = -1;
static final String NO_THREAD_NAME = "(unknown)";
static final String NO_THREAD_NAME = "(unknownThread)";

private static final MarkHolderProvider markHolderProvider;
private static final Logger logger;
@@ -32,7 +27,7 @@
Queue<Throwable> failures = new ArrayDeque<Throwable>();
try {
Class<? extends MarkHolderProvider> clz =
Class.forName("io.grpc.contrib.perfmark.java9.PackageAccess$VarHandleMarkHolderProvider")
Class.forName("io.perfmark.java9.PackageAccess$VarHandleMarkHolderProvider")
.asSubclass(MarkHolderProvider.class);
MarkHolderProvider provider = clz.getDeclaredConstructor().newInstance();
if (provider.unavailabilityCause() != null) {
@@ -1,33 +1,23 @@
package io.grpc.contrib.perfmark;
package io.perfmark;

import io.grpc.contrib.perfmark.impl.Mark;
import javax.annotation.Nullable;

/**
* Tag is a dynamic, runtime created identifier (such as an RPC id).
*/
public final class Tag {
static final Tag NO_TAG = new Tag();
static final Tag NO_TAG = new Tag(Mark.NO_TAG_ID);

@Nullable final String tagName;
final long tagId;

private Tag() {
this.tagName = Mark.NO_TAG_NAME;
this.tagId = Mark.NO_TAG_ID;
}

Tag(long tagId) {
this.tagName = Mark.NO_TAG_NAME;
this.tagId = tagId;
}

Tag(String tagName) {
if (tagName == null) {
throw new NullPointerException("bad tag name");
}
this.tagName = tagName;
this.tagId = Mark.NO_TAG_ID;
this(tagName, Mark.NO_TAG_ID);
}

Tag(String tagName, long tagId) {
@@ -37,4 +27,19 @@ private Tag() {
this.tagName = tagName;
this.tagId = tagId;
}

@Override
public String toString() {
return "Tag(" + tagName + ", " + tagId + ')';
}

/**
* Equality on Tags is not well defined, since the created tag can depend on if PerfMark was
* enabled at the time of creation.
*/
@Override
@Deprecated // Don't use equality on tags
public boolean equals(Object obj) {
return super.equals(obj);
}
}
@@ -1,3 +1,3 @@
@javax.annotation.CheckReturnValue
@javax.annotation.ParametersAreNonnullByDefault
package io.grpc.contrib.perfmark;
package io.perfmark;
@@ -7,7 +7,6 @@ buildscript {

dependencies {
classpath 'com.github.erizo.gradle:jcstress-gradle-plugin:0.8.2'
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.5'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.6'
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8"
}
@@ -18,7 +17,6 @@ subprojects {
apply plugin: "idea"
apply plugin: "jacoco"
apply plugin: "me.champeau.gradle.jmh"
apply plugin: "ru.vyarus.animalsniffer"
apply plugin: "net.ltgt.errorprone"

repositories {
@@ -45,7 +43,7 @@ subprojects {

jacoco { toolVersion = "0.8.2" }

group = "io.grpc.contrib.perfmark"
group = "io.perfmark"
version = "1.0.0-SNAPSHOT"

ext {
@@ -6,8 +6,5 @@ targetCompatibility = 1.6
dependencies {
compile libraries.jsr305,
libraries.errorprone

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
}

@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

public abstract class Generator {
public static final int GEN_OFFSET = 8;
@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

public final class Internal {

@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

import java.util.Arrays;
import javax.annotation.Nullable;
@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

import java.util.List;

@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

import javax.annotation.Nullable;

@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

import java.util.ArrayList;
import java.util.Arrays;
@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

import java.util.Arrays;
import javax.annotation.Nullable;
@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.impl;
package io.perfmark;

import javax.annotation.Nullable;

@@ -1,3 +1,3 @@
@javax.annotation.CheckReturnValue
@javax.annotation.ParametersAreNonnullByDefault
package io.grpc.contrib.perfmark.impl;
package io.perfmark;
@@ -1,6 +1,6 @@
package io.grpc.contrib.perfmark.java6;
package io.perfmark.java6;

import io.grpc.contrib.perfmark.impl.Generator;
import io.perfmark.Generator;

public final class Internal {

@@ -1,6 +1,6 @@
package io.grpc.contrib.perfmark.java6;
package io.perfmark.java6;

import io.grpc.contrib.perfmark.impl.Generator;
import io.perfmark.Generator;

final class SecretVolatileGenerator {

@@ -1,3 +1,3 @@
@javax.annotation.CheckReturnValue
@javax.annotation.ParametersAreNonnullByDefault
package io.grpc.contrib.perfmark.java6;
package io.perfmark.java6;
@@ -6,9 +6,6 @@ targetCompatibility = 1.7
dependencies {
compile project(':perfmark-impl-api'),
libraries.jsr305

// no signature because method handles are @PolymorphicSignature
// signature "org.codehaus.mojo.signature:java17:1.0@signature"
}

jmh {
@@ -17,7 +14,6 @@ jmh {
fork = 1
warmupIterations = 10


profilers = ["perfasm"]

jvmArgs = [
@@ -37,5 +33,4 @@ jmh {
"-XX:PrintAssemblyOptions=syntax",
"-XX:PrintAssemblyOptions=intel"
]

}
@@ -1,4 +1,4 @@
package io.grpc.contrib.perfmark.java7;
package io.perfmark.java7;

import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
@@ -1,6 +1,6 @@
package io.grpc.contrib.perfmark.java7;
package io.perfmark.java7;

import io.grpc.contrib.perfmark.impl.Generator;
import io.perfmark.Generator;

public final class Internal {

@@ -1,6 +1,6 @@
package io.grpc.contrib.perfmark.java7;
package io.perfmark.java7;

import io.grpc.contrib.perfmark.impl.Generator;
import io.perfmark.Generator;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MutableCallSite;
@@ -1,3 +1,3 @@
@javax.annotation.CheckReturnValue
@javax.annotation.ParametersAreNonnullByDefault
package io.grpc.contrib.perfmark.java7;
package io.perfmark.java7;

0 comments on commit 783630d

Please sign in to comment.
You can’t perform that action at this time.