1
/* $Id: main.c 1791 2009-04-14 13:55:29Z oetiker $
1
/* $Id: main.c 2022 2010-02-16 13:04:18Z oetiker $
2
2
* Substantial penalty for early withdrawal.
7
8
#include "../../src/rrd_tool.h"
9
10
typedef struct string_arr_t {
138
144
return rrd_call(rrd_update, args);
147
VALUE rb_rrd_flushcached(
151
return rrd_call(rrd_flushcached, args);
142
155
/* Calls Returning Data via the Info Interface */
144
157
VALUE rb_rrd_infocall(
174
188
rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
191
rb_hash_aset(result, key, INT2FIX(data->value.u_int));
177
194
rb_hash_aset(result, key,
178
rb_str_new(data->value.u_blo.ptr,
195
rb_str_new((char *)data->value.u_blo.ptr,
179
196
data->value.u_blo.size));
303
320
return rb_funcall(rb_cTime, rb_intern("at"), 1, UINT2NUM(last));
328
unsigned long i, j, k, step, col_cnt;
332
VALUE legend, result, rdata;
335
a = string_arr_new(args);
336
rrd_xport(a.len, a.strings, &xxsize, &start, &end, &step, &col_cnt, &legend_v, &data);
337
string_arr_delete(a);
341
legend = rb_ary_new();
342
for (i = 0; i < col_cnt; i++) {
343
rb_ary_push(legend, rb_str_new2(legend_v[i]));
349
rdata = rb_ary_new();
350
for (i = start; i <= end; i += step) {
351
VALUE line = rb_ary_new2(col_cnt);
352
for (j = 0; j < col_cnt; j++) {
353
rb_ary_store(line, j, rb_float_new(data[k]));
356
rb_ary_push(rdata, line);
360
result = rb_ary_new2(6);
361
rb_ary_store(result, 0, INT2FIX(start));
362
rb_ary_store(result, 1, INT2FIX(end));
363
rb_ary_store(result, 2, INT2FIX(step));
364
rb_ary_store(result, 3, INT2FIX(col_cnt));
365
rb_ary_store(result, 4, legend);
366
rb_ary_store(result, 5, rdata);
318
382
rb_define_module_function(mRRD, "restore", rb_rrd_restore, -2);
319
383
rb_define_module_function(mRRD, "tune", rb_rrd_tune, -2);
320
384
rb_define_module_function(mRRD, "update", rb_rrd_update, -2);
385
rb_define_module_function(mRRD, "flushcached", rb_rrd_flushcached, -2);
321
386
rb_define_module_function(mRRD, "info", rb_rrd_info, -2);
322
387
rb_define_module_function(mRRD, "updatev", rb_rrd_updatev, -2);
323
388
rb_define_module_function(mRRD, "graphv", rb_rrd_graphv, -2);
389
rb_define_module_function(mRRD, "xport", rb_rrd_xport, -2);