Only use fps_report_interval for the logging of fps updates. Always update the db.

pull/4202/head
Isaac Connor 2024-08-20 16:03:34 -04:00
parent 29ea7c7074
commit b7631c8f3a
1 changed files with 39 additions and 37 deletions

View File

@ -1645,13 +1645,6 @@ void Monitor::CheckAction() {
}
void Monitor::UpdateFPS() {
if ( fps_report_interval and
(
!(shared_data->image_count%fps_report_interval)
or
( (shared_data->image_count < fps_report_interval) and !(shared_data->image_count%10) )
)
) {
struct timeval now;
gettimeofday(&now, nullptr);
double now_double = (double)now.tv_sec + (0.000001f * now.tv_usec);
@ -1677,22 +1670,31 @@ void Monitor::UpdateFPS() {
new_capture_fps,
new_analysis_fps);
if ( fps_report_interval and
(
!(shared_data->image_count%fps_report_interval)
or
( (shared_data->image_count < fps_report_interval) and !(shared_data->image_count%10) )
)
) {
Info("%s: %d - Capturing at %.2lf fps, capturing bandwidth %ubytes/sec Analysing at %.2lf fps",
name.c_str(), shared_data->image_count, new_capture_fps, new_capture_bandwidth, new_analysis_fps);
} // end if report fps
shared_data->capture_fps = new_capture_fps;
last_fps_time = now_double;
last_capture_image_count = shared_data->image_count;
shared_data->analysis_fps = new_analysis_fps;
last_motion_frame_count = motion_frame_count;
last_camera_bytes = new_camera_bytes;
if ( elapsed > 10.0 ) {
std::string sql = stringtf(
"UPDATE LOW_PRIORITY Monitor_Status SET CaptureFPS = %.2lf, CaptureBandwidth=%u, AnalysisFPS = %.2lf, UpdatedOn=NOW() WHERE MonitorId=%u",
new_capture_fps, new_capture_bandwidth, new_analysis_fps, id);
dbQueue.push(std::move(sql));
last_fps_time = now_double;
}
} // now != last_fps_time
} // end if report fps
} // void Monitor::UpdateFPS()
// Would be nice if this JUST did analysis