diff -durpN 21.4.3-orig/src/event-stream.c 21.4.3/src/event-stream.c
--- 21.4.3-orig/src/event-stream.c	Wed Jul  4 16:23:56 2001
+++ 21.4.3/src/event-stream.c	Mon Jul 23 17:09:41 2001
@@ -180,6 +180,10 @@ Lisp_Object Vthis_command;
    last-command-properties for the next command. */
 Lisp_Object Vthis_command_properties;
 
+/* The number of complete key sequences processed so far in this XEmacs
+   session.  */
+int Vnum_input_keys;
+
 /* The value of point when the last command was executed.  */
 Bufpos last_point_position;
 
@@ -3942,6 +3946,8 @@ execute_command_event (struct command_bu
 	Vlast_command_properties = Vthis_command_properties;
 	Vthis_command_properties = Qnil;
 
+        Vnum_input_keys++;
+
 	/* Emacs 18 doesn't unconditionally clear the echoed keystrokes,
 	   so we don't either */
 
@@ -4720,6 +4726,11 @@ with pre/post-command hooks, subsequent 
 in preference to looking at and/or setting `this-command'.
 */ );
   Vthis_command_properties = Qnil;
+
+  DEFVAR_INT ("num-input-keys", &Vnum_input_keys /*
+Number of complete key sequences processed so far in this XEmacs session.
+*/ );
+Vnum_input_keys = 0;
 
   DEFVAR_LISP ("help-char", &Vhelp_char /*
 Character to recognize as meaning Help.