Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Thursday, June 13, 2019

kstat2_hist_add_value (9F)


kstat2_hist_add_value - create and initialize a new kstat whose data represents a histogram


#include <sys/types.h>
#include <sys/kstat2.h>

void kstat2_hist_add_value(kstat2_t *ksp2, uint64_t value);

Interface Level

Solaris DDI specific (Solaris DDI)



A kstat created by kstat2_create_histogram() function. For more information, see kstat2_create_histogram(9F)


The value to be added to the histogram.


kstat2_hist_add_value() function is used to add data to a histogram kstat.

The function first determines the bucket into which the supplied value will go. If the bucket already exists, its value is incremented by 1. If the bucket does not exist it is created along with any earlier buckets required from the histogram's range_min.

Return Values

No value is returned.


The kstat2_hist_add_value() function can be called from user or kernel context.

See Also

kstat2_create_histogram(9F), kstat2_hold_bykid(9F), kstat2_rele(9F)


In order to minimize latency, the kstat2_hist_add_value() function does not attempt to obtain the lock of the passed-in kstat. If kstat is deleted by another thread while a thread is in kstat2_hist_add_value() function, the caller must lock the kstat using the kstat2_hold_bykid() function prior to calling the kstat2_hist_add_value() function, and release it with the kstat2_rele() function later.