From owner-p4-projects@FreeBSD.ORG Wed Jun 7 00:27:25 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B878216CFA4; Wed, 7 Jun 2006 00:08:55 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 43F3616ABA6 for ; Tue, 6 Jun 2006 23:28:29 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 087D343D46 for ; Tue, 6 Jun 2006 23:28:29 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k56NQcft042484 for ; Tue, 6 Jun 2006 23:26:38 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k56NQc2l042481 for perforce@freebsd.org; Tue, 6 Jun 2006 23:26:38 GMT (envelope-from jb@freebsd.org) Date: Tue, 6 Jun 2006 23:26:38 GMT Message-Id: <200606062326.k56NQc2l042481@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 98706 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jun 2006 00:27:25 -0000 http://perforce.freebsd.org/chv.cgi?CH=98706 Change 98706 by jb@jb_freebsd2 on 2006/06/06 23:26:23 Add DTrace's wallclock high resolution time function and remove the uptime one which belongs in the machine dependent code. The diff for this change makes the change look more complicated than it really is. It's one function removed and one added. No others are changed. Affected files ... .. //depot/projects/dtrace/src/sys/kern/kern_tc.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/kern/kern_tc.c#3 (text+ko) ==== @@ -289,47 +289,38 @@ } while (gen == 0 || gen != th->th_generation); } -void -getmicrotime(struct timeval *tvp) +#ifdef KDTRACE +uint64_t +dtrace_gethrestime() { struct timehands *th; u_int gen; + uint64_t hrt; - ngetmicrotime++; do { th = timehands; gen = th->th_generation; - *tvp = th->th_microtime; + hrt = ((uint64_t) th->th_nanotime.tv_sec * 1000000000) + + th->th_nanotime.tv_nsec; } while (gen == 0 || gen != th->th_generation); + + return (hrt); } +#endif -/* - * DTrace needs a high resolution time function which can - * be called from a probe context and guaranteed not to have - * instrumented with probes itself. It avoids instrumenting - * functions with the 'dtrace_' prefix. - * - * The 'high resolution' time is actually nanoseconds uptime. - */ -#ifdef KDTRACE -uint64_t -dtrace_gethrtime() +void +getmicrotime(struct timeval *tvp) { struct timehands *th; u_int gen; - uint64_t hrt; + ngetmicrotime++; do { th = timehands; gen = th->th_generation; - - hrt = th->th_offset.sec * (uint64_t)1000000000 + - (((uint64_t)1000000000 * (uint32_t)(th->th_offset.frac >> 32)) >> 32); + *tvp = th->th_microtime; } while (gen == 0 || gen != th->th_generation); - - return (hrt); } -#endif /* * Initialize a new timecounter and possibly use it.