giveGraphData

Name

giveGraphData -- Send graph data to RSPD.

Synopsis

$err = $mod->giveGraphData($graphData);

Description

This function copies the address of graphData to an internal structure. When postMessage() is called, the a copy of the data given will be sent to the RSPD. The graphReturnData object of which $graphData must be a type contains three elements, for graph type, graph key name, and graph data. The object is defined as follows:

$graph_data = new rspmod::RSP_graphReturnData($type, $key, $data);
				

All three elements should be set. giveGraphData() can be called as many times as you like, for each different piece of graph data. $type can be any of the following values:

The reason for having different data types is that when graph data is saved an analyzed in the future, conversions can be made on types that are known. This makes graphs easier to read and avoids unusually large or small numbers (for example, bytes in the millions, where megabytes would make more sense). In cases where data is of a type not defined above, use the type GRAPH_MISC. The data will still be saved, but conversions in the future will not be possible.

Note that when one of the predefined types is being used, often the convert functions can be useful. They can, for example, take a string like "10 MB" and convert it into the appropriate number of bytes as a string. This could then be passed directly into a graphReturnData structure. There is a convert function for each time above. Please refer to them for more information.

Returns

This function returns -1 if an error occurred, and 0 otherwise. In case of error, the program will croak() with an appriopriate message.