19 static const ossim_uint32 DEFAULT_MAX_TILE_CACHE_FACTOR = 8;
47 tile = source->
getTile(tileRect);
197 std::shared_ptr<ossimGetTileJob> job = std::make_shared<ossimGetTileJob>(
m_nextTileID++, i, *
this);
199 job->t_launchNewJob =
false;
205 std::shared_ptr<ossimJobQueue> jobQueue = std::make_shared<ossimJobQueue>();
206 for (
ossim_uint32 chain_id=0; chain_id<num_jobs_to_launch; ++chain_id)
211 s<<
"setToStartOfSequence() -- Creating tile/job #"<<
m_nextTileID;
215 std::shared_ptr<ossimGetTileJob> job = std::make_shared<ossimGetTileJob>(
m_nextTileID++, chain_id, *
this);
217 jobQueue->add(job,
false);
222 m_jobMtQueue = std::make_shared<ossimJobMultiThreadQueue>(
nullptr, num_jobs_to_launch);
248 TileCache::iterator tile_iter =
m_tileCache.begin();
249 while (!tile.
valid())
276 s1<<
"\n cache.tile_id = "<<iter->first;
305 tile = tile_iter->second;
390 s2<<
"THREAD #"<<chain_id<<
" -- setTileInCache() Wrote tile #"<<tile_id;
412 TileCache::const_iterator iter =
m_tileCache.begin();
414 s1<<
"THREAD #"<<chain_id<<
" -- nextJob() Waiting on cache before queuing tile/job #" 418 s1<<
"\n cache.tile_id = "<<iter->first;
441 s2<<
"THREAD #"<<chain_id<<
" -- nextJob() Queuing tile/job #"<<
m_nextTileID;
452 std::shared_ptr<ossimGetTileJob> job = std::make_shared<ossimGetTileJob>(
m_nextTileID++, chain_id, *
this);
463 cerr << msg.str() << endl;
478 lookup = kwl.
find(prefix,
"num_threads");
484 lookup = kwl.
find(prefix,
"use_shared_handlers");
490 lookup = kwl.
find(prefix,
"cache_tile_size");
496 lookup = kwl.
find(prefix,
"use_cache");
void nextJob(ossim_uint32 chain_id)
Method to job queue with scope lock to avoid multiple threads modifying the queue simultaneously...
ossim_uint32 m_nextTileID
ID of next tile to be threaded, different from base class' theCurrentTileNumber.
virtual void disconnectAllOutputs()
Will disconnect all of the output objects.
void setNumberOfThreads(ossim_uint32 num_threads)
Specifies number of thread to support.
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
Overrides base class in order to implement multi-threaded tile requests.
void setUseSharedHandlers(bool use_shared_handlers)
virtual void setImageRectangle(const ossimIrect &rect)
ossim::Block m_nextJobBlock
ossim_uint32 m_maxCacheSize
void setStartTick()
Set the start.
SharedHandlerList m_sharedHandlers
Represents serializable keyword/value map.
virtual void setToStartOfSequence()
Overrides base class implementation.
const char * find(const char *key) const
std::shared_ptr< ossimGetTileCallback > m_callback
void setTileInCache(ossim_uint32 tile_id, ossimImageData *tile, ossim_uint32 chain_id, double dt)
Access method to tile cache with scope lock to avoid multiple threads writing to the cache simultaneo...
bool getTileRect(ossim_int64 tile_id, ossimIrect &rect) const
Establishes a tile rect given tile ID.
ossim_uint32 seqTimedBlocksDt
ossimMultiThreadSequencer & m_sequencer
ossim_uint32 d_maxCacheUsed
ossim_uint32 toUInt32() const
ossim_uint32 m_numThreads
void print(ostringstream &msg) const
For debug – thread-safe console output.
void setNumberOfThreads(ossim_uint32 num_threads)
Alternate way of specifying number of threads to support.
ossimRefPtr< ossimImageChainMtAdaptor > m_inputChain
Same as base class' theInputConnection.
virtual ossimObject * dup() const
OSSIM_DLL ossim_uint32 getNumberOfThreads()
Get the number threads to use from ossimPreferences or ossim::Thread.
ossim_uint32 d_cacheEmptyCount
void setUseCache(bool use_cache)
ossimMultiThreadSequencer(ossimImageSource *inputSource=NULL, ossim_uint32 num_threads=0, ossimObject *owner=NULL)
ossim_uint32 m_maxTileCacheFactor
void release()
Releases the threads and will not return until all threads are released.
static ossimTimer * instance()
void setUseSharedHandlers(bool use_shared_handlers)
Private class for getTile job callbacks.
ossim_uint32 maxTileCacheSize
bool toBool() const
String to numeric methods.
double time_s() const
Get elapsed time in seconds.
unsigned int ossim_uint32
ossim_int64 theNumberOfTilesHorizontal
virtual bool add(ossimConnectableObject *source)
Will return true or false if an image source was added to the chain.
ossim_int64 theNumberOfTilesVertical
std::shared_ptr< ossimJobMultiThreadQueue > m_jobMtQueue
bool loadState(const ossimKeywordlist &kwl, const char *prefix)
Method to the load (recreate) the state of an object from a keyword list.
void block()
Will block the calling thread based on the internal condition.
ossim_uint32 d_cacheTileSize
TileCache m_tileCache
Saves tiles output by threaded jobs.
void setUseCache(bool use_cache)
virtual void finished()
Sets the state if the object as finished.
virtual ~ossimMultiThreadSequencer()
ossim_uint32 m_totalNumberOfTiles
For debugging purposes. To be removed with final release:
This class supports multi-threading of image chain getTile() requests and associated chain updating...
bool loadState(const ossimKeywordlist &kwl, const char *prefix)
Method to the load (recreate) the state of an object from a keyword list.
ossim_uint32 d_timedBlocksDt
bool d_timeMetricsEnabled
static ossimMtDebug * m_instance
virtual void run()
Abstract method and must be overriden by the base class.
ossim::Block m_getTileBlock
ossimImageSource * getClone(ossim_uint32 index)
Returns pointer to a specific clone image chain, or NULL if index exceeds the max available...
ossimRefPtr< ossimImageData > theBlankTile
void reset()
Simple reset the values.
void setCacheTileSize(ossim_uint32 cache_tile_size)
virtual void running()
Sets the state if the object as running.
ossimImageSource * theInputConnection
static ossimMtDebug * instance()
ossim_int64 theCurrentTileNumber
void setCacheTileSize(ossim_uint32 cache_tile_size)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)