The problem with that approach is that it won't give you an accurate
result. By changing the size and instructions in the spinlock code
you're changing how it behaves... So you'll get profiling data on
something that you're not really interested in.
Another idea - still not perfect - would be to check system time before
you enter the lock and after you exit.
Regards,
Rudy
[EMAIL PROTECTED]
On Thu, 29 Apr 1999, Chuck Lever wrote:
> i'm interested in knowing how much time is spent by CPUs in an SMP system
> spinning in specific spin locks. the spin lock implementation for SMP is
> tightly coded, all in assembler. would it be appropriate to code a C
> version of "spin_lock()" which counts the number of iterations and stores
> it in a new field in the spinlock_t struct? something like:
>
> typedef struct {
> volatile unsigned int lock;
> volatile unsigned long count;
> } spinlock_t;
>
> #define spin_lock(x) \
> while (!spin_trylock(x)) (x)->count++;
>
> would i need to mask local interrupts when i'm doing this?
>
> naturally, this is only for experimentation.
>
> - Chuck Lever
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]