All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.tinkoff.plugins.buildmetrics.system.labels.CpuLabelsFactory.kt Maven / Gradle / Ivy

The newest version!
package ru.tinkoff.plugins.buildmetrics.system.labels

import oshi.SystemInfo
import ru.tinkoff.plugins.buildmetrics.api.factories.Factory
import ru.tinkoff.plugins.buildmetrics.api.labels.Label

class CpuLabelsFactory : Factory.Labels {

    override fun create(): List> = listOf(
        cpuNameLabels(),
        cpuCountLabel(),
    )

    private fun cpuNameLabels(): Label {
        return Label(
            "cpu_name",
            SystemInfo().hardware.processor.processorIdentifier.name
        )
    }

    private fun cpuCountLabel(): Label {
        return Label(
            "cpu_count",
            Runtime.getRuntime().availableProcessors()
        )
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy