From owner-svn-src-head@freebsd.org Thu Dec 5 04:52:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC7631BAB1A; Thu, 5 Dec 2019 04:52:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47T3H84Dsdz3Gx4; Thu, 5 Dec 2019 04:52:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74D7BB9B6; Thu, 5 Dec 2019 04:52:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB54qKw5080127; Thu, 5 Dec 2019 04:52:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB54qKV0080126; Thu, 5 Dec 2019 04:52:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912050452.xB54qKV0080126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 5 Dec 2019 04:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355412 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 04:52:20 -0000 Author: mav Date: Thu Dec 5 04:52:19 2019 New Revision: 355412 URL: https://svnweb.freebsd.org/changeset/base/355412 Log: Wrap g_trace() into a macro to avoid unneeded calls. In most cases with debug disabled this function does nothing, but argument passing and the call still cost measurable time due to cache misses, etc. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom.h head/sys/geom/geom_dump.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom.h Thu Dec 5 04:52:19 2019 (r355412) @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ -void g_trace(int level, const char *, ...); +void (g_trace)(int level, const char *, ...) __printflike(2, 3); # define G_T_TOPOLOGY 1 # define G_T_BIO 2 # define G_T_ACCESS 4 - +extern int g_debugflags; +#define g_trace(level, fmt, ...) do { \ + if (__predict_false(g_debugflags & (level))) \ + (g_trace)(level, fmt, ## __VA_ARGS__); \ +} while (0) /* geom_event.c */ typedef void g_event_t(void *, int flag); Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 (r355412) @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) } void -g_trace(int level, const char *fmt, ...) +(g_trace)(int level, const char *fmt, ...) { va_list ap;