Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing /proc/stat by CPU ID #438

Merged
merged 1 commit into from Sep 29, 2022

Conversation

alexjx
Copy link
Contributor

@alexjx alexjx commented Mar 15, 2022

We have a case that some of the cpu (threads) are offline intentionally (see lscpu below), procfs will "interpolate" those offline values. This patch made the /proc/stat parsing with the real cpu ID.

Architecture:         x86_64
CPU op-mode(s):       32-bit, 64-bit
Byte Order:           Little Endian
CPU(s):               16
On-line CPU(s) list:  0,2,4,6,8,10,12,14
Off-line CPU(s) list: 1,3,5,7,9,11,13,15
Thread(s) per core:   1
Core(s) per socket:   8
Socket(s):            1
NUMA node(s):         1
Vendor ID:            GenuineIntel
CPU family:           6
Model:                106
Model name:           Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz
Stepping:             6
CPU MHz:              2993.062
BogoMIPS:             5986.12
Virtualization:       VT-x
Hypervisor vendor:    KVM
Virtualization type:  full
L1d cache:            32K
L1i cache:            32K
L2 cache:             4096K
L3 cache:             16384K
NUMA node0 CPU(s):    0,2,4,6,8,10,12,14
Flags:                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd arat avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid md_clear arch_capabilities

stat.go Outdated Show resolved Hide resolved
@discordianfish
Copy link
Member

Just the newStat() thing, generally this seems reasonable, thanks!

Copy link
Collaborator

@pgier pgier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, just had a couple in-line suggestions.

stat.go Outdated Show resolved Hide resolved
stat.go Outdated Show resolved Hide resolved
stat.go Outdated Show resolved Hide resolved
Signed-off-by: Jia Xin <alexjx@gmail.com>
Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants