Optimised analysis and sleeps.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@27 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2002-09-23 10:13:51 +00:00
parent 6ee0d8bdd0
commit 2dfbd35809
2 changed files with 7 additions and 6 deletions

View File

@ -1669,12 +1669,11 @@ void Monitor::DumpImage( Image *image ) const
} }
} }
void Monitor::Analyse() bool Monitor::Analyse()
{ {
if ( shared_images->last_read_index == shared_images->last_write_index ) if ( shared_images->last_read_index == shared_images->last_write_index )
{ {
usleep( 10000 ); return( false );
return;
} }
time_t now = time( 0 ); time_t now = time( 0 );
@ -1753,6 +1752,8 @@ void Monitor::Analyse()
shared_images->last_read_index = index%IMAGE_BUFFER_COUNT; shared_images->last_read_index = index%IMAGE_BUFFER_COUNT;
image_count++; image_count++;
return( true );
} }
void Monitor::ReloadZones() void Monitor::ReloadZones()
@ -1772,11 +1773,11 @@ int Monitor::Load( int device, Monitor **&monitors, bool capture )
static char sql[256]; static char sql[256];
if ( device == -1 ) if ( device == -1 )
{ {
sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'Disabled'" ); sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'None'" );
} }
else else
{ {
sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'Disabled' and Device = %d", device ); sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'None' and Device = %d", device );
} }
if ( mysql_query( &dbconn, sql ) ) if ( mysql_query( &dbconn, sql ) )
{ {

View File

@ -610,7 +610,7 @@ public:
} }
void DumpImage( Image *image ) const; void DumpImage( Image *image ) const;
void Analyse(); bool Analyse();
void Adjust( double ratio ) void Adjust( double ratio )
{ {