Re: Harmful Notification Post Rate
Re: Harmful Notification Post Rate
- Subject: Re: Harmful Notification Post Rate
- From: Richard Charles <email@hidden>
- Date: Fri, 30 Mar 2018 13:22:02 -0600
> On Mar 29, 2018, at 10:49 PM, Quincey Morris
> <email@hidden> wrote:
>
> On Mar 29, 2018, at 21:00 , Richard Charles <email@hidden> wrote:
>>
>> How can I figure out what notification is posting at a high rate?
>
> Not sure, but have you turned on “NSWindow.acceptsMouseMovedEvents” by any
> chance?
I have not called -[NSWindow acceptsMouseMovedEvents]. My custom view
implements -[NSResponder mouseMoved:] but the frameworks never call this method
during a mouse drag.
My custom view implements -[NSResponder mouseDragged:] but this has never
caused any problems. When I turn on custom logging for mouseDragged: I get
following output.
Mouse Dragged Rate: 125.7 events per second
Mouse Dragged Rate: 124.1 events per second
Mouse Dragged Rate: 124.2 events per second
Mouse Dragged Rate: 124.8 events per second
Mouse Dragged Rate: 125.2 events per second
Mouse Dragged Rate: 124.6 events per second
Mouse Dragged Rate: 168.3 events per second
2018-03-30 12:58:01.798960-0600 Xsolid[72930:1753914] Detected potentially
harmful notification post rate of 112.994 notifications per second
This is confusing because several years ago I turned on custom logging and
recorded that AppKit would throttle NSLeftMouseDragged events to a maximum of
about 60.0 events per seconds but that obviously is not the case now.
To try and track down the problem I implemented notification logging by
swizzling the following methods.
-[NSNotification postNotification:]
-[NSNotification postNotificationName:object:]
-[NSNotification postNotificationName:object:userInfo:]
Here is the output when dragging with the mouse in the custom view. I manually
formatted the output with blank lines after the fact to make it more readable.
NotificationName TimeIntervalInSeconds
=======================================
NSApplicationWillBecomeActiveNotification 986.597
NSApplicationWillBecomeActiveNotification 986.597
NSApplicationDidBecomeActiveNotification 986.597
NSApplicationDidBecomeActiveNotification 986.597
NSWindowDidBecomeMainNotification 986.602
NSWindowDidBecomeMainNotification 986.602
MyDocumentWindowDidActivate 986.602
MyDocumentWindowDidActivate 986.602
NSMenuDidChangeItemNotification 986.602
NSWindowDidBecomeKeyNotification 986.609
NSWindowDidBecomeKeyNotification 986.609
NSGestureEventMaskChanged 986.611
NSGestureEventMaskChanged 986.611
NSApplicationWillUpdateNotification 986.633
NSApplicationWillUpdateNotification 986.633
NSWindowDidUpdateNotification 986.633
NSWindowDidUpdateNotification 986.633
NSApplicationDidUpdateNotification 986.633
NSApplicationDidUpdateNotification 986.633
NSApplicationWillUpdateNotification 986.635
NSApplicationWillUpdateNotification 986.635
NSWindowDidUpdateNotification 986.635
NSWindowDidUpdateNotification 986.635
NSApplicationDidUpdateNotification 986.635
NSApplicationDidUpdateNotification 986.635
NSApplicationWillUpdateNotification 986.723
NSApplicationWillUpdateNotification 986.723
NSWindowDidUpdateNotification 986.723
NSWindowDidUpdateNotification 986.723
NSApplicationDidUpdateNotification 986.723
NSApplicationDidUpdateNotification 986.723
NSApplicationWillUpdateNotification 986.723
NSApplicationWillUpdateNotification 986.723
NSWindowDidUpdateNotification 986.723
NSWindowDidUpdateNotification 986.723
NSApplicationDidUpdateNotification 986.723
NSApplicationDidUpdateNotification 986.723
NSApplicationWillUpdateNotification 987.739
NSApplicationWillUpdateNotification 987.739
NSWindowDidUpdateNotification 987.739
NSWindowDidUpdateNotification 987.739
NSApplicationDidUpdateNotification 987.739
NSApplicationDidUpdateNotification 987.739
NSApplicationWillUpdateNotification 987.745
NSApplicationWillUpdateNotification 987.745
NSWindowDidUpdateNotification 987.745
NSWindowDidUpdateNotification 987.745
NSApplicationDidUpdateNotification 987.745
NSApplicationDidUpdateNotification 987.745
2018-03-30 12:23:07.850854-0600 MyApp[72672:1742782] Detected potentially
harmful notification post rate of 102.59 notifications per second
My code does not call any of these notifications except
MyDocumentWindowDidActivate so this is very puzzling.
--Richard Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden