From: <Ric...@ba...> - 2006-07-24 09:07:38
|
Guys, the code below is in the cygwin and linux metric.c files. -------------------------------------------------------- typedef struct { =20 uint32_t last_read; =20 uint32_t thresh; =20 char *name; =20 char buffer[BUFFSIZE]; } timely_file; timely_file proc_stat =3D { 0, 15, "/proc/stat" }; timely_file proc_loadavg =3D { 0, 15, "/proc/loadavg" }; timely_file proc_meminfo =3D { 0, 30, "/proc/meminfo" }; timely_file proc_net_dev =3D { 0, 30, "/proc/net/dev" }; char *update_file(timely_file *tf) { =20 int now,rval; =20 now =3D time(0); =20 if(now - tf->last_read > tf->thresh) { =20 rval =3D slurpfile(tf->name, tf->buffer, BUFFSIZE); =20 if(rval =3D=3D SYNAPSE_FAILURE) { =20 err_msg("update_file() got an error from slurpfile() reading %s",= =20 tf->name); =20 return (char *)SYNAPSE_FAILURE; =20 } =20 else tf->last_read =3D now; =20 } =20 return tf->buffer; } -------------------------------------------------------- In my ganglia setup I have a small number of metrics polled often (5-10 seconds) on a large number of host (4,000!). I have already observed that values did not seem to change that fast, but have only now found the above code. I obviously can't poll fast with the above code. Given that metrics are measured only at the rate defined by their poll time, what is the point of the above code? Is it to ensure that when (say) cpu_user, cpu_sys, cpu_wio etc are measured, the /proc file is only opened once? Also it seems the delay between /proc file reads is the delay above, plus the poll delay of the metric. It this true? I measured this, but did not trace through the code source to confirm. So Matt (or a similar guru), can you let me know the intent of this code? kind regards, Richard G ------------------------------------------------------------------------ For more information about Barclays Capital, please visit our web site at= =20http://www.barcap.com. Internet communications are not secure and therefore the Barclays Group d= oes not accept legal responsibility for the contents of this message. Al= though the Barclays Group operates anti-virus programmes, it does not acc= ept responsibility for any damage whatsoever that is caused by viruses be= ing passed. Any views or opinions presented are solely those of the auth= or and do not necessarily represent those of the Barclays Group. Replies= =20to this email may be monitored by the Barclays Group for operational o= r business reasons. ------------------------------------------------------------------------ |