hist_bufsize

hist_bufsize — sets the history buffer size.

Syntax

hist_bufsize (hist_task, history[, numvalues])
    

Parameters

hist_task

The task object corresponding to the Cascade Historian. See locate_task in the Gamma manual.

history

The name of the history to be queried or modified.

numvalues

The new maximum number of value/time (or y/x) pairs that can be buffered for this history. If not specified, or is 0, then the function is treated as a query, the buffer size is not modified and the current value is returned.

Returns

The current size of the history buffer, if the function completed successfully. Otherwise returns nil and sets _last_error_ to the error string returned by the Cascade Historian.

Description

This function sets the number of data values that will be buffered for the specified history. (There are actually up to twice this number stored at any time, as the Cascade Historian double-buffers its data storage.) When a buffer is full, the data is flushed to disk, as long as an associated file has been assigned (with filebase or HI_FileBase). A larger buffer will retain more data in memory and increase the speed of queries on that data if it is within the range of the data in the buffer.

The history data is flushed to disk whenever this function is called. Until this function is used, the history buffer size is set to the initial default value (100).

This function corresponds to the bufsize command, and the Cogent C API function HI_Bufsize.

Example