KDK_CPU_GET_MODEL(3) Library Functions Manual KDK_CPU_GET_MODEL(3)

kdk_cpu_get_model - 获取CPU型号

#include <libkycpu.h>

extern const char* kdk_cpu_get_model();

Link with -lkyhw.

The main function of the interface is to obtain CPU model

On success, returns the CPU model of type char*, such as "Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz"; The return is const char*, do not free

On error, return NULL.

#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;
}

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

kdk_cpu_get_vendor(3), kdk_cpu_get_arch(3), kdk_cpu_get_freq_MHz(3), kdk_cpu_get_corenums(3), kdk_cpu_get_virt(3) and kdk_cpu_get_process(3).

Thu Aug 24 2023 Linux Programmer's Manual