kdk_cpu_get_corenums(3)

kdk_cpu_get_corenums3

获取cpu核心数量

Usage

#include <libkycpu.h>

extern unsigned int kdk_cpu_get_corenums()

Link with -lkyhw.

Detailed Description

The main function of the interface is to obtain the number of CPU cores

Return value

On success, returns the number of all available CPU cores of type int.

On error, return 0.

Examples

#include "libkycpu.h"
#include <stdio.h>
int main()
{
    printf("架构:%s\n", kdk_cpu_get_arch());
    printf("生产厂商:%s\n", kdk_cpu_get_vendor());
    printf("CPU 型号:%s\n", kdk_cpu_get_model());
    printf("CPU 主频:%s MHz\n", kdk_cpu_get_freq_MHz());
    printf("CPU 单核核心数量:%u\n", kdk_cpu_get_corenums());
    printf("CPU 虚拟化支持:%s\n", kdk_cpu_get_virt());
    printf("CPU 线程数:%u\n", kdk_cpu_get_process());
    return 0;
}

Conforming to

These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_cpu_get_vendor(), kdk_cpu_get_model(), kdk_cpu_get_freq_MHz(), kdk_cpu_get_arch(), kdk_cpu_get_virt() and kdk_cpu_get_process().

From libkysdk-system 3.0.1.4-1 in Arch Linux 2026-11-07. Parsed by carta from the page's man source.