[net.unix] How do I count lines transmitted?

dave@utcsrgv.UUCP (Dave Sherman) (11/13/83)

I have a need to count the number of lines transmitted in both
directions between the computer and the user during a CAI session.
(I am trying to figure out how many kilopackets will be involved when
we put our system on Datapac.)

What is an easy way to count the number of times CR is transmitted
in the session? I don't want to start modifying my applications code
to do the counting, because there are numerous source files, all of
which do I/O in various ways to talk to the user. Everything uses stdio,
though.

I can think of two places to do the counting, although I'm not quite sure
how I'd go about it:
	1. Hack stdio to flag every \n going by and increment a global
	   counter. Is this relatively trivial? Presumably I'd want
	   a different counter for each open "FILE".
	2. Hack the terminal driver to count the entire user session
	   beginning with "login". This is really what I want to measure,
	   although the login stuff is inconsequential in terms of the
	   total volume of data. I'm not sure how I'd specify when to start
	   and stop counting, and how to record the total in some useful
	   place, anyway.

Before I charge in and attack stdio, has anyone done this kind of thing
before? Can anyone suggest a better way? I'm running v7 on a PDP-11/23.

I only need the information over a short period of time, so any changes
I make have to be easily undoable. (Obviously, a second copy of stdio
is no problem.)

Thanks in advance for any ideas.

Dave Sherman
The Law Society of Upper Canada
Toronto
(416) 947 3466
-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave