1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP37/GCS MapLib - Try different DB method to improve speed.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2694 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
zedamota 2011-02-02 10:41:27 +00:00 committed by zedamota
parent 986e124202
commit 878829a7cf
4 changed files with 21 additions and 6 deletions

View File

@ -26,6 +26,6 @@
*/
#include "diagnostics.h"
diagnostics::diagnostics():networkerrors(0),emptytiles(0),timeouts(0),runningThreads(0)
diagnostics::diagnostics():networkerrors(0),emptytiles(0),timeouts(0),runningThreads(0),tilesFromMem(0),tilesFromNet(0),tilesFromDB(0)
{
}

View File

@ -34,9 +34,13 @@ struct diagnostics
int emptytiles;
int timeouts;
int runningThreads;
int tilesFromMem;
int tilesFromNet;
int tilesFromDB;
QString toString()
{
return QString("Network errors:%1\nEmpty Tiles:%2\nTimeOuts:%3\nRunningThreads:%4").arg(networkerrors).arg(emptytiles).arg(timeouts).arg(runningThreads);
return QString("Network errors:%1\nEmpty Tiles:%2\nTimeOuts:%3\nRunningThreads:%4\nTilesFromMem:%5\nTilesFromNet:%6\nTilesFromDB:%7").arg(networkerrors).arg(emptytiles).arg(timeouts).arg(runningThreads).arg(tilesFromMem).arg(tilesFromNet).arg(tilesFromDB);
;
}
};

View File

@ -70,6 +70,12 @@ namespace core {
qDebug()<<"Try Tile from memory:Size="<<TilesInMemory.MemoryCacheSize();
#endif //DEBUG_GMAPS
ret=GetTileFromMemoryCache(RawTile(type,pos,zoom));
if(!ret.isEmpty())
{
errorvars.lock();
++diag.tilesFromMem;
errorvars.unlock();
}
}
if(ret.isEmpty())
@ -85,6 +91,9 @@ namespace core {
ret=Cache::Instance()->ImageCache.GetImageFromCache(type,pos,zoom);
if(!ret.isEmpty())
{
errorvars.lock();
++diag.tilesFromDB;
errorvars.unlock();
#ifdef DEBUG_GMAPS
qDebug()<<"Tile found in Database";
#endif //DEBUG_GMAPS
@ -228,6 +237,9 @@ namespace core {
#ifdef DEBUG_GMAPS
qDebug()<<"Received Tile from the Internet";
#endif //DEBUG_GMAPS
errorvars.lock();
++diag.tilesFromNet;
errorvars.unlock();
if (useMemoryCache)
{
#ifdef DEBUG_GMAPS

View File

@ -194,11 +194,11 @@ namespace core {
qlonglong id=++ConnCounter;
Mcounter.unlock();
{
Mcounter.lock();
QSqlDatabase cn;
cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id));
QString db=gtilecache+"Data.qmdb";
cn.setDatabaseName(db);
cn.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE");
if(cn.open())
{
{
@ -220,7 +220,6 @@ namespace core {
}
cn.close();
}
Mcounter.unlock();
}
QSqlDatabase::removeDatabase(QString::number(id));
return true;
@ -239,12 +238,12 @@ namespace core {
{
QString db=dir+"Data.qmdb";
{
Mcounter.lock();
QSqlDatabase cn;
cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id));
cn.setDatabaseName(db);
cn.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE");
if(cn.open())
{
{
@ -258,7 +257,6 @@ namespace core {
}
cn.close();
}
Mcounter.unlock();
}
}
QSqlDatabase::removeDatabase(QString::number(id));
@ -280,6 +278,7 @@ namespace core {
Mcounter.unlock();
cn = QSqlDatabase::addDatabase("QSQLITE",QString::number(id));
cn.setDatabaseName(db);
cn.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE");
if(cn.open())
{
{