From owner-freebsd-hackers Mon Oct 16 15:13:47 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id PAA24312 for hackers-outgoing; Mon, 16 Oct 1995 15:13:47 -0700 Received: from aslan.cdrom.com (aslan.cdrom.com [192.216.223.142]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id PAA24307 for ; Mon, 16 Oct 1995 15:13:45 -0700 Received: from localhost.cdrom.com (localhost.cdrom.com [127.0.0.1]) by aslan.cdrom.com (8.6.12/8.6.9) with SMTP id PAA19607; Mon, 16 Oct 1995 15:13:24 -0700 Message-Id: <199510162213.PAA19607@aslan.cdrom.com> X-Authentication-Warning: aslan.cdrom.com: Host localhost.cdrom.com didn't use HELO protocol To: Olof Johansson cc: "Justin T. Gibbs" , hackers@freebsd.org Subject: Re: wtmp efficiency In-reply-to: Your message of "Mon, 16 Oct 1995 22:54:04 BST." <199510162154.WAA08655@dawnrazor.campus.luth.se> Date: Mon, 16 Oct 1995 15:13:23 -0700 From: "Justin T. Gibbs" Sender: owner-hackers@freebsd.org Precedence: bulk >I've found (and fixed) the problem. > >It's the fact that ftp and uucp connections get 'ftp' or 'uucp' + pid as >tty_line in wtmp. The pid isn't removed when looking up the tty, so the list >gets bigger and bigger. >For 'ftp-only' wtmp files the time for parsing the file is proportional to >n^2, where n is the number of entries in the file... >(I have an exam on data structures and algorithms next week *grin*). Well you've put a finger on the problem, but your patch breaks last for "last ftp" or "last uucp". A better solution is to only add entries to the tty list that match our interest, and to remove entries from the tty list once we find the matching login time. Since the tty records are small, bcopying the next record over the matched record and freeing the next record should make the removal easy. Care to do the honors? -- Justin T. Gibbs =========================================== Software Developer - Walnut Creek CDROM FreeBSD: Turning PCs into workstations ===========================================