From owner-svn-src-all@FreeBSD.ORG Sat Jan 24 10:22:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 099BB1065688; Sat, 24 Jan 2009 10:22:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBC7A8FC21; Sat, 24 Jan 2009 10:22:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0OAMnPB069234; Sat, 24 Jan 2009 10:22:49 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0OAMntu069233; Sat, 24 Jan 2009 10:22:49 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200901241022.n0OAMntu069233@svn.freebsd.org> From: Robert Watson Date: Sat, 24 Jan 2009 10:22:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187664 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jan 2009 10:22:51 -0000 Author: rwatson Date: Sat Jan 24 10:22:49 2009 New Revision: 187664 URL: http://svn.freebsd.org/changeset/base/187664 Log: Add explicit static DTrace tracing to the callout mechanism, capturing pointers to the callout handler just before and just after the callout it invoked. I attempted to do this in a manner congruent to tracing in Solaris's callout mechanism, but couldn't quite use the same names due to convention and syntax differences. Example DTrace script to generate a distribution graph of callout execution times: callout_execute:::callout_start { self->cstart = timestamp; } callout_execute:::callout_end { @length = quantize(timestamp - self->cstart); } Reviewed by: jb MFC after: 3 days Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sat Jan 24 05:32:11 2009 (r187663) +++ head/sys/kern/kern_timeout.c Sat Jan 24 10:22:49 2009 (r187664) @@ -37,6 +37,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" + #include #include #include @@ -49,10 +51,19 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +SDT_PROVIDER_DEFINE(callout_execute); +SDT_PROBE_DEFINE(callout_execute, kernel, , callout_start); +SDT_PROBE_ARGTYPE(callout_execute, kernel, , callout_start, 0, + "struct callout *"); +SDT_PROBE_DEFINE(callout_execute, kernel, , callout_end); +SDT_PROBE_ARGTYPE(callout_execute, kernel, , callout_end, 0, + "struct callout *"); + static int avg_depth; SYSCTL_INT(_debug, OID_AUTO, to_avg_depth, CTLFLAG_RD, &avg_depth, 0, "Average number of items examined per softclock call. Units = 1/1000"); @@ -395,7 +406,11 @@ softclock(void *arg) binuptime(&bt1); #endif THREAD_NO_SLEEPING(); + SDT_PROBE(callout_execute, kernel, , + callout_start, c, 0, 0, 0, 0); c_func(c_arg); + SDT_PROBE(callout_execute, kernel, , + callout_end, c, 0, 0, 0, 0); THREAD_SLEEPING_OK(); #ifdef DIAGNOSTIC binuptime(&bt2);