unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Anders Lindgren <andlind@gmail.com>
To: David Reitter <david.reitter@gmail.com>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: Redisplay: NS port, high CPU load
Date: Wed, 8 Jun 2016 09:50:30 +0200	[thread overview]
Message-ID: <CABr8ebahnH+t9h9LF2QsOmgKg-oz8ym+fEpVSxecozjPaDXANg@mail.gmail.com> (raw)
In-Reply-To: <9793F9E3-979A-4888-8662-F6E0C27C8B37@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4328 bytes --]

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 <david.reitter@gmail.com>
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-incided
> 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’m getting the spinning beachball sometimes when entering a minibuffer
> for a command.
>
> I would like to fix this problem, but have been unsuccessful in tracing it
> down.  As you can see, we’re 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’t
> tell if the problem exists in GNU Emacs as it probably interacts with some
> 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_<multiple>
>     + 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:684
>     + !       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
>

[-- Attachment #2: Type: text/html, Size: 5107 bytes --]

  reply	other threads:[~2016-06-08  7:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08  6:04 Redisplay: NS port, high CPU load David Reitter
2016-06-08  7:50 ` Anders Lindgren [this message]
2016-06-08 10:44   ` David Reitter
2016-06-08 19:55     ` Alan Third
2016-06-08 20:12       ` David Reitter
2016-06-09  1:03         ` David Reitter
2016-06-09  8:22           ` David Reitter
2016-06-09  9:25             ` Anders Lindgren
2016-06-09 13:04               ` David Reitter
2016-06-09 14:11                 ` Anders Lindgren
2016-06-09 18:03                   ` David Reitter
2016-06-09 18:52                     ` Anders Lindgren
2016-06-09 23:03                       ` David Reitter
2016-06-10  6:02                         ` Anders Lindgren
2016-06-10  8:16                           ` David Reitter
2016-06-10  9:34                             ` Eli Zaretskii
2016-06-10  9:46                               ` David Reitter
2016-06-10 10:22                                 ` Eli Zaretskii
2016-06-10 10:36                                   ` David Reitter
2016-06-13 18:44                                     ` Anders Lindgren
2016-06-13 19:16                                       ` Eli Zaretskii
2016-06-14 12:07                                         ` David Reitter
2016-06-14 17:02                                           ` Eli Zaretskii
2016-06-15  3:55                                           ` Stefan Monnier
2016-06-14 11:50                                       ` David Reitter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABr8ebahnH+t9h9LF2QsOmgKg-oz8ym+fEpVSxecozjPaDXANg@mail.gmail.com \
    --to=andlind@gmail.com \
    --cc=david.reitter@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).