From 4248f8a75b63b267faae56bd811cb8d3fd896495 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 18 Nov 2018 20:21:06 +0900 Subject: Room: profile addHistoricalMessageEvents (+cleanup) --- lib/room.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') 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 ) { -- cgit v1.2.3