git: kernel - Add a sampling history mechanism called kcollect

Matthew Dillon dillon at
Fri Jul 28 23:47:54 PDT 2017

commit f6aeec64f90d6f78631ca1b951202ca79c08ab2f
Author: Matthew Dillon <dillon at>
Date:   Fri Jul 28 23:36:07 2017 -0700

    kernel - Add a sampling history mechanism called kcollect
    * Add a kernel API which automatically samples useful statistics on a
      10-second period without needing a user program to poll it.  This API
      is enabled by default and can be disabled by setting kern.collect_samples=0
      in /boot/loader.conf (or setting it higher, if desired).
      The idea is for the kernel to always collect a solid amount of historical
      data for various useful statistics such that a user can pull it all up
      going back upwards of 23 hours (or more, depending on configured samples)
      after the fact.  "Oh, what happened recently"... bang.
    * The sysctl provides sufficient information to userland to be able to
      process the statistics dynamically, without necessarily having to know
      what they are.
      The sysctl can be cut short to request less data for ongoing incremental
      collection, if desired.
    * Implement "load" collection to start with as a test.  Add #defines for
      everything I want the kernel to collect.  The kernel API's critical path
      is lockless.
    * Start working on a front-end user program called 'kcollect'.  This program
      will eventually generate fancy graphs via gnuplot and have a dbm interface
      for collecting data continuously if desired.

Summary of changes:
 sys/conf/files              |   1 +
 sys/kern/kern_collect.c     | 270 ++++++++++++++++++++++++++++++++++++++++++++
 sys/kern/kern_synch.c       |  13 ++-
 sys/sys/kcollect.h          |  81 +++++++++++++
 usr.bin/kcollect/Makefile   |   5 +
 usr.bin/kcollect/kcollect.c | 114 +++++++++++++++++++
 6 files changed, 483 insertions(+), 1 deletion(-)
 create mode 100644 sys/kern/kern_collect.c
 create mode 100644 sys/sys/kcollect.h
 create mode 100644 usr.bin/kcollect/Makefile
 create mode 100644 usr.bin/kcollect/kcollect.c

DragonFly BSD source repository

More information about the Commits mailing list