Jann Horn | 29 Apr 2013 23:14

PATCH: Speed up htop

Hello.

A few days ago, I bought a Raspberry Pi. Those things don't exactly have much
computation power (700MHz ARM), but they're still quite nice. Well, when I ran
"htop", I was a bit disappointed about it using quite some CPU resources. I had
a look at the output of `strace` and saw that there was an anonymous mmap per
opened file (because of stdio) and that there were many invocations of
gettimeofday. Also, callgrind showed that quite some time was spent for parsing
scanf format strings.

I wrote a small patch that makes htop run faster (see the attachment). On my
Raspberry Pi, when filtering for "htop" and sorting by PID, htop with my patch
uses ~4-6% CPU while htop without my patch (from SVN) uses ~7-11% CPU – but
please measure yourself.

In some places, this makes the code a little bit bigger, but I think that the
increase in speed is worth it.

What do you think about this? Will you merge this patch?

Jann
Attachment (htop_speedup.diff): text/x-diff, 13 KiB
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
(Continue reading)

Chris Jones | 8 Apr 2013 19:22
Picon

Enhancement request - color schemes

Maybe this has already been requested.. but here goes.

I downloaded the htop source package from the debian repository and took
a quick look at the code and it appears that I need to patch the code to
implement a color scheme that suits my requirements.

Would it be possible at some point in the future to make it possible to
change the color scheme via a configuration file, possibly with
256-color support for added flexibility?

Naturally, since htop uses the underlying terminal's colors, it's always
possible to modify them at execution time.. The problem with this
approach is that when you use a terminal multiplexer such as gnu/screen
or tmux, applications running in other windows are also affected.

Thanks,

CJ

--

-- 
Have a nice day!

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
Warren W. Kretzschmar | 26 Mar 2013 17:40
Picon
Gravatar

user color same as bacground color in black night

Hi,
This is only minor, but I keep wishing this was different. 

I use the "Black Night" theme with htop, and I really like it.  However, I find the fact that users that aren't myself are colored the background color to be inconvenient.  In order to get a quick view of who else is running things, I need to move the selection across their jobs.   Would it be possible to color the user names something other than the background color?  Preferably something different than the main user.  I think this is also an issue with other themes.

Thanks,
Warren
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
Ganapati Bhat | 25 Feb 2013 12:28
Picon

Porting htop for Android

Dear All,

I was trying to port htop 1.0.2 to android using an Android.mk from htop 0.9 version. However in the compilation of Process.c it is saying SYS_ioprio_set undeclared. I think this is because the file giving the system call numbers has not been included. How should I include the file which is defined in my Kernel?
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
Chris Jones | 11 Feb 2013 09:01
Picon

Hide PF-keys help footer

I have been using htop daily for years and for mysterious reasons¹
I never got to take a look at the doc or even as much as hit F1 to bring
up the help screen..

Now, the _only_ thing that I never liked much about htop was that
I thought you had to use function keys to interact: bit of a pain with
laptops because function keys are usually undersized and that makes them
hard to reach². 

Couple of hours ago, I accidentally hit what turned out to be the 't'
key and much to my surprise, htop switched to the tree view. Uh-oh..
thought I.. what's going on. ? 

I tried the "H" key and bingo, up came the help screen.. and there it
was.. a nice reference card with all the convenient keyboard actions
that I never even suspected existed..

I can't say how embarrassed I felt.. and at the same time I must admit
that this lucky finding has made my day..!

Now here's the question: since where I am concerned that footer has
become irrelevant--it only mentions function keys, not the alternative
letter shortcuts--I'd rather get rid of it.

Is there any way I could do that with htop version 1.0.1-1..?

Thanks,

CJ

¹ Come to think of it, the reason may very well have been the on-screen
  help footer: Since it tells you to use function keys, I just tried
  them one after the other and was able to figure out how to use the
  different screens and features of htop without any problems. It just
  goes to show that when you are dealing with unimaginative people such
  as myself it may be best to tell them to just go "Read The Famous
  Manual" :-)

² Not to mention the fact that contrary to letters, PF keys are not
  mnemonic, hence harder to memorize..

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
Richard Braun | 29 Jan 2013 18:10

