aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-11-18 20:21:06 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-11-19 08:54:18 +0900
commit4248f8a75b63b267faae56bd811cb8d3fd896495 (patch)
tree3d92fd76e18d8ebfa9330f06605ee4d33daba57c /lib/room.cpp
parent67a1d2db7a71b3add7ca0749afe337b1a5a6db09 (diff)
downloadlibquotient-4248f8a75b63b267faae56bd811cb8d3fd896495.tar.gz
libquotient-4248f8a75b63b267faae56bd811cb8d3fd896495.zip
Room: profile addHistoricalMessageEvents (+cleanup)
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index a0cac18a..ea771f17 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -420,7 +420,7 @@ void Room::Private::updateUnreadCount(rev_iter_t from, rev_iter_t to)
unreadMessages = 0;
unreadMessages += newUnreadMessages;
- qCDebug(MAIN) << "Room" << displayname << "has gained"
+ qCDebug(MAIN) << "Room" << q->objectName() << "has gained"
<< newUnreadMessages << "unread message(s),"
<< (q->readMarker() == timeline.crend() ?
"in total at least" : "in total")
@@ -1701,7 +1701,7 @@ void Room::Private::addNewMessageEvents(RoomEvents&& events)
if (totalInserted > 0)
{
qCDebug(MAIN)
- << "Room" << displayname << "received" << totalInserted
+ << "Room" << q->objectName() << "received" << totalInserted
<< "new events; the last event is now" << timeline.back();
// The first event in the just-added batch (referred to by `from`)
@@ -1726,6 +1726,7 @@ void Room::Private::addNewMessageEvents(RoomEvents&& events)
void Room::Private::addHistoricalMessageEvents(RoomEvents&& events)
{
+ QElapsedTimer et; et.start();
const auto timelineSize = timeline.size();
dropDuplicateEvents(events);
@@ -1748,6 +1749,9 @@ void Room::Private::addHistoricalMessageEvents(RoomEvents&& events)
updateUnreadCount(from, timeline.crend());
Q_ASSERT(timeline.size() == timelineSize + insertedSize);
+ if (insertedSize > 9 || et.nsecsElapsed() >= profilerMinNsecs())
+ qCDebug(PROFILER) << "*** Room::addHistoricalMessageEvents():"
+ << insertedSize << "event(s)," << et;
}
bool Room::processStateEvent(const RoomEvent& e)
@@ -1791,8 +1795,7 @@ bool Room::processStateEvent(const RoomEvent& e)
u->processEvent(evt, this);
if (u == localUser() && memberJoinState(u) == JoinState::Invite
&& evt.isDirect())
- connection()->addToDirectChats(this,
- user(evt.senderId()));
+ connection()->addToDirectChats(this, user(evt.senderId()));
if( evt.membership() == MembershipType::Join )
{