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
This commit is contained in:
Baptiste Daroussin 2017-08-30 07:58:33 +00:00
parent b53b978a6c
commit 1caaf3ea4f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323016

View File

@ -422,14 +422,13 @@ 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)
usage();