Skip to content

Commit

Permalink
Remove extra thread for filter index to improve performance. (#589)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Wenzel <[email protected]>
  • Loading branch information
alexmucde authored Nov 21, 2024
1 parent e7cd437 commit 5e98bc6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/dltfileindexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,10 @@ bool DltFileIndexer::indexFilter(QStringList filenames)
// get silent mode
bool silentMode = !QDltOptManager::getInstance()->issilentMode();

bool hasPlugins = (activeDecoderPlugins.size() + activeViewerPlugins.size()) > 0;
bool hasFilters = filterList.filters.size() > 0;
//bool hasPlugins = (activeDecoderPlugins.size() + activeViewerPlugins.size()) > 0;
//bool hasFilters = filterList.filters.size() > 0;

bool useIndexerThread = hasPlugins || hasFilters;
//bool useIndexerThread = hasPlugins || hasFilters;

DltFileIndexerThread indexerThread
(
Expand All @@ -461,10 +461,10 @@ bool DltFileIndexer::indexFilter(QStringList filenames)
silentMode
);

if(useIndexerThread)
/*if(useIndexerThread)
{
indexerThread.start(); // thread starts reading its queue
}
}*/

qDebug() << "### Create filter index";
qDebug() << "Create filter index: Start";
Expand All @@ -481,14 +481,14 @@ bool DltFileIndexer::indexFilter(QStringList filenames)
if(!dltFile->getMsg(ix, *msg))
continue; // Skip broken messages

if(true == useIndexerThread)
/*if(true == useIndexerThread)
{
indexerThread.enqueueMessage(msg, ix);
}
else
{
{*/
indexerThread.processMessage(msg, ix);
}
//}

if((end-start)!=0)
iPercent = ( (ix-start)*100 )/(end-start);
Expand All @@ -503,23 +503,23 @@ bool DltFileIndexer::indexFilter(QStringList filenames)
// stop if requested
if(stopFlag)
{
if(useIndexerThread)
/*if(useIndexerThread)
{
indexerThread.requestStop();
indexerThread.wait();
}
}*/

return false;
}
}
emit(progress(100));
qDebug() << "IF:" << 100 << "%";
qDebug() << "CFI:" << 100 << "%";
// destroy threads
if(true == useIndexerThread)
/*if(true == useIndexerThread)
{
indexerThread.requestStop();
indexerThread.wait();
}
}*/

// update performance counter
//msecsFilterCounter = time.elapsed();
Expand Down

0 comments on commit 5e98bc6

Please sign in to comment.