Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 beta 3/9/83; site uthub.UUCP
Path: utzoo!utcsrgv!utai!uthub!thomson
From: thomson@uthub.UUCP (Brian Thomson)
Newsgroups: net.bugs.4bsd,net.unix-wizards
Subject: ptcread() throughput sextupling
Message-ID: <168@uthub.UUCP>
Date: Tue, 19-Jun-84 10:42:42 EDT
Article-I.D.: uthub.168
Posted: Tue Jun 19 10:42:42 1984
Date-Received: Tue, 19-Jun-84 14:26:50 EDT
Organization: CSRG, University of Toronto
Lines: 110
Index: /sys/sys/tty_pty.c 4.2BSD Fix
Description:
Oink oink!
That is the sound that data makes as it travels through
4.2BSD's pseudo-tty driver. Even in the high-volume
direction (slave to controller) there is a great deal
of code executed per-character. On our otherwise idle 750 I
measured the maximum pty throughput at 5K chars/sec.;
after applying the following mods it reached 30K chars/sec.
If your machine is often accessed through rlogin(1c) this
can mean considerable savings in system-state CPU time.
Repeat-By:
Run this program and use iostat(1) to see what your character
rate is.
#include
char buf[1024];
int wsize = 1024;
main()
{
int csock, dsock, i;
for(i=0 ; it_outq.c_cc && uio->uio_resid > 0)
if (ureadc(getc(&tp->t_outq), uio) < 0) {
error = EFAULT;
break;
}
to be
while(uio->uio_resid > 0 && error == 0) {
int cc = q_to_b(&tp->t_outq, ptc_rdbuf, MIN(uio->uio_resid, BUFSIZ));
if(cc == 0)
break;
error = uiomove(ptc_rdbuf, cc, UIO_READ, uio);
}
We have been using this code for 4 months.
You may not experience quite as great an improvement as we did,
because we also improved the performance of q_to_b().
--
Brian Thomson, CSRG Univ. of Toronto
{linus,ihnp4,uw-beaver,floyd,utzoo}!utcsrgv!uthub!thomson