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:
0 (GRAPH_NONE)
1 (GRAPH_TIME) - $data is a string containing a number representing seconds
2 (GRAPH_SMALLTIME) - $data is a string containing a number representing microseconds (millionths of a second)
3 (GRAPH_BIGSIZE) - $data is a string containing a number representing megabytes
4 (GRAPH_SMALLSIZE) - $data is a string containing a number representing bytes
5 (GRAPH_PERCENT) - $data is a string containing a floating point number between 0 and 1
6 (GRAPH_BOOL) - $data is "0" or "1"
7 (GRAPH_MISC) - $data is of a type not defined above
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.