2022-03-01 Fred Gleason <fredg@paravelsystems.com>

* Added a RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING #define switch
	to 'RDLibraryModel'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-03-01 10:34:34 -05:00
parent 42c9de3e30
commit bee47bec9e
2 changed files with 23 additions and 4 deletions

View File

@ -22904,3 +22904,6 @@
* Removed debugging printf()s from rdlogedit(1). * Removed debugging printf()s from rdlogedit(1).
2022-02-28 Fred Gleason <fredg@paravelsystems.com> 2022-02-28 Fred Gleason <fredg@paravelsystems.com>
* Updated rdcatch(1) to eliminate superfluous SQL filter updates. * Updated rdcatch(1) to eliminate superfluous SQL filter updates.
2022-03-01 Fred Gleason <fredg@paravelsystems.com>
* Added a RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING #define switch
to 'RDLibraryModel'.

View File

@ -2,7 +2,7 @@
// //
// Data model for the Rivendell cart library // Data model for the Rivendell cart library
// //
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2021-2022 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -24,6 +24,11 @@
#include "rdlibrarymodel.h" #include "rdlibrarymodel.h"
#include "rdtimeprobe.h" #include "rdtimeprobe.h"
//
// Uncomment this to enable model update profiling
//
// #define RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
RDLibraryModel::RDLibraryModel(QObject *parent) RDLibraryModel::RDLibraryModel(QObject *parent)
: QAbstractItemModel(parent) : QAbstractItemModel(parent)
{ {
@ -551,7 +556,6 @@ void RDLibraryModel::setFilterSql(const QString &sql,int cart_limit)
} }
fsql+=", `CUTS`.`PLAY_ORDER` asc "; fsql+=", `CUTS`.`PLAY_ORDER` asc ";
d_filter_set=true; d_filter_set=true;
printf("***** FILTER SQL SET *****\n");
updateModel(fsql); updateModel(fsql);
} }
@ -562,10 +566,11 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
if(!d_filter_set) { if(!d_filter_set) {
return; return;
} }
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
printf("%p - filter_sql: %s\n",this,filter_sql.toUtf8().constData()); printf("%p - filter_sql: %s\n",this,filter_sql.toUtf8().constData());
RDTimeProbe *probe=new RDTimeProbe(); RDTimeProbe *probe=new RDTimeProbe();
probe->printWaypoint("updateModel - 1"); probe->printWaypoint("updateModel - 1");
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
QString sql; QString sql;
RDSqlQuery *q=NULL; RDSqlQuery *q=NULL;
@ -582,7 +587,9 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
QList<QList<QVariant> > list_list; QList<QList<QVariant> > list_list;
list_list.push_back(list); list_list.push_back(list);
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
probe->printWaypoint("updateModel - 2"); probe->printWaypoint("updateModel - 2");
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
// //
// Reload the color table // Reload the color table
@ -598,7 +605,9 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
} }
delete q; delete q;
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
probe->printWaypoint("updateModel - 3"); probe->printWaypoint("updateModel - 3");
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
sql=sqlFields()+ sql=sqlFields()+
filter_sql; filter_sql;
@ -614,7 +623,9 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
unsigned prev_cartnum=0; unsigned prev_cartnum=0;
int carts_loaded=0; int carts_loaded=0;
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
probe->printWaypoint("updateModel - 4"); probe->printWaypoint("updateModel - 4");
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
// printf("RDLibraryModel::updateModel() SQL: %s\n",sql.toUtf8().constData()); // printf("RDLibraryModel::updateModel() SQL: %s\n",sql.toUtf8().constData());
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
@ -636,17 +647,22 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
} }
delete q; delete q;
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
probe->printWaypoint("updateModel - 5"); probe->printWaypoint("updateModel - 5");
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
endResetModel(); endResetModel();
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
probe->printWaypoint("updateModel - 6"); probe->printWaypoint("updateModel - 6");
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
emit rowCountChanged(d_texts.size()); emit rowCountChanged(d_texts.size());
#ifdef RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
probe->printWaypoint("updateModel - 7"); probe->printWaypoint("updateModel - 7");
delete probe; delete probe;
#endif // RDLIBRARYMODEL_ENABLE_UPDATE_PROFILING
} }