tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Another kvm user can go away?



On Fri, 30 Dec 2016, Paul Goyette wrote:

I have managed to provide access to all of the kernel history data via sysctl, and I've come up with a modified version of vmstat(1) that can read the data from sysctl rather than having to use kvm.

Diffs for sys/sys/kernhist.h and sys/kern/kern_history.c can be found at www.netbsd.org/~pgoyette/my_vmstat/kernhist.diffs In the same directory you can find a source file my_vmstat.c (and its associated Makefile).

Please review and comment (preferably constructively), and let me know what more needs to be done before it gets committed.

Thanks to Simon, Christos, and Taylor for their reviews. I've taken (most of) their suggestions and revised the changes slightly. Newer version has been uploaded to the www.netbsd.org/~pgoyette/my_vmstat/ directory.

Changes from previous version:

1. Remove the mutex, the kern_history_new flag/counter, and membar()

2. Use a 'struct timespec' for the export structure - allows for
   better alignment control...

3. Removed some debugging code.

4. Changed the type of xlate_c from int to size_t, and updated the
   {add,find}_string() function signatures accordingly.

5. kernhist_dumpmask() changed arg spec from u_int32_t --> uint32_t
   (even though this is otherwise unaffected by my changes)

Remaining issues:

1. Investigate alternatives to the sequential searching through the
   string addr-->offset translation table.

2. Possible replacement of 'struct timeval' with 'struct timespec'
   in the history records,  use of nanotime() vs microtime() to
   load the value, and changing format strings to "%09ld" in both
   kernel and vmstat.c printf() calls.

3. Updating of sysctl(7) man page to mention the new sysctl nodes.


Further comments and suggestions are welcomed.



+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+


Home | Main Index | Thread Index | Old Index