crash —— 获取cpuinfo信息

简介: crash —— 获取cpuinfo信息
crash> mach -c
CPU 0:
struct cpuinfo_x86 {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 85 'U',
  x86_stepping = 7 '\a',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 46 '.',
  x86_coreid_bits = 6 '\006',
  cu_id = 255 '\377',
  extended_cpuid_level = 2147483656,
  cpuid_level = 22,
  x86_capability = {3219913727, 739248128, 0, 326483200, 2147417087, 0, 289, 1309081818, 31, 3550478331, 15, 15, 0, 0, 119, 0, 2072, 0, 3154117632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14909440, 0},
  x86_vendor_id = "GenuineIntel\000\000\000",
  x86_model_id = "Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
  x86_cache_size = 36608,
  x86_cache_alignment = 64,
  x86_cache_max_rmid = 207,
  x86_cache_occ_scale = 106496,
  x86_power = 256,
  loops_per_jiffy = 8800000,
  x86_max_cores = 24,
  apicid = 0,
  initial_apicid = 0,
  x86_clflush_size = 64,
  booted_cores = 24,
  phys_proc_id = 0,
  logical_proc_id = 0,
  cpu_core_id = 0,
  cpu_index = 0,
  microcode = 83898626,
  x86_cache_bits = 46 '.',
  initialized = 1,
  cpuinfo_x86_extended_size_rh = 0,
  cpuinfo_x86_extended_rh = {
    cpu_die_id = 0,
    logical_die_id = 0
  }
}
...
CPU 95:
struct cpuinfo_x86 {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 85 'U',
  x86_stepping = 7 '\a',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 46 '.',
  x86_coreid_bits = 6 '\006',
  cu_id = 255 '\377',
  extended_cpuid_level = 2147483656,
  cpuid_level = 22,
  x86_capability = {3219913727, 739248128, 0, 326483200, 2147417087, 0, 289, 1309081818, 31, 3550478331, 15, 15, 0, 0, 119, 0, 2072, 0, 3154117632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14909440, 0},
  x86_vendor_id = "GenuineIntel\000\000\000",
  x86_model_id = "Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
  x86_cache_size = 36608,
  x86_cache_alignment = 64,
  x86_cache_max_rmid = 207,
  x86_cache_occ_scale = 106496,
  x86_power = 256,
  loops_per_jiffy = 8802902,
  x86_max_cores = 24,
  apicid = 123,
  initial_apicid = 123,
  x86_clflush_size = 64,
  booted_cores = 24,
  phys_proc_id = 1,
  logical_proc_id = 1,
  cpu_core_id = 29,
  cpu_index = 95,
  microcode = 83898626,
  x86_cache_bits = 46 '.',
  initialized = 1,
  cpuinfo_x86_extended_size_rh = 0,
  cpuinfo_x86_extended_rh = {
    cpu_die_id = 0,
    logical_die_id = 1
  }
}

可以看到,这里实际读取的是结构体cpuinfo_x86中的内容,内核定义了一个percpu变量:

DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);

所以可以通过p读取cpu_info的内容:

crash> p cpu_info
PER-CPU DATA TYPE:
struct cpuinfo_x86 cpu_info;
PER-CPU ADDRESSES:
  [0]: ffff88debf80f040
  [1]: ffff88debf88f040
  [2]: ffff88debf90f040
