Skip to content

Instantly share code, notes, and snippets.

@Malinskiy
Created July 26, 2019 01:48
Show Gist options
  • Save Malinskiy/d93731595130efc8db9dacedfa3a59fd to your computer and use it in GitHub Desktop.
Save Malinskiy/d93731595130efc8db9dacedfa3a59fd to your computer and use it in GitHub Desktop.
SimpleMetric.kt
open class SimpleMetric<T>(
provider: (Unit) -> T,
assigner: (ExecutionReport, T) -> Unit) : Metric<T, Unit>(provider, assigner)
class ProcessorCountMetric : SimpleMetric<String>(
provider = { Runtime.getRuntime().availableProcessors().toString() },
assigner = { report, value -> report.environment.cpuCount = value }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment