【问题标题】:Information about the processor using the pidin command使用 pidin 命令的处理器信息
【发布时间】:2020-09-30 13:56:09
【问题描述】:

下午好。是否可以使用 pidin 命令仅获取有关处理器型号的数据?

【问题讨论】:

    标签: qnx


    【解决方案1】:

    pidin info 被硬编码为固定的输出格式;您可以编写一个简短的脚本,通过任何常用的 POSIX 文本操作工具(例如 awk)对其进行管道传输,以提取您想要的部分。

    或者,您可以编写一个程序来直接从系统页面访问相同的信息并自行格式化。请参阅SYSPAGE_ENTRY() macrothe cpuinfo page documentation,了解有关可供程序阅读的内容的详细信息。启动库在 cpuinfo.name 元素中存储了一个友好的 CPU 名称,可以这样访问:

    #include <sys/syspage.h>
    
    const char* get_cpu0_name() {
        struct cpuinfo_entry* cpu = SYSPAGE_ENTRY(cpuinfo);
        return &SYSPAGE_ENTRY(strings)->data[cpu->name];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-02
      • 2021-12-29
      • 1970-01-01
      • 2021-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-01
      相关资源
      最近更新 更多