[rrd-developers] Patch to get more metadata out of 'rrdtool graph'
Tobias Oetiker
tobi at oetiker.ch
Mon Nov 26 22:40:29 CET 2007
Today Mark Plaksin wrote:
> Tobias Oetiker <tobi at oetiker.ch> writes:
>
> > Hi Mark,
>
> Hi again:
>
> Sorry (again!) for the long delay.
>
> > Congratulations. This is looking much better ...
> >
> > there are a few things though ...
> >
> > a) instead of looking at grinfoh to be NULL, info_push could look
> > at grinfoc to be NULL and NOT push.
>
> You mean grinfo_push instead of info_push, right? In any case I don't
> understand you. Are you trying to eliminate one of the arguments that
> has to be passed to grinfo?
>
> It seems like the "is this the first item in the list" logic has to
> either be in grinfo_push or in every function that calls grinfo_push.
> In my patch grinfo_push is called in graph_paint and
> graph_size_location. If more graph info is pushed at some point it
> might be in other function(s). So I thought it was better to put the
> first time logic in grinfo_push itself.
I am trying to save you from carrying TWO variables all through your
code (grinfoc and grinfoh) this is not beautiful one variable should
be enough. You might even want to add it to image_desc and take
it out only at the very end ... since image_desc is already being
carried through all the functions ...
>
> > b) you added an additional parameter to the default rrd_graph call
> > this will break existing code. Use a NEW rrd_graph call which
> > adds this additional parameter. (similar to
> > rrd_graph_in_memory).And create a wrapper for this function with
> > the old name, keeping the old interface and capabilities.
>
> Maybe I'm dense because I don't follow this either :) I understand not
> wanting to break existing code but I'm not sure exactly what you're
> suggesting. My gut wants to add an optional argument to rrd_graph so
> that old code continues to work but maybe it's not that simple (I'm no C
> wizard as you probably guessed!).
>
> If I guess at what you mean here's what I come up with: You want
> HandleInputLine in main.c to call rrd_graph_in_memory. The existing
> rrd_graph function gets renamed to rrd_graph_tobi and I add my argument
> to it. A new rrd_graph function gets created which has the same
> arguments as rrd_graph_tobi and does nothing more than call
> rrd_graph_tobi with something special in place of my argument so no
> grinfo_push calls are made. And rrd_graph_in_memory also gets my extra
> parameter and calls rrd_graph_tobi. But that sounds crazy so I don't
> think I've understood you.
you add the 'info_t **' to the rrd_graph call. since there are
normally no optional arguments in C, this will break all code that
does not put that argument there when calling rrd_graph ... so
instead of doing that you create
rrd_graph_info with this new argument list and make rrd_graph a
wrapper for that function using the old argument list sustituting
info_t ** for null and detecting that in the rrd_graph_info
command.
all code that wants to use the new functionality can now be
switched to rrd_graph_info while old code can continue to use
rrd_graph.
> Thanks for your patience!
>
> _______________________________________________
> rrd-developers mailing list
> rrd-developers at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
>
>
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten
http://it.oetiker.ch tobi at oetiker.ch ++41 62 213 9902
More information about the rrd-developers
mailing list