Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Aug 2017 07:58:34 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323016 - head/usr.bin/netstat
Message-ID:  <201708300758.v7U7wY5C002800@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Aug 30 07:58:33 2017
New Revision: 323016
URL: https://svnweb.freebsd.org/changeset/base/323016

Log:
  Don't call kresolv_list() if using netstat on live kernel
  
  kresolve_list() is calling many kldsym(2). Removing that call on when collecting
  stats for the running kernel improves the startup time and CPU usage.
  
  Submitted by:	Nikita Kozlov (nikita.kozlov@blade-group.com)
  Reviewed by:	cem
  MFC after:	2 weeks
  Sponsored by:	blade
  Differential Revision:	https://reviews.freebsd.org/D12151

Modified:
  head/usr.bin/netstat/main.c

Modified: head/usr.bin/netstat/main.c
==============================================================================
--- head/usr.bin/netstat/main.c	Wed Aug 30 07:30:06 2017	(r323015)
+++ head/usr.bin/netstat/main.c	Wed Aug 30 07:58:33 2017	(r323016)
@@ -422,13 +422,12 @@ main(int argc, char *argv[])
 	if (!live) {
 		if (setgid(getgid()) != 0)
 			xo_err(-1, "setgid");
+		/* Load all necessary kvm symbols */
+		kresolve_list(nl);
 	}
 
 	if (xflag && Tflag)
 		xo_errx(1, "-x and -T are incompatible, pick one.");
-
-	/* Load all necessary kvm symbols */
-	kresolve_list(nl);
 
 	if (Bflag) {
 		if (!live)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708300758.v7U7wY5C002800>