--- motion.c 2005-10-18 11:57:20.000000000 -0500
+++ motion.c 2005-10-26 17:59:00.000000000 -0500
@@ -100,6 +100,9 @@
cnt->pipe=-1;
cnt->mpipe=-1;
+ cnt->total_diffs=0;
+ cnt->total_frames=0;
+
// /* Here are the pointers required to be set */
// #ifdef HAVE_MYSQL
// cnt->database=NULL;
@@ -1139,6 +1142,15 @@
motion_log(-1, 0, "%s", msg);
}
+
+ /***** MOTION LOOP - STATISTICS SECTION *****/
+
+ /* Tally diffs for statistics. */
+ cnt->total_diffs+=cnt->diffs;
+
+ /* Tally update count of total frames viewed. */
+ cnt->total_frames++;
+
/***** MOTION LOOP - SNAPSHOT FEATURE SECTION *****/
--- motion.h 2005-10-08 09:11:00.000000000 -0500
+++ motion.h 2005-10-26 17:54:45.000000000 -0500
@@ -289,6 +289,9 @@
int pause;
int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */
+ unsigned long total_diffs; /* for statistics, how many pixels different so far? */
+ unsigned long total_frames; /* for statistics, how many frames seen so far? */
+
#ifdef __freebsd__
int tuner_dev;
#endif
--- webhttpd.c 2005-10-08 09:11:00.000000000 -0500
+++ webhttpd.c 2005-10-26 17:56:02.000000000 -0500
@@ -1584,6 +1584,8 @@
sprintf(res,"Thread %d
\n", y, y);
send_template(client_socket, res);
}
+ sprintf(res,"Statistics\n");
+ send_template(client_socket, res);
send_template_end_client(client_socket);
} else {
send_template_ini_client_raw(client_socket);
@@ -1593,6 +1595,27 @@
sprintf(res, "%d\n", y);
send_template_raw(client_socket, res);
}
+ sprintf(res,"Statistics\n");
+ send_template_raw(client_socket, res);
+ }
+ }
+ else if (! (strcmp (url, "/statistics/")) ) {
+ int y=0;
+ if (cnt[0]->conf.control_html_output) {
+ send_template_ini_client(client_socket,ini_template);
+ for (y=1; yThread %d Frames=%ul Diff=%d Threshold=%d Total=%lu Events=%d
\n", y, y, cnt[y]->total_frames, cnt[y]->diffs, cnt[y]->threshold, cnt[y]->total_diffs, cnt[y]->event_nr-1);
+ send_template(client_socket, res);
+ }
+ sprintf(res,"<- back\n");
+ send_template(client_socket, res);
+ send_template_end_client(client_socket);
+ } else {
+ send_template_ini_client_raw(client_socket);
+ for (y=1; ytotal_frames, cnt[y]->diffs, cnt[y]->threshold, cnt[y]->total_diffs, cnt[y]->event_nr-1);
+ send_template_raw(client_socket, res);
+ }
}
}
else {