If you want a program to hold back processes from using the serial port when traffic is already busy, see waitforbw included. The logfile may be provided to record the line activity. Additional information is stored in the logfile. If serialmon is not running, or the line is down, it will return an error code. This may be used in other scripts to regulate line usage, simply put a call to waitforbw just before any process attempts to access a remote site which uses the serial line specified.
Options allow the rate threshold and minimum interval between signalling queued processes.
Use the -h flag for details. I use gcc v2.7.2.3, with libc-5.4.44. This is the traditional method, and if you already use serialmon 0.23, you will have done it. The kernel patches allow serialmon to obtain the number of characters transmitted and received, together with a time stamp and the number of processes with the device open in one ioctl call. These kernel patches are for i386 architecture only.