Monitor CPU Registers
Solution 1
If you were to look at the working registers on your cpu, then you are correct they will change a lot ( a very lot ).
If you were to write a program to inspect and dump the contents of the registers (and this is not too difficult if you know C, assembler language for your cpu and how to integrate the two (see GCC manual)), then you would not see them changing (much). Even though they are. So why is this?
So your program runs, runs some code (that sets up the registers to do what ever it is that it is doing). This code then samples the registers, but at this point the register values have all converged at what ever they need to be at when running this bit of code, so we end up printing the same values every time.
How do we, sensibly, look at the registers?
We need a thing called a debugger or a tracer.
-
A debugger allows you to set a break point somewhere that you wish to examine. You could set break-points in various places.
-
A tracer will record information at regular points, possibly after each instruction. (Tracers will make the program run slow, is it will be spending more time tracing that running the actual program.)
A debugger usually has a tracer. One type of tracer is single stepping, where you tell the program to do one instruction. Another is to tell it to trace (run and log trace info to a file).
Solution 2
The cpuid
command does not do what you think it does.
See Wikipedia CPUID article.
The first column (the one that mostly counts) is the value in eax
before the cpuid
instruction is executed, the other columns are the values of the respective registers afterwards. Therefore the values in the registers represent the same ID information that you get when running cpuid
without -r
, and so will not change, unless you change the CPU.
From Wikipedia:
EAX=1: … EBX[bits 31:24]) is used to identify the executing logical processor.”
[If it shows n different states, and you have n cores, then that would make sence.]
Note: This is not an answer of how to do what you want, but of why what you are doing does not do what you want. See my other answer, for how to do what you want.
Related videos on Youtube
Tozar
Updated on September 18, 2022Comments
-
Tozar over 1 year
I use
:match
to highlight problems with my code that don't meet style guidelines. The following works great for the first window I open in Vim:~/.vimrc
:hi ExtraWhitespace ctermbg=red guibg=red hi NoFunctionSpace ctermbg=red guibg=red match ExtraWhitespace /\s\+$\| \+\ze\t/ 2match NoFunctionSpace /\S(/
However, when I go to
:tabedit
a file, or if I open Vim with the-p
option and multiple files, only the first window highlights matches. I want all of my open tabs to show matches.-
Ludwig Schulze over 10 yearsExactly how CPUID helped you?
-
Anomalous Awe over 10 yearsNo, only
second
line ofebx
changes. Am I right, that eax,ebx,ecx,edx must are very dynamically change their values? -
slm over 10 yearsWhat tool did you use to dump that output?
-
slm over 10 yearsIs that output from
cpuid -r
? -
Anomalous Awe over 10 yearsExactly. Nothing is changes, I made measure for a days, there is only one line with dynamical value,
ebx
, #2, char #2 changes like,6-0-4-6-0-4-2-4-0-2-... etc
. -
slm over 10 yearsAre you using the cpuid kernel mod or just the command line tool?
-
Anomalous Awe over 10 yearsBoth, plus I'm download latest version of cpuid here: etallen.com/cpuid/cpuid-20140123.src.tar.gz , and the latest show me that nothing is changes at all.
-
Martin von Wittich over 10 yearsMaybe you're looking for the
sysrq show-registers(p)
command? Runecho 1 > /proc/sys/kernel/sysrq
as root and then type Alt+SysRq+p.
-
-
pzanoni almost 12 yearsI discovered that if I use BufEnter instead of WinEnter I can remove the original
:match
. I also usecall matchadd
instead of:match
because then I can call it as many times as I want. So result:autocmd BufEnter * call matchadd("WhitespaceEOL", '\s\+$')
-
Ingo Karkat almost 12 years
matchadd()
is good; so you can still have:match
left for interactive use. ButBufEnter
is wrong; as both are scoped to the window. You may notice it not working when splitting the current buffer with:split
.