Request: adding dirty memory to memory meter

Hello,

What would you fellow htop users think about adding the amount of dirty
pages to the memory meter ? Also, I personally consider it much more
important than separating buffer from cache memory (these could simply
be merged into "cached" memory altogether).

What's your opinion on this ?

--

-- 
Richard Braun

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
Jonathan Bayer | 23 Jan 2013 19:27
Picon

Great prog, and a couple of questions

Hi,

I just installed this, thanks for doing it.

A couple of questions:

1.  The normal "top" command has an option, when you type the number "1", it switches between showing all the CPUs and just an overall cpu info line.  Is this possible with htop?

2.  I went into the settings to try to change the cpu info being listed, but it only seemed to be able to cycle through a subset of the cpu meters.  For example, I wanted to replace all the CPUs being shown with the cpu average, but was unable to do that in the setup screen; I had to edit the .htoprc file to do this.


Thank



JBB
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
metwarp | 4 Jan 2013 15:21

Showing the memory column in a more human readable form.

Hi,

By default, the numbers in the memory column are shown in MBs only if
they are > 100,000 Bytes.

So, is there a way to show the numbers in the memory columns in a more
human readable form?  When I mean by human readable, I mean something
similar to the `-h` switch of `ls` -- starts at B, KB, then MB, GB etc.

If there isn't such a feature, would it be possible to implement one?
I'm using htop version 1.0.1 from the Ubuntu repositories.

Thanks a lot (for htop and otherwise)!

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
Bartłomiej Palmowski | 1 Dec 2012 17:48
Picon

[FEATURE REQUEST] allow -u option argument to be optional

Hi,

it occured to me that it would be very convinient to be able not to
pass argument to -u,--user. Not passing any argument would mean that
only processes of current a user should be shown. Please see attached
patch. Mind that it changes current behaviour of -u, 'htop -u foo' is
no longer valid in this case, it needs to be written as 'htop -ufoo'
or 'htop --user=foo', and of course 'htop -u' or 'htop --user' passes
current user implicitly.

BR, Bartek
Attachment (htop_optional_user.diff): application/octet-stream, 1236 bytes
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
Hisham | 6 Nov 2012 20:53
Favicon
Gravatar

[ANN] htop 1.0.2

Hello,

I'm happy to announce htop 1.0.2!

https://sourceforge.net/projects/htop/

The major feature from this release is IO priority setting. You can
now press "i" and get the IO priority menu, where you can adjust the
IO scheduling class of your processes.
It also includes some fixes. Thanks to everyone who contributed bug
reports and patches. The ChangeLog follows in the end of this message.

Downloads, as usual, are available from the SourceForge project page:

https://sourceforge.net/projects/htop/files/htop/1.0.2/

Cheers!

-- Hisham
http://hisham.hm/

What's new in version 1.0.2

* Add IO priority support ('i' key)
* Avoid deleting .htoprc if it is a symlink
* Fail gracefully when /proc is not mounted
  (thanks to Philipp Hagemeister)
* Option to update process names on every refresh
  (thanks to Rob Hoelz)
* BUGFIX: Fix crashes when process list is empty

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
Rob Hoelz | 4 Oct 2012 10:38
Picon
Favicon
Gravatar

Patch for htop: Refresh process names

Hi there!

I have another patch for htop!  htop currently does not update a
process' name if it changes (some scripts set their process name to
reflect their role or progress); this patch changes that.

Thanks,
Rob
diff --git a/ProcessList.c b/ProcessList.c
index bbb5cff..90f057a 100644
--- a/ProcessList.c
+++ b/ProcessList.c
 <at>  <at>  -701,12 +701,12  <at>  <at>  static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
          ProcessList_readVServerData(process, dirname, name);
          #endif

-         if (! ProcessList_readCmdlineFile(process, dirname, name))
-            goto errorReadingProcess;
-
          ProcessList_add(this, process);
       }

+     if (! ProcessList_readCmdlineFile(process, dirname, name))
+        goto errorReadingProcess;
+
       if (process->state == 'Z') {
          free(process->comm);
          process->comm = strdup(command);
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev

Gmane