From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.devel Subject: Re: Redisplay: NS port, high CPU load Date: Wed, 8 Jun 2016 09:50:30 +0200 Message-ID: References: <9793F9E3-979A-4888-8662-F6E0C27C8B37@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c1246104702f80534bf8ff8 X-Trace: ger.gmane.org 1465372273 14219 80.91.229.3 (8 Jun 2016 07:51:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jun 2016 07:51:13 +0000 (UTC) Cc: Emacs-Devel devel To: David Reitter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 08 09:51:12 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bAYGZ-0007cw-8G for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2016 09:51:07 +0200 Original-Received: from localhost ([::1]:55126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAYGY-00023m-Im for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2016 03:51:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAYG1-00023g-IK for emacs-devel@gnu.org; Wed, 08 Jun 2016 03:50:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAYFz-0004sd-Rq for emacs-devel@gnu.org; Wed, 08 Jun 2016 03:50:33 -0400 Original-Received: from mail-vk0-x22e.google.com ([2607:f8b0:400c:c05::22e]:33802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAYFz-0004sZ-Hy for emacs-devel@gnu.org; Wed, 08 Jun 2016 03:50:31 -0400 Original-Received: by mail-vk0-x22e.google.com with SMTP id e4so381086vkb.1 for ; Wed, 08 Jun 2016 00:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=T9nTM0UxoCJQqpMMAj+jrjfReCjYiVgwW7LkJkghQgA=; b=Mh4Asy0wIiKUZXJYCCodDE/OMIthHOmNcgzv7Oa3SEogoaSjZ9FlgT9Jl6VCmiiQ3C 11PJLwTLi8cX3lzujAHAGQI5bTHOJ2f464FE2ySGvGREGWZR2mVQQCyRAOZWZ4wuUnkX mOoDOAwN+Di6bdETAtbghBNuF+x+vRXyWWgCuunEFnsMbXttQzREeeKn2QKMVsQIBcJD IvKdID/lJiOUPwONSqRODrqJGZ0GdAyil+WpfypuoueRpeQSntHMmd7kukoHFUg2d34a okGf6uftUWNVVCdkQ3TtI/vDwErEJZYxnkXexEqB/Sx7DZq/pD1J3p1UytUSa9Z8VJay Jfsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=T9nTM0UxoCJQqpMMAj+jrjfReCjYiVgwW7LkJkghQgA=; b=F5Cz/Xfu0z1boMODIOWFo/FE9vQXqX3PD2LfcioDQtoiJRrRJyLh2rEknBspib3TNd uYKsFStdPSSqm0skxKYv7dyk7+s3HIE/iD7dUuQ+8ohytOuN6YmDw+UFXAnCfmE/qVOI FsFvg3NRJ+HV9sSR4rtaUK69KA3kjcOcytJsh6i0zsYCtXZtBrLPozfCaLzK+p4KkpAD imQG5Gl45rfCX0RO01RwsK4MWT4sibKuF9zbG0kVaGKgylo3duj6vVO+joOKNbnHe0qV xaM/Ug3go6dQRmDVxHOqSh/ATIj3HoEIZkgIdCrW3ARFzj0zGE0h6/fPAQ58aDVIbbay ZWJA== X-Gm-Message-State: ALyK8tLQyRNMf/H8mDe8hFrempmslEEPI+h8B3XHjrFjEhKMEujD+CyMlNjzAEcjg4co+ji0y+f/1p6+OO0cTg== X-Received: by 10.176.64.167 with SMTP id i36mr1443703uad.60.1465372230744; Wed, 08 Jun 2016 00:50:30 -0700 (PDT) Original-Received: by 10.31.216.195 with HTTP; Wed, 8 Jun 2016 00:50:30 -0700 (PDT) In-Reply-To: <9793F9E3-979A-4888-8662-F6E0C27C8B37@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204233 Archived-At: --94eb2c1246104702f80534bf8ff8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi! Unfortunately, I have no direct idea of what could be wrong, but you can try the following: Enable NSTRACE (this is done in nsterm.h) -- this might give you a bit more information about what happens on the NS port side. You have to launch Emacs from a terminal window, though. Adding a pair of block_input() and unblock_input() has fixed similar problems, it might be worth a try here as well. If Emacs calls setMainMeny a lot, it might be an idea to try to reduce this, e.g. by only calling it when the meny really has been changed (unless this mechanism already is in place). -- Anders On Wed, Jun 8, 2016 at 8:04 AM, David Reitter wrote: > I am and users are experiencing regular high CPU load with the NS port, > which started some time around late 2015, but according to users co-incid= ed > with an OS upgrade, too. I tried rolling back changes, with limited > success: it does seem though that very recently, the problem has become > much worse. > > Usually, Emacs goes into 100% CPU load, or sometimes high load. What > invariably shows up in my process samples is NSMenu _sidebandUpdate* (no > idea what that does), within ns_upgrade_menubar. The attachment (sorry, > could not export to text) shows an example. > > I=E2=80=99m getting the spinning beachball sometimes when entering a mini= buffer > for a command. > > I would like to fix this problem, but have been unsuccessful in tracing i= t > down. As you can see, we=E2=80=99re spending a lot of time in redisplay. > Is redisplay slow, or is it called again and again? > > Advice would be appreciated. (Yes, this is with Aquamacs, and I can=E2= =80=99t > tell if the problem exists in GNU Emacs as it probably interacts with som= e > configuration.) > > > > Date/Time: 2016-06-08 15:32:29.059 +1000 > Launch Time: 2016-06-08 13:51:42.364 +1000 > OS Version: Mac OS X 10.11.4 (15E65) > Report Version: 7 > Analysis Tool: /usr/bin/sample > ---- > > Call graph: > 2484 Thread_453834: Main Thread DispatchQueue_ > + 2417 start (in libdyld.dylib) + 1 [0x7fff892d35ad] > + ! 2417 main () + 5602 [0x1000c3602] emacs.c:1606 > + ! 2417 Frecursive_edit () + 218 [0x1000c48ea] keyboard.c:755 > + ! 2417 recursive_edit_1 () + 101 [0x1000c46c5] keyboard.c:68= 4 > + ! 2417 command_loop () + 158 [0x1000c47ae] keyboard.c:1078 > + ! 2417 internal_catch () + 54 [0x10013f6b6] eval.c:1074 > + ! 2417 command_loop_2 () + 48 [0x1000d45c0] > keyboard.c:1099 > + ! 2417 internal_condition_case () + 70 [0x10013fb46] > eval.c:1309 > + ! 2417 command_loop_1 () + 1154 [0x1000c5552] > keyboard.c:1357 > + ! 2417 read_key_sequence () + 1959 [0x1000c6e17] > keyboard.c:9101 > + ! 2417 read_char () + 5783 [0x1000ca407] > keyboard.c:2706 > + ! 2417 sit_for () + 261 [0x100008515] > dispnew.c:5762 > + ! 1694 wait_reading_process_output () + 1218 > [0x100183482] process.c:4609 > + ! : 1694 redisplay_preserve_echo_area () + > 44 [0x100028dfc] xdisp.c:14286 > + ! : 970 redisplay_internal () + 2034 > [0x100027282] xdisp.c:11850 > + ! : | 962 update_menu_bar () + 450 > [0x10004c9b2] xdisp.c:11960 > + ! : | + 869 ns_update_menubar () + 479 > [0x1001cba6f] nsmenu.m:139 > + ! : | + ! 868 -[NSApplication setMainMenu:] > (in AppKit) + 1584 [0x7fff8e8dc2c0] > + ! : | + ! : 868 -[NSMenu > _addSidebandMenuUpdaterForRoles:token:priority:handler:] (in AppKit) + > 229 [0x7fff8e8dc912] > + ! : | + ! : 868 -[NSMenu > _sidebandUpdaterRoles] (in AppKit) + 41,47,... > [0x7fff8e8dca4d,0x7fff8e8dca53,...] > + ! : | + ! 1 -[NSApplication setMainMenu:] > (in AppKit) + 655 [0x7fff8e8dbf1f] > + ! : | + ! 1 objc_msgSend (in > libobjc.A.dylib) + 26 [0x7fff8dbc54da] > + ! : | + 57 ns_update_menubar () + 1577 > [0x1001cbeb9] nsmenu.m:454 > --94eb2c1246104702f80534bf8ff8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi!

Unfortunately, I have no= direct idea of what could be wrong, but you can try the following:

Enable NSTRACE (this is done in nsterm.h) -- this might give y= ou a bit more information about what happens on the NS port side. You have = to launch Emacs from a terminal window, though.

Adding a= pair of block_input() and unblock_input() has fixed similar problems, it m= ight be worth a try here as well.

If Emacs cal= ls setMainMeny a lot, it might be an idea to try to reduce this, e.g. by on= ly calling it when the meny really has been changed (unless this mechanism = already is in place).

=C2=A0 =C2=A0 -- Anders

On Wed, Ju= n 8, 2016 at 8:04 AM, David Reitter <david.reitter@gmail.com>= wrote:
I am and users are experie= ncing regular high CPU load with the NS port, which started some time aroun= d late 2015, but according to users co-incided with an OS upgrade, too.=C2= =A0 I tried rolling back changes, with limited success: it does seem though= that very recently, the problem has become much worse.

Usually, Emacs goes into 100% CPU load, or sometimes high load.=C2=A0 What = invariably shows up in my process samples is NSMenu _sidebandUpdate*=C2=A0 = (no idea what that does), within ns_upgrade_menubar.=C2=A0 The attachment (= sorry, could not export to text) shows an example.

I=E2=80=99m getting the spinning beachball sometimes when entering a minibu= ffer for a command.

I would like to fix this problem, but have been unsuccessful in tracing it = down.=C2=A0 As you can see, we=E2=80=99re spending a lot of time in redispl= ay.
Is redisplay slow, or is it called again and again?

Advice would be appreciated.=C2=A0 (Yes, this is with Aquamacs, and I can= =E2=80=99t tell if the problem exists in GNU Emacs as it probably interacts= with some configuration.)



Date/Time:=C2=A0 =C2=A0 =C2=A0 =C2=A02016-06-08 15:32:29.059 +1000
Launch Time:=C2=A0 =C2=A0 =C2=A02016-06-08 13:51:42.364 +1000
OS Version:=C2=A0 =C2=A0 =C2=A0 Mac OS X 10.11.4 (15E65)
Report Version:=C2=A0 7
Analysis Tool:=C2=A0 =C2=A0/usr/bin/sample
----

Call graph:
=C2=A0 =C2=A0 2484 Thread_453834: Main Thread=C2=A0 =C2=A0DispatchQueue_<= ;multiple>
=C2=A0 =C2=A0 + 2417 start=C2=A0 (in libdyld.dylib) + 1=C2=A0 [0x7fff892d35= ad]
=C2=A0 =C2=A0 + ! 2417 main=C2=A0 () + 5602=C2=A0 [0x1000c3602]=C2=A0 emacs= .c:1606
=C2=A0 =C2=A0 + !=C2=A0 =C2=A02417 Frecursive_edit=C2=A0 () + 218=C2=A0 [0x= 1000c48ea]=C2=A0 keyboard.c:755
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A02417 recursive_edit_1=C2=A0 () + 101= =C2=A0 [0x1000c46c5]=C2=A0 keyboard.c:684
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A02417 command_loop=C2=A0 () + 15= 8=C2=A0 [0x1000c47ae]=C2=A0 keyboard.c:1078
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A02417 internal_catch=C2= =A0 () + 54=C2=A0 [0x10013f6b6]=C2=A0 eval.c:1074
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A02417 command_loop= _2=C2=A0 () + 48=C2=A0 [0x1000d45c0]=C2=A0 keyboard.c:1099
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A02417 inter= nal_condition_case=C2=A0 () + 70=C2=A0 [0x10013fb46]=C2=A0 eval.c:1309
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0241= 7 command_loop_1=C2=A0 () + 1154=C2=A0 [0x1000c5552]=C2=A0 keyboard.c:1357<= br> =C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A02417 read_key_sequence=C2=A0 () + 1959=C2=A0 [0x1000c6e17]=C2=A0 keyb= oard.c:9101
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A02417 read_char=C2=A0 () + 5783=C2=A0 [0x1000ca407]=C2=A0 keybo= ard.c:2706
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A02417 sit_for=C2=A0 () + 261=C2=A0 [0x100008515]=C2=A0 d= ispnew.c:5762
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A01694 wait_reading_process_output=C2=A0 () + 1218= =C2=A0 [0x100183482]=C2=A0 process.c:4609
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0: 1694 redisplay_preserve_echo_area=C2=A0 () + 4= 4=C2=A0 [0x100028dfc]=C2=A0 xdisp.c:14286
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0970 redisplay_internal=C2=A0 () + = 2034=C2=A0 [0x100027282]=C2=A0 xdisp.c:11850
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| 962 update_menu_bar=C2=A0 () + 4= 50=C2=A0 [0x10004c9b2]=C2=A0 xdisp.c:11960
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + 869 ns_update_menubar=C2=A0 ()= + 479=C2=A0 [0x1001cba6f]=C2=A0 nsmenu.m:139
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + ! 868 -[NSApplication setMainM= enu:]=C2=A0 (in AppKit) + 1584=C2=A0 [0x7fff8e8dc2c0]
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + ! : 868 -[NSMenu _addSidebandM= enuUpdaterForRoles:token:priority:handler:]=C2=A0 (in AppKit) + 229=C2=A0 [= 0x7fff8e8dc912]
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + ! :=C2=A0 =C2=A0868 -[NSMenu _= sidebandUpdaterRoles]=C2=A0 (in AppKit) + 41,47,...=C2=A0 [0x7fff8e8dca4d,0= x7fff8e8dca53,...]
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + ! 1 -[NSApplication setMainMen= u:]=C2=A0 (in AppKit) + 655=C2=A0 [0x7fff8e8dbf1f]
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + !=C2=A0 =C2=A01 objc_msgSend= =C2=A0 (in libobjc.A.dylib) + 26=C2=A0 [0x7fff8dbc54da]
=C2=A0 =C2=A0 + !=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0:=C2=A0 =C2=A0| + 57 ns_update_menubar=C2=A0 () = + 1577=C2=A0 [0x1001cbeb9]=C2=A0 nsmenu.m:454

--94eb2c1246104702f80534bf8ff8--