Chapter 31. Functions for Counters

This chapter contains reference information on routines for configuring values for Directory Server database and server statistics counters.

Table 31.1. Counter Routines

Function Description
slapi_counter_add() Adds a certain amount to the counter value.
slapi_counter_decrement() Decrements the counter and returns the new value.
slapi_counter_destroy() Destroys an existing counter.
slapi_counter_get_value() Gets the current value of the counter.
slapi_counter_increment() Increments the counter value and returns the new value.
slapi_counter_init() Initializes a new counter.
slapi_counter_new() Creates a new counter.
slapi_counter_set_value() Sets the counter to a new, specified value and returns the updated value.
slapi_counter_subtract() Subtracts a certain amount from the counter value.

31.1. slapi_counter_add()

Atomically adds a specified amount to the counter value.
By default, the counter increments up 1; using slapi_counter_add() allows the counter to increment by some other specified unit.
Syntax

#include "slapi-plugin.h"
PRUint64 slapi_counter_add(Slapi_Counter *counter, PRUint64 addvalue);

Parameters

This function takes the following parameters:

counter The counter to which to add the specified value.
addvalue The amount to add to the current counter value.
Returns

The function returns the value of the counter (the current count) after the counter has been incremented by the amount set in slapi_counter_add().