...
crash> p cpu_info:1
per_cpu(cpu_info, 1) = $348 = {
  x86 = 6 '\006',
  x86_vendor = 0 '\000',
  x86_model = 85 'U',
  x86_stepping = 7 '\a',
  x86_tlbsize = 0,
  x86_virt_bits = 48 '0',
  x86_phys_bits = 46 '.',
  x86_coreid_bits = 6 '\006',
  cu_id = 255 '\377',
  extended_cpuid_level = 2147483656,
  cpuid_level = 22,
  x86_capability = {3219913727, 739248128, 0, 326483200, 2147417087, 0, 289, 1309081818, 31, 3550478331, 15, 15, 0, 0, 119, 0, 2072, 0, 3154117632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14909440, 0},
  x86_vendor_id = "GenuineIntel\000\000\000",
  x86_model_id = "Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",
  x86_cache_size = 36608,
  x86_cache_alignment = 64,
  x86_cache_max_rmid = 207,
  x86_cache_occ_scale = 106496,
  x86_power = 256,
  loops_per_jiffy = 8800000,
  x86_max_cores = 24,
  apicid = 2,
  initial_apicid = 2,
  x86_clflush_size = 64,
  booted_cores = 24,
  phys_proc_id = 0,
  logical_proc_id = 0,
  cpu_core_id = 1,
  cpu_index = 1,
  microcode = 83898626,
  x86_cache_bits = 46 '.',
  initialized = 1,
  cpuinfo_x86_extended_size_rh = 0,
  cpuinfo_x86_extended_rh = {
    cpu_die_id = 0,
    logical_die_id = 0
  }
}
相关文章
|
弹性计算 算法 安全
SSH学习(一)- 概念了解
整体上对SSH协议进行一个概括了解。
655 3
|
11月前
|
机器学习/深度学习 人工智能 自然语言处理
claude3.5官网入口 - Claude3.5 Sonnet国内使用教程
在这个信息爆炸的时代 💥,我们每天都被海量的数据和信息包围 🌊。如何高效地处理信息、获取知识、提升效率,成为了现代人面临的巨大挑战 💪
|
8月前
|
SQL 人工智能 关系型数据库
PolarDB-PG AI最佳实践 2 :PolarDB AI X EAS实现自定义库内模型推理最佳实践
PolarDB通过POLAR_AI插件支持使用SQL调用AI/ML模型,无需专业AI知识或额外部署环境。结合阿里云EAS在线模型服务,可轻松部署自定义模型,在SQL中实现如文本翻译等功能。
|
9月前
|
关系型数据库 MySQL 数据库
市场领先者MySQL的挑战者:PostgreSQL的崛起
PostgreSQL(简称PG)是世界上最先进的开源对象关系型数据库,起源于1986年的加州大学伯克利分校POSTGRES项目。它以其丰富的功能、强大的扩展性和数据完整性著称,支持复杂数据类型、MVCC、全文检索和地理空间数据处理等特性。尽管市场份额略低于MySQL,但PG在全球范围内广泛应用,受到Google、AWS、Microsoft等知名公司支持。常用的客户端工具包括PgAdmin、Navicat和DBeaver。
385 4
|
9月前
|
存储 NoSQL Linux
linux之core文件如何查看和调试
通过设置和生成 core 文件,可以在程序崩溃时获取详细的调试信息。结合 GDB 等调试工具,可以深入分析 core 文件,找到程序崩溃的具体原因,并进行相应的修复。掌握这些调试技巧,对于提高程序的稳定性和可靠性具有重要意义。
3558 6
|
12月前
|
人工智能 供应链 安全
网络安全与信息安全:构建数字世界的坚固防线在当今数字化时代,网络安全已成为维护个人隐私、企业机密和国家安全的重要基石。本文旨在探讨网络安全漏洞、加密技术及安全意识等关键领域,通过深入浅出的方式,引导读者理解网络安全的核心要素,并分享实用的防护策略,共同守护我们的数字世界。
随着互联网技术的飞速发展,网络安全威胁日益凸显,成为全球关注的焦点。本文聚焦网络安全的三大核心议题——网络安全漏洞、加密技术与安全意识,旨在揭示它们之间的相互关联与重要性。通过剖析真实案例,展现网络攻击的复杂性与破坏力;解析加密技术的原理与实践,强调其在保护数据安全中的关键作用;同时,倡导提升公众安全意识,构建多层次的网络安全防护体系。本文不仅为专业人士提供技术参考,也旨在提高普罗大众的网络安全认知,共同筑牢数字世界的安全防线。
405 10
|
算法 测试技术 Python
python中代码逻辑错误
【7月更文挑战第15天】
468 2
|
监控 数据挖掘 数据安全/隐私保护
ERP系统中的应收应付管理与风险控制解析
【7月更文挑战第25天】 ERP系统中的应收应付管理与风险控制解析
667 2
|
算法 Java
Java将16进制的字符串转换为10进制数的方法
【6月更文挑战第27天】Java将16进制的字符串转换为10进制数的方法
2609 0
|
存储 算法 Serverless
C++中求根号
C++中求根号
2444 0

热门文章

最新文章