{
struct timeval tv;
gettimeofday(&tv, 0);
- return tv.tv_sec + tv.tv_usec / 1000000.0;
+ return tv.tv_sec + (tv.tv_usec / 1000000.0);
}
FILE *open_file(const char *file, int *reported)
FILE *fp = fopen(file, "r");
if (!fp) {
if (!reported || *reported == 0) {
- CRIT_ERR("can't open %s: %s", file, strerror(errno));
+ ERR("can't open %s: %s", file, strerror(errno));
if (reported)
*reported = 1;
}
need_mask |= 1 << INFO_BUFFERS;
/* clear speeds and up status in case device was removed and doesn't get
- * updated */
+ updated */
for (i = 0; i < 16; i++) {
if (netstats[i].dev) {
if (NEED(INFO_NET))
update_net_stats();
+ if (NEED(INFO_DISKIO))
+ update_diskio();
+
if (NEED(INFO_WIFI))
update_wifi_stats();
if (NEED(INFO_MAIL))
update_mail_count();
- if (NEED(INFO_TOP))
- update_top();
+
+#if defined(__linux__)
+ if (NEED(INFO_I8K))
+ update_i8k();
+#endif /* __linux__ */
+
#ifdef MLDONKEY
if (NEED(INFO_MLDONKEY))
get_mldonkey_status(&mlconfig, &mlinfo);
update_mpd();
#endif
+#ifdef XMMS2
+ if (NEED(INFO_XMMS2))
+ update_xmms2();
+#endif
+
+#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
+ if (NEED(INFO_XMMS))
+ update_xmms();
+#endif
+#ifdef BMPX
+ if (NEED(INFO_BMPX))
+ update_bmpx();
+#endif
+
if (NEED(INFO_LOADAVG))
update_load_average();
- if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS)) &&
+
+ if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS) || NEED(INFO_TOP)) &&
current_update_time - last_meminfo_update > 6.9) {
update_meminfo();
- if (no_buffers)
+ if (no_buffers) {
info.mem -= info.bufmem;
+ }
last_meminfo_update = current_update_time;
}
+ if (NEED(INFO_TOP))
+ update_top();
+
/* update_fs_stat() won't do anything if there aren't fs -things */
if (NEED(INFO_FS) && current_update_time - last_fs_update > 12.9) {
update_fs_stats();
last_fs_update = current_update_time;
}
+#ifdef TCP_PORT_MONITOR
+ if (NEED(INFO_TCP_PORT_MONITOR))
+ update_tcp_port_monitor_collection( info.p_tcp_port_monitor_collection );
+#endif
+}
+
+int round_to_int(float f)
+{
+ int intval = (int)f;
+ double delta = f - intval;
+ if (!(delta < 0.5)) {
+ ++intval;
+ }
+
+ return intval;
}