Permalink
Browse files

wip

  • Loading branch information...
1 parent 9d20585 commit 4be427b0b7808700f0ac6d8f9b28cb0a4fc55581 @dpsoft dpsoft committed Dec 5, 2016
View
@@ -18,6 +18,11 @@ file:
libraryDependencies += "kamon.io" %% "kamon-core" % "0.6.3"
```
+### Documentation
+
+Kamon information and documentation is available on the
+[website](http://kamon.io).
+
### Modules ###
* [Play Framework]
View
@@ -22,7 +22,7 @@ lazy val kamon = (project in file("."))
.settings(basicSettings: _*)
.settings(formatSettings: _*)
.settings(noPublishing: _*)
- .aggregate(core, autoweave, testkit)
+ .aggregate(core, autoweave, testkit, bench)
lazy val core = (project in file("kamon-core"))
@@ -56,5 +56,12 @@ lazy val testkit = (project in file("kamon-testkit"))
providedScope(aspectJ) ++
testScope(slf4jApi, slf4jnop))
+lazy val bench = (project in file("kamon-bench"))
+ .dependsOn(core)
+ .settings(basicSettings: _*)
+ .settings(formatSettings: _*)
+ .settings(noPublishing: _*)
+ .enablePlugins(JmhPlugin)
+
lazy val noPublishing = Seq(publish := (), publishLocal := (), publishArtifact := false)
@@ -0,0 +1,3 @@
+kamon.metric {
+ tick-interval = 1 hour
+}
@@ -0,0 +1,34 @@
+package kamon.bench.instruments
+
+import java.nio.LongBuffer
+import java.util.concurrent.TimeUnit
+
+import kamon.metric.instrument.{CollectionContext, LongAdderCounter}
+import org.openjdk.jmh.annotations._
+
+@State(Scope.Group)
+@BenchmarkMode(Array(Mode.AverageTime))
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Fork(2)
+@Warmup(iterations = 10)
+@Measurement(iterations = 10)
+class KamonCounterBench {
+
+ val counter: LongAdderCounter = new LongAdderCounter
+
+ val collectionContext = new CollectionContext {
+ val buffer: LongBuffer = LongBuffer.allocate(33792)
+ }
+
+ @Benchmark
+ @Group("rw")
+ def increment(): Unit = {
+ counter.increment()
+ }
+
+ @Benchmark
+ @Group("rw")
+ def get(): Long = {
+ counter.collect(collectionContext).count
+ }
+}
@@ -0,0 +1,35 @@
+package kamon.bench.instruments
+
+import java.nio.LongBuffer
+import java.util.concurrent.TimeUnit
+
+import kamon.metric.instrument.Histogram.DynamicRange
+import kamon.metric.instrument.{CollectionContext, Histogram, PaddedMinMaxCounter}
+import org.openjdk.jmh.annotations._
+
+@State(Scope.Group)
+@BenchmarkMode(Array(Mode.AverageTime))
+@OutputTimeUnit(TimeUnit.NANOSECONDS)
+@Fork(2)
+@Warmup(iterations = 10)
+@Measurement(iterations = 10)
+class KamonMinMaxCounterBench {
+
+ val counter: PaddedMinMaxCounter = new PaddedMinMaxCounter(Histogram(DynamicRange(1L, 999999999L, 2)))
+
+ val collectionContext = new CollectionContext {
+ val buffer: LongBuffer = LongBuffer.allocate(33792)
+ }
+
+ @Benchmark
+ @Group("rw")
+ def increment(): Unit = {
+ counter.increment()
+ }
+
+ @Benchmark
+ @Group("rw")
+ def get(): Long = {
+ counter.collect(collectionContext).min
+ }
+}
@@ -200,7 +200,7 @@ class HdrHistogram(dynamicRange: DynamicRange) extends ModifiedAtomicHistogram(
}
}
-case class CompactHdrSnapshot(val numberOfMeasurements: Long, compactRecords: Array[Long], unitMagnitude: Int,
+case class CompactHdrSnapshot(numberOfMeasurements: Long, compactRecords: Array[Long], unitMagnitude: Int,
subBucketHalfCount: Int, subBucketHalfCountMagnitude: Int) extends Histogram.Snapshot {
def min: Long = if (compactRecords.length == 0) 0 else levelFromCompactRecord(compactRecords(0))
View
@@ -3,14 +3,11 @@ resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositori
resolvers += "Kamon Releases" at "http://repo.kamon.io"
addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.10.6")
-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.2")
-
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.1")
-
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1")
-
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.1")
+addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.18")
+

0 comments on commit 4be427b

Please sign in to comment.