htop - an interactive process viewer
Go to file
Explorer09 bf35921abb Optimize Strings_startWith()
Use strncmp() combined with a strlen() will give better performance
than a strstr in worst case. Especially when the match prefix is a
constant and not a variable.

While we are at it, replace the match() function in linux/Battery.c,
which uses a naive algorithm, with a macro that does better job by
utilizing Strings_startWith().

    $ gcc --version | head -n 1
    gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
    $ uname -m
    x86_64
    $ size htop.old htop.new
       text   data    bss    dec    hex filename
     137929  15112   3776 156817  26491 htop.old
     137784  15104   3776 156664  263f8 htop.new

Signed-off-by: Kang-Che Sung <explorer09 @ gmail.com>
2016-08-11 10:49:35 +08:00
darwin Remove needless allocation error conditions 2016-04-29 21:10:05 -04:00
freebsd Merge pull request #496 from tcreech/lwp_hack 2016-05-19 15:44:57 -03:00
linux Optimize Strings_startWith() 2016-08-11 10:49:35 +08:00
openbsd Remove needless allocation error conditions 2016-04-29 21:10:05 -04:00
scripts Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
unsupported Make unsupported platform build again. 2016-02-14 11:45:47 -02:00
.editorconfig add editorconfig file to give hints to editors 2015-10-05 11:13:17 +02:00
.gitignore remove autoconf files, generate by autogen.sh 2015-07-15 09:30:38 +02:00
.travis.yml travis-ci should really detect autogen.sh... 2015-11-19 13:14:20 -02:00
AUTHORS Initial import. 2006-03-04 18:16:49 +00:00
Action.c Auto-follow process after a search. 2016-05-05 10:30:06 -03:00
Action.h Auto-follow process after a search. 2016-05-05 10:30:06 -03:00
Affinity.c Portable affinity using hwloc 2016-02-14 19:57:29 -02:00
Affinity.h Portable affinity using hwloc 2016-02-14 19:57:29 -02:00
AffinityPanel.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
AffinityPanel.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
AvailableColumnsPanel.c Do not trust isalpha(c) for values > 255. 2015-03-23 18:14:35 -03:00
AvailableColumnsPanel.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
AvailableMetersPanel.c Assert (Platform_meterTypes[0]==&CPUMeter_class) 2016-03-19 15:01:13 +08:00
AvailableMetersPanel.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
BatteryMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
BatteryMeter.h Move platform-dependent parts of Linux battery meter. 2014-11-27 21:04:57 -02:00
COPYING Resolve license incompatibility issues, 2010-02-24 21:13:45 +00:00
CPUMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
CPUMeter.h Calculate CPU averages on Darwin (See #295). 2015-10-23 13:46:21 -02:00
CRT.c Handle SIGQUIT. Closes #503. 2016-05-30 15:06:22 -03:00
CRT.h Avoid overlapping key values defined by curses (Real fix). 2016-03-09 10:16:34 +08:00
CategoriesPanel.c Added Ctrl+A and Ctrl+E to go to beginning and end of line. 2016-06-15 12:45:23 -03:00
CategoriesPanel.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
ChangeLog Changelog for htop 2.0.2 2016-07-21 17:12:45 -03:00
CheckItem.c Avoid future confusions with how default values are set. 2015-08-12 17:29:32 -03:00
CheckItem.h Avoid future confusions with how default values are set. 2015-08-12 17:29:32 -03:00
ClockMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
ClockMeter.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
ColorsPanel.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
ColorsPanel.h Make the implementation of color schemes declarative. 2015-02-03 22:30:05 +01:00
ColumnsPanel.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
ColumnsPanel.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
DisplayOptionsPanel.c Try to make threads less confusing. 2016-02-02 16:39:08 +01:00
DisplayOptionsPanel.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
EnvScreen.c Silence warnings about seteuid return value. 2016-05-25 21:37:07 -03:00
EnvScreen.h refactor *Screen classes, add InfoScreen superclass 2016-01-12 06:00:58 -02:00
FunctionBar.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
FunctionBar.h Simplify constructors. 2015-03-23 19:24:34 -03:00
Hashtable.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Hashtable.h major header cleanup 2011-12-26 21:35:57 +00:00
Header.c Fix macro Header_forEachColumn 2016-05-07 14:57:51 +08:00
Header.h Fix macro Header_forEachColumn 2016-05-07 14:57:51 +08:00
HostnameMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
HostnameMeter.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
INSTALL Update INSTALL text from autoconf-2.69 2016-05-08 14:35:20 +08:00
IncSet.c Auto-follow process after a search. 2016-05-05 10:30:06 -03:00
IncSet.h Auto-follow process after a search. 2016-05-05 10:30:06 -03:00
InfoScreen.c Refresh whole panel on Ctrl+L in infoscreen. 2016-06-23 13:25:58 -03:00
InfoScreen.h refactor *Screen classes, add InfoScreen superclass 2016-01-12 06:00:58 -02:00
ListItem.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
ListItem.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
LoadAverageMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
LoadAverageMeter.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
MainPanel.c 'Follow' only if element is found in search 2016-07-28 11:37:44 -03:00
MainPanel.h Make sure a pointer fits in the argument! 2016-05-25 16:46:47 -03:00
Makefile.am Force -lgcov harder when running `make coverage`. 2016-02-19 13:40:21 -02:00
MemoryMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
MemoryMeter.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
Meter.c Let BarMeterMode_characters[] be const array. 2016-07-22 14:58:29 +08:00
Meter.h Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
MetersPanel.c Fixes #498. 2016-05-25 21:29:06 -03:00
MetersPanel.h Improve feedback when moving meters. 2015-08-27 19:14:13 -03:00
NEWS cleanup old stuff 2011-11-21 02:58:34 +00:00
Object.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Object.h Check for failure in allocations. 2016-02-02 15:53:02 +01:00
OpenFilesScreen.c Dynamically adjust the size of line reads 2016-06-19 18:55:35 -03:00
OpenFilesScreen.h refactor *Screen classes, add InfoScreen superclass 2016-01-12 06:00:58 -02:00
Panel.c Fix scrolling behavior change caused by 759caf0f 2016-08-07 07:49:37 +08:00
Panel.h Added Ctrl+A and Ctrl+E to go to beginning and end of line. 2016-06-15 12:45:23 -03:00
Process.c Let's keep it simple then! 2016-06-20 12:11:49 -03:00
Process.h Silence cast warning. 2016-05-30 12:22:07 -03:00
ProcessList.c Release resource when using hwloc 2016-02-29 21:57:27 -03:00
ProcessList.h Portable affinity using hwloc 2016-02-14 19:57:29 -02:00
README Minor tweaks to the README 2016-02-11 17:20:50 -02:00
README.md Add README.md for Github 2014-02-03 09:11:39 -02:00
RichString.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
RichString.h Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses. 2016-01-15 20:26:01 +08:00
ScreenManager.c Added Ctrl+A and Ctrl+E to go to beginning and end of line. 2016-06-15 12:45:23 -03:00
ScreenManager.h Move FunctionBar inside Panel 2015-03-23 15:26:56 -03:00
Settings.c Dynamically adjust the size of line reads 2016-06-19 18:55:35 -03:00
Settings.h Merge pull request #148 from nckx/display-basename 2015-08-12 17:16:50 -03:00
SignalsPanel.c Fix build in FreeBSD, and make sure SIGTERM is always the default. 2015-10-06 12:50:31 -03:00
SignalsPanel.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
StringUtils.c Optimize Strings_startWith() 2016-08-11 10:49:35 +08:00
StringUtils.h Optimize Strings_startWith() 2016-08-11 10:49:35 +08:00
SwapMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
SwapMeter.h use dynamic units for text display 2015-08-27 06:13:27 +02:00
TESTPLAN Fix failing stuff. 2015-04-09 15:56:43 -03:00
TasksMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
TasksMeter.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
TraceScreen.c Silence warnings about seteuid return value. 2016-05-25 21:37:07 -03:00
TraceScreen.h refactor *Screen classes, add InfoScreen superclass 2016-01-12 06:00:58 -02:00
UptimeMeter.c Rename Meter.setValues() functions to updateValues() 2016-05-04 13:39:26 +08:00
UptimeMeter.h Move UptimeMeter back into cross-platform code. 2014-11-27 19:34:47 -02:00
UsersTable.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
UsersTable.h major header cleanup 2011-12-26 21:35:57 +00:00
Vector.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Vector.h Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
XAlloc.c Fix xStrdup debug build failure & allow Clang to use ((nonnull)) 2016-06-03 10:14:27 +08:00
XAlloc.h Fix xStrdup debug build failure & allow Clang to use ((nonnull)) 2016-06-03 10:14:27 +08:00
autogen.sh Simplify autogen.sh 2016-02-14 22:36:40 +01:00
configure.ac Preparing release 2.0.2, a minor bugfix release. 2016-07-21 16:54:41 -03:00
htop.1.in Use "-" as the Ctrl and Alt joiner. 2016-06-17 22:14:07 -03:00
htop.c Remove old commented code. 2016-02-19 13:39:38 -02:00
htop.desktop Add Keywords entry to .desktop file (Debian Lintian warning desktop-entry-lacks-keywords-entry) 2016-04-19 19:06:03 +02:00
htop.h Sorry about the mega-patch. 2015-01-21 23:27:31 -02:00
htop.png Updated icon! 2014-04-09 14:47:58 -03:00
test_spec.lua Tweaks on the test suite, still problematic. 2016-02-19 13:40:00 -02:00

README.md

Build Status PayPal donate

htop

by Hisham Muhammad hisham@gobolinux.org (2004 - 2016)

Introduction

This is htop, an interactive process viewer. It requires ncurses. It is developed primarily on Linux, but we also have code for running under FreeBSD and Mac OS X (help and testing are wanted for these platforms!)

This software has evolved considerably over the years, and is reasonably complete, but there is always room for improvement.

Comparison between htop and classic top

  • In htop you can scroll the list vertically and horizontally to see all processes and full command lines.
  • In top you are subject to a delay for each unassigned key you press (especially annoying when multi-key escape sequences are triggered by accident).
  • htop starts faster (top seems to collect data for a while before displaying anything).
  • In htop you don't need to type the process number to kill a process, in top you do.
  • In htop you don't need to type the process number or the priority value to renice a process, in top you do.
  • In htop you can kill multiple processes at once.
  • top is older, hence, more tested.

Compilation instructions

This program is distributed as a standard autotools-based package. See the INSTALL file for detailed instructions.

When compiling from a release tarball, run:

./configure && make

For compiling sources downloaded from the Git repository, run:

./autogen.sh && ./configure && make

By default make install will install into /usr/local, for changing the path use ./configure --prefix=/some/path.

See the manual page (man htop) or the on-line help ('F1' or 'h' inside htop) for a list of supported key commands.

If not all keys work check your curses configuration.

License

GNU General Public License, version 2 (GPL-2.0)