From owner-freebsd-performance@FreeBSD.ORG Wed Jul 16 16:23:17 2003 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDF9237B401 for ; Wed, 16 Jul 2003 16:23:17 -0700 (PDT) Received: from mta1.lbl.gov (mta1.lbl.gov [128.3.41.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 277CD43F85 for ; Wed, 16 Jul 2003 16:23:17 -0700 (PDT) (envelope-from j_guojun@lbl.gov) Received: from mta1.lbl.gov (localhost [127.0.0.1]) by mta1.lbl.gov (8.12.9/8.12.9) with ESMTP id h6GNN9lu022621 for ; Wed, 16 Jul 2003 16:23:14 -0700 (PDT) Received: from lbl.gov (gracie.lbl.gov [131.243.2.175]) by mta1.lbl.gov (8.12.9/8.12.9) with ESMTP id h6GNN43X022609; Wed, 16 Jul 2003 16:23:09 -0700 (PDT) Sender: jin@lbl.gov Message-ID: <3F15DE52.130D8FA9@lbl.gov> Date: Wed, 16 Jul 2003 16:22:58 -0700 From: "Jin Guojun [DSD]" X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.8-RELEASE i386) X-Accept-Language: zh, zh-CN, en MIME-Version: 1.0 To: Petri Helenius References: <3F15C584.38848DCE@lbl.gov> <071401c34be3$71a03510$812a40c1@PETEX31> <00b501c34be5$351a83f0$b3db87d4@vader> <075101c34be5$db5e4c10$812a40c1@PETEX31> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-performance@freebsd.org cc: Steven Hartland Subject: Re: timer counter chip access mystery] X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jul 2003 23:23:18 -0000 5.1 defaults to use ACPI-safe, which calls read_counter() at least three times. The total cost is 3098 ns. So, it meas that read_count() cost is about 1000 ns, which is close to what the Linux does. The rest question is how much error will be if not to use ACPI-safe? i.e., sysctl kern.timecounter.hardware=ACPI? -Jin /* * Fetch current time value from reliable hardware. */ static unsigned acpi_timer_get_timecount(struct timecounter *tc) { return (read_counter()); } /* * Fetch current time value from hardware that may not correctly * latch the counter. */ static unsigned acpi_timer_get_timecount_safe(struct timecounter *tc) { unsigned u1, u2, u3; u2 = read_counter(); u3 = read_counter(); do { u1 = u2; u2 = u3; u3 = read_counter(); } while (u1 > u2 || u2 > u3 || (u3 - u1) > 15); return (u2); } Petri Helenius wrote: > 5.x defaults to ACPI or TSC timers. So your wish has been transported > by a timemachine into the past. > > With 4.x you have to set it manually. > > Pete > > ----- Original Message ----- > From: "Steven Hartland" > To: "Petri Helenius" ; "Jin Guojun [DSD]" ; > Sent: Thursday, July 17, 2003 12:57 AM > Subject: Re: timer counter chip access mystery] > > > If this could be changed / fixed it would have a marked performance increase > > for all game server code which use this function heavily from what I've seen > > and would explain the sometimes huge performance differential between > > FreeBSD and Linux. > > > > Steve / K > > ----- Original Message ----- > > From: "Petri Helenius" > > To: "Jin Guojun [DSD]" ; > > Sent: Wednesday, July 16, 2003 10:44 PM > > Subject: Re: timer counter chip access mystery] > > > > > > > > > > This access happens over ISA bus and thus happens at the speed the bus > > > operates at. Use TSC or ACPI for faster gettimeofday. > > > > > > Pete