/*
 * SPDX-FileCopyrightText: Sebastiano Barezzi
 * SPDX-License-Identifier: Apache-2.0
 */

package com.xyzshell.andinfo.libs.cpu.models

/**
 * `struct cpuinfo_trace_cache`
 * 跟踪缓存结构体（用于存储已解码的微操作）
 */
data class TraceCache(
    /**
     * Number of micro-operations
     * 微操作数量
     */
    val uops: UInt,

    /**
     * Associativity of the trace cache
     * 跟踪缓存的关联度
     */
    val associativity: UInt,
) {
    companion object {
        @JvmStatic
        fun fromCpuInfo(
            uops: Int,
            associativity: Int,
        ) = TraceCache(
            uops.toUInt(),
            associativity.toUInt(),
        )
    }
}
