[okl4-developer] OKL4 : How can I get time?
Martin P. Lawitzky
martin.lawitzky at nicta.com.au
Fri Apr 25 18:33:15 EST 2008
Hi,
inside the kernel the scheduler has a current time. Outside the kernel
without using the Iguana vtimer, you will have to map the timer
interrupt register and timer match registers to the space where you want
to implement you own timer. The roottask can do this.
This is what the Iguana vtimer does.
Depending on the architecture you might need to be careful here, not to
overwrite the timer settings used by the scheduler. If you accidentally
remove the timer interrupt of the scheduler, your tasks will never be
preempted anymore. So this is a potential security issue and these
registers shouldn't be mapped to arbitrary tasks.
Using cycle counters works only in privileged mode on some
architectures, so you would need to implement a syscall for this which
likely screws up your timing anyway.
So, do you need the time inside the kernel or in userland?
Cheers,
Martin
On Fri, 2008-04-25 at 10:12 +0200, Antonin SUBTIL wrote:
> Hello,
>
> Does someone know how to get the time on OKL4 ? (without OKLinux, and
> if possible without any special Iguana server). (The scheduler might
> be usefull with time_slice... yet it's someway.. ugly)
> I'm working on some basic stuff, and I was used to take the time from
> CPU registers with some asm code and doing my own stuff to get time
> (mostly about delays)
>
> Thanks
>
> --
> Antonin Subtil,
> 35 rue Donissan
> FR-33000 Bordeaux
> +33 (0)6.77.40.17.69
>
> Economisez du papier, limitez votre production de déchets : n'imprimez
> ce message que si nécessaire (et... en recto-verso) !
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
More information about the Developer
mailing list