KDK_CPU_GET_FREQ_MHZ(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

✨ KDK_CPU_GET_FREQ_MHZ(3) ✨

ok bestie, this is a Library Functions Manual page, so grab a strawberry drink and let's go 🍓


💖 NAME 💖

kdk_cpu_get_freq_MHz — 获取CPU额定主频

(yes that's "get the CPU's rated clock speed" in case your Chinese is lowkey rusty, we love a bilingual icon 🌸)


🎀 SYNOPSIS 🎀

#include <libkycpu.h>

extern const char* kdk_cpu_get_freq_MHz();

Link with -lkyhw.

so you #include <libkycpu.h>, you declare that extern, and then you link with -lkyhw — do NOT forget the link flag or the linker will simply not know her 💅


🌈 Detailed Description 🌈

The main function of the interface is to obtain CPU Clock Speed. that's it. that's the whole job. she's a one-trick pony and she ATE. no cap 🔥


💜 RETURN VALUE 💜

  • On success, returns the CPU Clock Speed of type char*, such as "1794.742", unit is MHz; The return is const char*, do not free.
⚠️ girl listen: the return is const char*. do not free it. not yours. hands off. she is not your string to free 🙈
  • On error, return NULL.

so always vibe check that pointer before you print it, fr fr ✨


🦋 EXAMPLES 🦋

here's the whole cute little demo, verbatim, every line, nothing skipped 🫶

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

look at her go, printing the whole CPU resume like it's an instagram bio 😭💖


⭐ CONFORMING TO ⭐

These functions are as per the withdrawn POSIX.1e draft specification. (withdrawn! a historical artifact! she's giving vintage 👑)

The following functions are Linux extensions:

  • kdk_cpu_get_vendor()
  • kdk_cpu_get_arch()
  • kdk_cpu_get_model()
  • kdk_cpu_get_corenums()
  • kdk_cpu_get_virt()
  • kdk_cpu_get_process()

👑 SEE ALSO 👑

go read the whole friend group, they're all iconic 🌈✨


and that's the page!! brought to you by the Linux Programmer's Manual, dated Thu Aug 24 2023, page KDK_CPU_GET_FREQ_MHZ(3) — mwah, stay clocked bestie 💅💖🎀

📦 where this page comes from