Excessive Processor Use for a text-interface?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saw
    Scout
    • May 2010
    • 27

    Excessive Processor Use for a text-interface?

    I dunno... I used to play Moria on a Vax-11/780 back in 1986 along with 20 other people, and response time was great, so it surprises me to see all four of my AMD Phenom 9500 processors spike up to 60% usage, and my case fans power-up to disperse the generated heat whenever Angband is running...

    The processors spike, and remain spiked, as long as the Angband is running. As soon as I close the window, processor usage returns to normal.

    Angband itself, as a process, appears to be sleeping, and using only 4% of CPU, but wnk-applet spikes 68-75%+ constantly, and metacity as well, between 16 and 20%. They alternate between Running and Sleeping.

    Is this normal??? I can't imagine this much horsepower would be needed.

    Ubuntu 10.04 Lucid (but the problem has been seen from the very first time I loaded Angband back at Ubuntu 7.0)

    Angband version is now 3.0.8 (but the problem has been seen across all releases I've ever loaded)

    Thoughts? Suggestions? Solutions? Or is this "just the way it is"?
  • d_m
    Angband Devteam member
    • Aug 2008
    • 1517

    #2
    Originally posted by saw
    Angband itself, as a process, appears to be sleeping, and using only 4% of CPU, but wnk-applet spikes 68-75%+ constantly, and metacity as well, between 16 and 20%. They alternate between Running and Sleeping.

    Is this normal??? I can't imagine this much horsepower would be needed.

    Ubuntu 10.04 Lucid (but the problem has been seen from the very first time I loaded Angband back at Ubuntu 7.0)

    Angband version is now 3.0.8 (but the problem has been seen across all releases I've ever loaded)

    Thoughts? Suggestions? Solutions? Or is this "just the way it is"?
    3.0.8 is really old. Do you see this with one of the newer releases (3.1.2 or a nightly build)? Also, are you playing in a terminal, or via X11 or SDL or what? If you are using the GTK display mode that is known to be old, crufty, buggy and probably inefficient. If you run "angband -mgcu" I would be surprised if you saw this.
    linux->xterm->screen->pmacs

    Comment

    • SaThaRiel
      Adept
      • Nov 2009
      • 174

      #3
      Ubuntu Lucid should have 1:3.1.1.1626-1 as version.

      As d_m suggested, try a newer version or maybe the nightlies. Theyre not available directly but can be compiled without much problems.

      P.S. Can't see the behaviour with Lucid. Maybe you have a strange issue with you graphics driver? When its not installed correctly it uses the CPU instead of GPU to calculate - which is a bad idea today.
      Proud candidate for the Angband Darwin Award!

      Comment

      • saw
        Scout
        • May 2010
        • 27

        #4
        Originally posted by d_m
        3.0.8 is really old. Do you see this with one of the newer releases (3.1.2 or a nightly build)? Also, are you playing in a terminal, or via X11 or SDL or what? If you are using the GTK display mode that is known to be old, crufty, buggy and probably inefficient. If you run "angband -mgcu" I would be surprised if you saw this.
        3.08 is what's available in the Ubuntu package. I tried loading it differently once, and managed to trash my OS build, so I'm sticking to what's already packaged.

        I ran it from a terminal window, using -mgcu as you suggested and didn't see a processor problem, so it's in the interface somewhere.

        I'm running it in a Gnome window, and the reason I prefer that versus a terminal window, is that I can see almost the entire dungeon level in my widescreen, which is SO much more pleasant than the constant scrolling.

        That said - is there anything I can do to reduce the processor hogging and still get the widescreen view?

        Also - I'm still learning when it comes to Linux, so apologies if my terminology isn't quite right - I'm a mainframer by trade

        Comment

        • saw
          Scout
          • May 2010
          • 27

          #5
          Originally posted by SaThaRiel
          Ubuntu Lucid should have 1:3.1.1.1626-1 as version.

          As d_m suggested, try a newer version or maybe the nightlies. Theyre not available directly but can be compiled without much problems.

          P.S. Can't see the behaviour with Lucid. Maybe you have a strange issue with you graphics driver? When its not installed correctly it uses the CPU instead of GPU to calculate - which is a bad idea today.
          1.3.1.1 is the version - silly me, I grabbed it from the helptext

          The graphics driver is the most recent NVIDIA, and appears to be working properly. Any suggestions on settings for it?

          Comment

          • SaThaRiel
            Adept
            • Nov 2009
            • 174

            #6
            I think if your gpu driver wont work correctly you should recognize the high load somewhere else too - was just a guess
            To debug the problem it maybe a good start if you launch angband from a terminal and redirect stdout and stderror to a file which you can post here
            Code:
            angband > angband_errors.txt 2>&1
            Maybe there is something unusual (lots of wrong library calls). You just need to play some steps and then finish your game again, the file might grow too large otherwise.

            Also check if the angband you are using is really the angband from Ubuntu
            Code:
            which angband
            ls -l $(which angband)
            Maybe there is something left from your previous selfcompile installation.

            P.S. Basically i think that the main problem is that youre playing angband with a "resolution" of something like 600 rowsx100 cols. You should also post the window settings here. Can't test at the moment but maybe tomorrow.
            Last edited by SaThaRiel; July 20, 2010, 18:26.
            Proud candidate for the Angband Darwin Award!

            Comment

            • chris
              PosChengband Maintainer
              • Jan 2008
              • 702

              #7
              Originally posted by saw
              I'm running it in a Gnome window, and the reason I prefer that versus a terminal window, is that I can see almost the entire dungeon level in my widescreen, which is SO much more pleasant than the constant scrolling.
              I don't know if this is the same issue, but my CPU spikes when I maximize the terminal window under Ubuntu. But if the window is just large, and not quite maximized, CPU usage falls to near 0. You might want to try it out ...

              --Chris

              Comment

              • SaThaRiel
                Adept
                • Nov 2009
                • 174

                #8
                Hm, i can maximize the window in X11 (option -mx11) and the cpu load is just a little bit higher. But i am using the latest SVN version. Also i dont see any errors in my term window which is a good sign

                I may try the Ubuntu version later - also i don't have a really big screen.
                Proud candidate for the Angband Darwin Award!

                Comment

                • chris
                  PosChengband Maintainer
                  • Jan 2008
                  • 702

                  #9
                  Originally posted by chris
                  I don't know if this is the same issue, but my CPU spikes when I maximize the terminal window under Ubuntu. But if the window is just large, and not quite maximized, CPU usage falls to near 0. You might want to try it out ...

                  --Chris
                  I just installed 3.0.9 which is the only version of Angband available thru Synaptic Package Manager. When I maximize, both cores utilize 60% cpu each. When I "Unmaximize" the window, I can make it as large as I like, and both cores utilize about 3% cpu. I generally run Hengband rather than Angband, but I would guess that the Terminal handling code is the same between them. I am not running 10.04 of Ubuntu, but the version before that, although I can't figure out how to tell what version I am running.

                  I suspect this is an issue with terminal windows and Gnome, but I know precisely 0 about developing under linux. My monitor is 1680x1050.

                  It is odd that just maximizing a window would generate so much heat ... Good in Winter but bad in Summer

                  Comment

                  • chris
                    PosChengband Maintainer
                    • Jan 2008
                    • 702

                    #10
                    Originally posted by chris
                    I just installed 3.0.9 which is the only version of Angband available thru Synaptic Package Manager. When I maximize, both cores utilize 60% cpu each. When I "Unmaximize" the window, I can make it as large as I like, and both cores utilize about 3% cpu. I generally run Hengband rather than Angband, but I would guess that the Terminal handling code is the same between them. I am not running 10.04 of Ubuntu, but the version before that, although I can't figure out how to tell what version I am running.

                    I suspect this is an issue with terminal windows and Gnome, but I know precisely 0 about developing under linux. My monitor is 1680x1050.

                    It is odd that just maximizing a window would generate so much heat ... Good in Winter but bad in Summer
                    Noise noise noise ...

                    >angband -mgcu
                    Does not reproduce the problem
                    >angband
                    Reproduces the problem
                    >angband -mx11
                    Reproduces the problem

                    Comment

                    • SaThaRiel
                      Adept
                      • Nov 2009
                      • 174

                      #11
                      I think that angband and angband -mx11 is the same in Ubuntu (X11 seems to be default).
                      I recognized the behaviour too today on an Ubuntu PC - actually it wasn't angband itself that had the problem but the X-Server and some w...-something-process. I couldn't run angband on that today again and forgot the name of the process. But it showed up directly on top in top

                      Maybe its some antique X11 implementation angband is using?
                      Proud candidate for the Angband Darwin Award!

                      Comment

                      • Magnate
                        Angband Devteam member
                        • May 2007
                        • 5110

                        #12
                        Originally posted by SaThaRiel
                        I think that angband and angband -mx11 is the same in Ubuntu (X11 seems to be default).
                        I recognized the behaviour too today on an Ubuntu PC - actually it wasn't angband itself that had the problem but the X-Server and some w...-something-process. I couldn't run angband on that today again and forgot the name of the process. But it showed up directly on top in top

                        Maybe its some antique X11 implementation angband is using?
                        Yes. If it's any consolation, this has been known for a while - see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547261. Nobody knows the solution though - I suspect it's buried quite deep in mai?-x11.c
                        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                        Comment

                        • SaThaRiel
                          Adept
                          • Nov 2009
                          • 174

                          #13
                          Ok, so its a known bug...well, did some analysis with strace just to see a difference between ArchLinux (SVN build compiled on target machine) and Ubuntu (repository version).
                          It seems that there isn't much difference - Ubuntu
                          Code:
                          poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
                          writev(3, [{"Fd\5\0\3\1\240\2\2\0\240\2E\2y\0\n\0\24\0L\1\5\0\3\1\240\2\4\0\240\2"..., 860}, {NULL, 0}, {"", 0}], 3) = 860
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
                          read(3, "\2qW$\254\371\324\0\217\0\0\0\3\1\240\2\0\0\0\0\31\5o\0019\1(\1\0\0\1\0", 4096) = 32
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
                          writev(3, [{"Fd\5\0\3\1\240\2\2\0\240\2\353\1)\0\n\0\24\0L\1\5\0\3\1\240\2\4\0\240\2"..., 960}, {NULL, 0}, {"", 0}], 3) = 960
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}])
                          read(3, "\2q\207$L\372\324\0\217\0\0\0\3\1\240\2\0\0\0\0\31\5o\0019\1(\1\0\0\1\0", 4096) = 32
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
                          writev(3, [{"Fd\5\0\3\1\240\2\2\0\240\2\341\1)\0\n\0\24\0L\1\5\0\3\1\240\2\4\0\240\2"..., 800}, {NULL, 0}, {"", 0}], 3) = 800
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          read(3, 0x91d7600, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          and ArchLinux
                          Code:
                          poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
                          writev(3, [{"\f\1\5\0\3\1\240\2\f\0\240\2x\7\0\0v\4\0\0\f\1\5\0\3\1\240\2\f\0\240\2"..., 40}, {NULL, 0}, {"", 0}], 3) = 40
                          read(3, 0x8b68b90, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          nanosleep({0, 20000000}, NULL)          = 0
                          read(3, "\226\0007_\3\1\240\2\3\1\240\2\0\0\0\0\0\0\22\0\200\7\205\4\0\0\0\0\0\0\0\0"..., 4096) = 64
                          read(3, 0x8b68b90, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
                          writev(3, [{"\f\1\5\0\3\1\240\2\f\0\240\2x\7\0\0v\4\0\0\f\1\5\0\3\1\240\2\f\0\240\2"..., 40}, {NULL, 0}, {"", 0}], 3) = 40
                          read(3, 0x8b68b90, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          nanosleep({0, 20000000}, NULL)          = 0
                          read(3, "\226\0009_\3\1\240\2\3\1\240\2\0\0\0\0\0\0\22\0\200\7\205\4\0\0\0\0\0\0\0\0"..., 4096) = 64
                          read(3, 0x8b68b90, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
                          writev(3, [{"\f\1\5\0\3\1\240\2\f\0\240\2x\7\0\0v\4\0\0\f\1\5\0\3\1\240\2\f\0\240\2"..., 40}, {NULL, 0}, {"", 0}], 3) = 40
                          read(3, 0x8b68b90, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          nanosleep({0, 20000000}, NULL)          = 0
                          read(3, "\226\0;_\3\1\240\2\3\1\240\2\0\0\0\0\0\0\22\0\200\7\205\4\0\0\0\0\0\0\0\0"..., 4096) = 64
                          read(3, 0x8b68b90, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
                          I would say that the messages come from trying to access the sound device. Sadly i couldnt test the Ubuntu verson directly, will do this later.
                          Proud candidate for the Angband Darwin Award!

                          Comment

                          • AnonymousHero
                            Veteran
                            • Jun 2007
                            • 1393

                            #14
                            Just an idea: You could try building a profiliing build with debug symbols and then just let it run for a while. From a profile it should be quite easy to determine where it's spending most of its time. (Whether that be "inside" an XLib function or just in a busy loop somehwere.)

                            EDIT: The strace dump looks like it might be trying to send X commands over the local socket without actually waiting in between sends. ("EAGAIN" usually means that the socket buffer is full and that the write would block the X client app)

                            Comment

                            • SaThaRiel
                              Adept
                              • Nov 2009
                              • 174

                              #15
                              Sorry, my fault - i tested with a remote connection forwarding the stuff to my Arch X-Server. And this, as i should know(!!!) isnt the same.

                              Maybe i find the time to install a VM with Lucid this weeked so i can test it directly. And then i can also find out which processes are rumbling around. Maybe angband just needs to be recompiled using the correct directives? AFAIK the lib and include locations have changed in the last years.
                              Proud candidate for the Angband Darwin Award!

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