I am trying to measure the time taken by some code inside Linux kernel at very high accuracy by a Linux kernel module.
For this purpose, I have tried rdtscl() which gives the number of clock ticks used in the code as given below:
unsigned long ini, end;
rdtscl(ini);
//some code...
rdtscl(end);
printk("time taken=%lu ticks",end-ini);
As I have refered to http://en.wikipedia.org/wiki/Time_Stamp_Counter which says that TSC is a 64-bit register present on all x86 processors since the Pentium. So, if I have dual core processor, will this counter be present in both cores or there will be only one since it is only one processor but dual core?
The second question is that: I have Intel Xeon i3 processor which has 4 processors, each of them having 2 cores. Then, measuring the clock ticks, will give the ticks of single processor or addition of all 4 processors?