[rrd-users] strange r_graph problem - Segmentation fault without cout-output
guest01
guest01 at gmail.com
Mon May 1 21:48:07 MEST 2006
Hi!
I have a very strange problem regarding the r_graph function of rrdtool 1.2.11.
I have to generate a rrd-graphic, but it behavior is very very strange
... I wrote following function:
int cmm_graph_rrdfile(char archivename[255], char outputname[255]) {
char *r_graph[21];
char def[1][255];
char ***calcpr;
FILE* stream;
int xsize,ysize,i;
double ymin,ymax;
sprintf(def[0],"DEF:myspeed=%s.rrd:speed:AVERAGE",archivename);
r_graph[0]="graph";
r_graph[1]=outputname;
r_graph[2]="--start";
r_graph[3]="920804400";
r_graph[4]="--end";
r_graph[5]="920808000";
r_graph[6]="--height";
r_graph[7]="500";
r_graph[8]="--width";
r_graph[9]="1500";
r_graph[10]="--vertical-label";
r_graph[11]="km/h";
r_graph[12]=def[0];
r_graph[13]="CDEF:kmh=myspeed,3600,*";
r_graph[14]="CDEF:fast=kmh,100,GT,kmh,0,IF";
r_graph[15]="CDEF:over=kmh,100,GT,kmh,100,-,0,IF";
r_graph[16]="CDEF:good=kmh,100,GT,0,kmh,IF";
r_graph[17]="HRULE:100#0000FF:Maximumallowed";
r_graph[18]="AREA:good#00FF00:Goodspeed";
r_graph[19]="AREA:fast#550000:Toofast";
r_graph[20]="STACK:over#FF0000:Overspeed";
/*for (i = 0;i<21;i++) {
cout << i << ": " << r_graph[i] << endl;
}*/
if (rrd_graph(20,r_graph,calcpr,&xsize,&ysize,stream,&ymin,&ymax)!=-1) {
cout << "Done generating graphic ... " << endl;
return 0;
}else {
cout << "Problem generating graphic ... " << endl;
return -1;
}
}
If I use this function, I get a "Segmentation fault".
If I comment in the following part of the function:
for (i = 0;i<21;i++) {
cout << i << ": " << r_graph[i] << endl;
}
the function works -> "Done generating graphic ..."
So, in my opinion, this is a very strange behavior which I totally
cannot understand ... Please can someone explain to me how a simple
stdout-command can affect that??
Thanxs!
By the way, wtf do I need the last 6 parameters
(calcpr,&xsize,&ysize,stream,&ymin,&ymax) from rrd_graph? There is no
documentation or anything similar ...
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://lists.ee.ethz.ch/rrd-users
WebAdmin http://lists.ee.ethz.ch/lsg2.cgi
More information about the rrd-users
mailing list