Skip to content

Android (Kotlin): getHighPerfCpuCountByVariant gives the number of cores in the slowest core-cluster #3602

Description

@Radonoxius

Today, I was looking into this file:

Main-Branch/examples/whisper.android/lib/src/main/java/com/whispercpp/whisper/WhisperCpuConfig.kt.

I suspected whether the implementation of getHighPerfCpuCountByVariant was wrong. I tested it out in my android app and as I suspected, it gave me the number of cores in the slowest cluster (aka all the little-est cores).

I tested it on a device running Android 15, with the Mediatek Helio G85 SOC.

Suggested fix:

private fun getHighPerfCpuCountByVariant(): Int =
        getCpuValues(property = "CPU variant") { it.substringAfter("0x").toInt(radix = 16) }
            .also { Log.d(LOG_TAG, "Binned cpu variants (variant, count): ${it.binnedValues()}") }
            .countDroppingMin()

This implementation gives Total core count - Number of slowest cores

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions