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.koz...@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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to