Ejemplo n.º 1
0
MemoryPool::~MemoryPool()
{
	if( !_dataUsed.empty() )
	{
		TUTTLE_COUT_ERROR( "Error inside memory pool. Some data always mark used at the destruction (nb elements:" << _dataUsed.size() << ")" );
	}
	TUTTLE_TCOUT_X( 20, "-" );
	TUTTLE_TCOUT( "~MemoryPool()" );
	TUTTLE_TCOUT_VAR( _dataUsed.size() );
	TUTTLE_TCOUT_VAR( _dataUnused.size() );
	TUTTLE_TCOUT_VAR( _allDatas.size() );
	TUTTLE_TCOUT_VAR( _memoryAuthorized );
	TUTTLE_TCOUT( "" );
	TUTTLE_TCOUT_VAR( getUsedMemorySize() );
	TUTTLE_TCOUT_VAR( getAllocatedMemorySize() );
	TUTTLE_TCOUT_VAR( getMaxMemorySize() );
	TUTTLE_TCOUT_VAR( getAvailableMemorySize() );
	TUTTLE_TCOUT_VAR( getWastedMemorySize() );
	TUTTLE_TCOUT_X( 20, "-" );
}
Ejemplo n.º 2
0
/** @brief Function to pass to the multi thread suite */
void Processor::multiThread( const unsigned int nCPUs )
{
	unsigned int realNbCPUs = nCPUs;
	// if 0, use all the CPUs we can
	if( realNbCPUs == 0 )
		realNbCPUs = OFX::MultiThread::getNumCPUs();

	if( realNbCPUs == 0 )
	{
		TUTTLE_COUT_ERROR( "Run process on 0 cpus... it seems to be a problem." );
	}
	else if( realNbCPUs == 1 ) // if 1 cpu, don't bother with the threading
	{
		multiThreadFunction( 0, 1 );
	}
	else
	{
		// OK do it
		OfxStatus stat = OFX::Private::gThreadSuite->multiThread( staticMultiThreadFunction, realNbCPUs, (void*)this );

		// did we do it?
		throwSuiteStatusException( stat );
	}
}
Ejemplo n.º 3
0
void OfxhPluginCache::scanPluginFiles()
{
	std::set<std::string> foundBinFiles;

	for( std::list<std::string>::iterator paths = _pluginPath.begin();
	     paths != _pluginPath.end();
	     ++paths )
	{
		scanDirectory( foundBinFiles, *paths, _nonrecursePath.find( *paths ) == _nonrecursePath.end() );
	}

	OfxhPluginBinaryList::iterator i = _binaries.begin();
	while( i != _binaries.end() )
	{
		if( foundBinFiles.find( i->getFilePath() ) == foundBinFiles.end() )
		{
			// the binary was in the cache, but was not on the path
			setDirty();
			i = _binaries.erase( i );
		}
		else
		{
			const bool binChanged = i->hasBinaryChanged();

			// the binary was in the cache, but the binary has changed and thus we need to reload
			if( binChanged )
			{
				i->loadPluginInfo( this );
				setDirty();
			}

			for( int j = 0; j < i->getNPlugins(); ++j )
			{
				OfxhPlugin& plug                   = i->getPlugin( j );
				try
				{
					APICache::OfxhPluginAPICacheI& api = plug.getApiHandler();

					if( binChanged )
					{
						api.loadFromPlugin( plug ); // may throw
					}

					std::string reason;

					if( api.pluginSupported( plug, reason ) )
					{
						addPlugin( &plug );
						api.confirmPlugin( plug );
					}
					else
					{
						TUTTLE_COUT_ERROR(
							"Ignoring plugin " << quotes(plug.getIdentifier()) <<
							": unsupported, " << reason << "." );
					}
				}
				catch(...)
				{
					TUTTLE_COUT_ERROR(
						"Ignoring plugin " << quotes(plug.getIdentifier()) <<
						": loading error." );
					
				}
			}

			++i;
		}
	}
}