https://bugs.kde.org/show_bug.cgi?id=431951

--- Comment #50 from griffiths_a...@icloud.com ---
Just did my own rough & ready mod to log query and post-processing in
core/libs/database/coredb/coredb.cpp:

QMap<QDateTime, int> CoreDB::getAllCreationDatesAndNumberOfImages() const
{
    qCDebug(DIGIKAM_COREDB_LOG) << "getAllCreationDatesAndNumberOfImages()
query starts";
    QList<QVariant> values;

    d->db->execSql(QString::fromUtf8("SELECT creationDate FROM ImageInformation
"
                                     "INNER JOIN Images ON
Images.id=ImageInformation.imageid "
                                     " WHERE Images.status=1;"),
                   &values);

    qCDebug(DIGIKAM_COREDB_LOG) << "getAllCreationDatesAndNumberOfImages()
query ends";
    QMap<QDateTime, int> datesStatMap;

    qCDebug(DIGIKAM_COREDB_LOG) << "getAllCreationDatesAndNumberOfImages()
post-processing starts";
    foreach (const QVariant& value, values)
    {   
        if (!value.isNull())
        {   
            QDateTime dateTime = value.toDateTime();

            if (!dateTime.isValid())
            {
                continue;
            }

            QMap<QDateTime, int>::iterator it2 = datesStatMap.find(dateTime);

            if (it2 == datesStatMap.end())
            {
                datesStatMap.insert(dateTime, 1);
            }
            else
            {
                it2.value()++;
            }
        }
    }
    qCDebug(DIGIKAM_COREDB_LOG) << "getAllCreationDatesAndNumberOfImages()
post-processing ends";
    return datesStatMap;
}


Then run thru ts to timestamp it:

andyg@arch ~/projects/digikam/build (git)-[master] %
QT_LOGGING_RULES="digikam.core*=true" digikam 2>&1 | ts
Feb 18 17:03:46 QCommandLineParser: already having an option named "h"
Feb 18 17:03:46 QCommandLineParser: already having an option named "help-all"
Feb 18 17:03:46 QCommandLineParser: already having an option named "v"
Feb 18 17:03:46 digikam.coredb: Core database: running schema update
Feb 18 17:03:46 digikam.coredb: Core database: have a structure version  11
Feb 18 17:03:46 digikam.coredb: Core database: makeUpdates  11  to  11
Feb 18 17:03:50 [ALSOFT] (EE) Failed to set real-time priority for thread:
Operation not permitted (1)
Feb 18 17:03:50 [ALSOFT] (EE) Failed to set real-time priority for thread:
Operation not permitted (1)
Feb 18 17:03:50 kf.xmlgui: Unhandled container to remove :  Digikam::DigikamApp
Feb 18 17:03:50 digikam.coredb: CoreDbAccess lock time: 41 ms
Feb 18 17:03:53 digikam.coredb: CoreDbAccess lock time: 2119 ms
Feb 18 17:03:55 digikam.coredb: CoreDbAccess lock time: 676 ms
Feb 18 17:03:55 digikam.coredb: CoreDbAccess lock time: 66 ms
Feb 18 17:03:55 digikam.coredb: getAllCreationDatesAndNumberOfImages() query
starts
Feb 18 17:03:55 digikam.coredb: getAllCreationDatesAndNumberOfImages() query
ends
Feb 18 17:03:55 digikam.coredb: getAllCreationDatesAndNumberOfImages()
post-processing starts
Feb 18 17:04:07 digikam.coredb: getAllCreationDatesAndNumberOfImages()
post-processing ends
Feb 18 17:04:07 digikam.coredb: CoreDbAccess lock time: 12682 ms

Sub-second in the query, ~ 12 seconds in the QDateTime manipulation.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to