I'm working on some stuff in keyboard.c that is timing sensitive
right now. What I want to do is keep track of the elapsed time
between to successive calls to handle_scancode().
How exactly would I do this? I've snooped around here and there,
and it appears that something like:
static unsigned keyb_oldtimer, keyb_newtimer;
...
blah handle_scancode(lkdsfsjdfljfas)
{
blah blah
keyb_oldtimer = keyb_newtimer;
keyb_newtimer = gettimeofday();
blah blah
blah blah
my code that deals with the difference in time between
the two values
}
I'm wanting to time the difference in time between a certain
keystroke's make code being received and the break code for
comparison and timing reasons. I've looked at kernel/time.c but
that just looks like userland stuff.
I've looked at linux/timer.h, and it looks like it might have
what I'm wanting. I'm not sure exactly how I'd use it though.
Basically, I'd have a code that detects a certain "keycode" make
event, and then allocates a timer for it with kmalloc()?
struct timer_list keyb_keytimer;
Then in the kbd_init code have:
add_timer(&keyb_keytimer);
init_timer(&keyb_keytimer);
Then inside handle_scancode have:
time_before(&keyb_keytimer); for to stamp the start time, and
time_after(&keyb_keytimer); for to stamp the end time?
Then to compute the difference?
I need to also reset a timer once it is done with so that it can
be used again next time the sequence occurs.
Please show me some simple sample code for this. I'd be
greatful. Forgive me if this is an obvious thing as I'm fairly
new to kernel programming, and my manual is Luke Sourcewalker.
TIA,
TTYL
-- Mike A. Harris Linux advocate Computer Consultant GNU advocate Capslock Consulting Open Source advocateSuspicious Anagram #4: Word: PRESIDENT CLINTON OF THE USA Anagram: TO COPULATE HE FINDS INTERNS
- 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/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:10 EST