Messages in this thread |  | | | From | Borislav Deianov <> | | Date | Thu, 9 Mar 2000 20:20:35 +0100 | | Subject | Re: [PATCH] Use of TSC with SMP and different CPU's |
| |
In article <38C7D657.D6E2FA0A@home.com> you wrote: > Perhaps a better solution would be to get tsc's of all cpu's at the > interrupt. > But how do I do that, i.e. how to to read tsc of another processor? I > asked this question many times, but the only answer I got is that I > don't wanna do it, and I really do.
-8<------------------------ struct cycles_struct { int cpu; cycles_t cycles; }; void local_get_cycles(void *ptr) { struct cycles_struct *data = (struct cycles_struct *)ptr; if (data->cpu == smp_processor_id()) data->cycles = get_cycles(); } static inline cycles_t smp_get_cycles(int cpu) { struct cycles_struct data = { cpu }; if (cpu == smp_processor_id()) return get_cycles(); smp_call_function(&local_get_cycles, &data, 0, 1);
return data.cycles; } -8<------------------------ This takes about 21msec on my dual PIII-550. Note that smp_call_function is supposed to be portable but currently only exists on alpha, i386 and ia64.
One question (I haven't looked at your patch): can it deal gracefully with suspending the machine, turning it off, then resuming? I don't think that you can do that yet on SMP but I hope that you soon will (ACPI or the software suspend patch).
Regards, Borislav
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
|  |