Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
6330ff3a
Commit
6330ff3a
authored
Jun 02, 2009
by
Hisham Muhammad
Browse files
changes for htop 0.8.2
parent
1371ee28
Changes
25
Hide whitespace changes
Inline
Side-by-side
htop.1
View file @
6330ff3a
.TH "htop" "1" "0.8" "Bartosz Fenski <fenio@o2.pl>" "Utils"
.TH "htop" "1" "0.8
.2
" "Bartosz Fenski <fenio@o2.pl>" "Utils"
.SH "NAME"
htop \- interactive process viewer
.SH "SYNTAX"
...
...
htop.c
View file @
6330ff3a
...
...
@@ -26,6 +26,7 @@ in the source distribution for its full text.
#include "CategoriesPanel.h"
#include "SignalsPanel.h"
#include "TraceScreen.h"
#include "OpenFilesScreen.h"
#include "AffinityPanel.h"
#include "config.h"
...
...
@@ -110,8 +111,8 @@ static void showHelp(ProcessList* pl) {
mvaddstr
(
13
,
0
,
" Space: tag processes F: cursor follows process"
);
mvaddstr
(
14
,
0
,
" U: untag all processes"
);
mvaddstr
(
15
,
0
,
" F9 k: kill process/tagged processes P: sort by CPU%"
);
mvaddstr
(
16
,
0
,
"
+ [
F7:
low
er priority (
+ nice)
M: sort by MEM%"
);
mvaddstr
(
17
,
0
,
"
- ]
F8:
high
er priority (
root only)
T: sort by TIME"
);
mvaddstr
(
16
,
0
,
"
- ]
F7:
high
er priority (
root only)
M: sort by MEM%"
);
mvaddstr
(
17
,
0
,
"
+ [
F8:
low
er priority (
+ nice)
T: sort by TIME"
);
#ifdef HAVE_PLPA
if
(
pl
->
processorCount
>
1
)
mvaddstr
(
18
,
0
,
" a: set CPU affinity F4 I: invert sort order"
);
...
...
@@ -119,7 +120,7 @@ static void showHelp(ProcessList* pl) {
#endif
mvaddstr
(
18
,
0
,
" F4 I: invert sort order"
);
mvaddstr
(
19
,
0
,
" F2 S: setup F6 >: select sort column"
);
mvaddstr
(
20
,
0
,
" F1 h: show this help screen"
);
mvaddstr
(
20
,
0
,
" F1 h: show this help screen
l: list open files with lsof
"
);
mvaddstr
(
21
,
0
,
" F10 q: quit s: trace syscalls with strace"
);
attrset
(
CRT_colors
[
HELP_BOLD
]);
...
...
@@ -155,7 +156,7 @@ static char* CategoriesFunctions[10] = {" ", " ", " ", " ",
static
void
Setup_run
(
Settings
*
settings
,
int
headerHeight
)
{
ScreenManager
*
scr
=
ScreenManager_new
(
0
,
headerHeight
,
0
,
-
1
,
HORIZONTAL
,
true
);
CategoriesPanel
*
panelCategories
=
CategoriesPanel_new
(
settings
,
scr
);
ScreenManager_add
(
scr
,
(
Panel
*
)
panelCategories
,
FunctionBar_new
(
10
,
CategoriesFunctions
,
NULL
,
NULL
),
16
);
ScreenManager_add
(
scr
,
(
Panel
*
)
panelCategories
,
FunctionBar_new
(
CategoriesFunctions
,
NULL
,
NULL
),
16
);
CategoriesPanel_makeMetersPage
(
panelCategories
);
Panel
*
panelFocus
;
int
ch
;
...
...
@@ -166,7 +167,7 @@ static void Setup_run(Settings* settings, int headerHeight) {
static
bool
changePriority
(
Panel
*
panel
,
int
delta
)
{
bool
ok
=
true
;
bool
anyTagged
=
false
;
for
(
int
i
=
0
;
i
<
Panel_
getS
ize
(
panel
);
i
++
)
{
for
(
int
i
=
0
;
i
<
Panel_
s
ize
(
panel
);
i
++
)
{
Process
*
p
=
(
Process
*
)
Panel_get
(
panel
,
i
);
if
(
p
->
tag
)
{
ok
=
Process_setPriority
(
p
,
p
->
nice
+
delta
)
&&
ok
;
...
...
@@ -188,13 +189,13 @@ static HandlerResult pickWithEnter(Panel* panel, int ch) {
return
IGNORED
;
}
static
Object
*
pickFrom
List
(
Panel
*
panel
,
Panel
*
list
,
int
x
,
int
y
,
char
**
keyLabels
,
FunctionBar
*
prevBar
)
{
static
Object
*
pickFrom
Vector
(
Panel
*
panel
,
Panel
*
list
,
int
x
,
int
y
,
char
**
keyLabels
,
FunctionBar
*
prevBar
)
{
char
*
fuKeys
[
2
]
=
{
"Enter"
,
"Esc"
};
int
fuEvents
[
2
]
=
{
13
,
27
};
if
(
!
list
->
eventHandler
)
Panel_setEventHandler
(
list
,
pickWithEnter
);
ScreenManager
*
scr
=
ScreenManager_new
(
0
,
y
,
0
,
-
1
,
HORIZONTAL
,
false
);
ScreenManager_add
(
scr
,
list
,
FunctionBar_new
(
2
,
keyLabels
,
fuKeys
,
fuEvents
),
x
-
1
);
ScreenManager_add
(
scr
,
list
,
FunctionBar_new
(
keyLabels
,
fuKeys
,
fuEvents
),
x
-
1
);
ScreenManager_add
(
scr
,
panel
,
NULL
,
-
1
);
Panel
*
panelFocus
;
int
ch
;
...
...
@@ -209,7 +210,7 @@ static Object* pickFromList(Panel* panel, Panel* list, int x, int y, char** keyL
return
NULL
;
}
static
void
addUserTo
List
(
int
key
,
void
*
userCast
,
void
*
panelCast
)
{
static
void
addUserTo
Vector
(
int
key
,
void
*
userCast
,
void
*
panelCast
)
{
char
*
user
=
(
char
*
)
userCast
;
Panel
*
panel
=
(
Panel
*
)
panelCast
;
Panel_add
(
panel
,
(
Object
*
)
ListItem_new
(
user
,
key
));
...
...
@@ -274,6 +275,9 @@ int main(int argc, char** argv) {
if
(
arg
==
argc
-
1
)
printHelpFlag
();
arg
++
;
setUserOnly
(
argv
[
arg
],
&
userOnly
,
&
userId
);
}
else
{
fprintf
(
stderr
,
"Error: unknown flag: %s
\n
"
,
argv
[
arg
]);
exit
(
1
);
}
arg
++
;
}
...
...
@@ -321,14 +325,14 @@ int main(int argc, char** argv) {
}
Panel_setRichHeader
(
panel
,
ProcessList_printHeader
(
pl
));
char
*
searchFunctions
[
3
]
=
{
"Next "
,
"Exit "
,
" Search: "
};
char
*
searchKeys
[
3
]
=
{
"F3"
,
"Esc"
,
" "
};
int
searchEvents
[
3
]
=
{
KEY_F
(
3
),
27
,
ERR
};
FunctionBar
*
searchBar
=
FunctionBar_new
(
3
,
searchFunctions
,
searchKeys
,
searchEvents
);
char
*
searchFunctions
[]
=
{
"Next "
,
"Exit "
,
" Search: "
,
NULL
};
char
*
searchKeys
[]
=
{
"F3"
,
"Esc"
,
" "
};
int
searchEvents
[]
=
{
KEY_F
(
3
),
27
,
ERR
};
FunctionBar
*
searchBar
=
FunctionBar_new
(
searchFunctions
,
searchKeys
,
searchEvents
);
char
*
defaultFunctions
[
10
]
=
{
"Help "
,
"Setup "
,
"Search"
,
"Invert"
,
"Tree "
,
"SortBy"
,
"Nice -"
,
"Nice +"
,
"Kill "
,
"Quit "
};
FunctionBar
*
defaultBar
=
FunctionBar_new
(
10
,
defaultFunctions
,
NULL
,
NULL
);
char
*
defaultFunctions
[]
=
{
"Help "
,
"Setup "
,
"Search"
,
"Invert"
,
"Tree "
,
"SortBy"
,
"Nice -"
,
"Nice +"
,
"Kill "
,
"Quit "
,
NULL
};
FunctionBar
*
defaultBar
=
FunctionBar_new
(
defaultFunctions
,
NULL
,
NULL
);
ProcessList_scan
(
pl
);
usleep
(
75000
);
...
...
@@ -512,7 +516,7 @@ int main(int argc, char** argv) {
}
case
'U'
:
{
for
(
int
i
=
0
;
i
<
Panel_
getS
ize
(
panel
);
i
++
)
{
for
(
int
i
=
0
;
i
<
Panel_
s
ize
(
panel
);
i
++
)
{
Process
*
p
=
(
Process
*
)
Panel_get
(
panel
,
i
);
p
->
tag
=
false
;
}
...
...
@@ -558,6 +562,17 @@ int main(int argc, char** argv) {
CRT_enableDelay
();
break
;
}
case
'l'
:
{
OpenFilesScreen
*
ts
=
OpenFilesScreen_new
((
Process
*
)
Panel_getSelected
(
panel
));
OpenFilesScreen_run
(
ts
);
OpenFilesScreen_delete
(
ts
);
clear
();
FunctionBar_draw
(
defaultBar
,
NULL
);
refreshTimeout
=
0
;
CRT_enableDelay
();
break
;
}
case
'S'
:
case
'C'
:
case
KEY_F
(
2
):
...
...
@@ -581,12 +596,12 @@ int main(int argc, char** argv) {
{
Panel
*
usersPanel
=
Panel_new
(
0
,
0
,
0
,
0
,
LISTITEM_CLASS
,
true
,
ListItem_compare
);
Panel_setHeader
(
usersPanel
,
"Show processes of:"
);
UsersTable_foreach
(
ut
,
addUserTo
List
,
usersPanel
);
UsersTable_foreach
(
ut
,
addUserTo
Vector
,
usersPanel
);
Vector_sort
(
usersPanel
->
items
);
ListItem
*
allUsers
=
ListItem_new
(
"All users"
,
-
1
);
Panel_insert
(
usersPanel
,
0
,
(
Object
*
)
allUsers
);
char
*
fuFunctions
[
2
]
=
{
"Show "
,
"Cancel "
};
ListItem
*
picked
=
(
ListItem
*
)
pickFrom
List
(
panel
,
usersPanel
,
20
,
headerHeight
,
fuFunctions
,
defaultBar
);
char
*
fuFunctions
[]
=
{
"Show "
,
"Cancel "
,
NULL
};
ListItem
*
picked
=
(
ListItem
*
)
pickFrom
Vector
(
panel
,
usersPanel
,
20
,
headerHeight
,
fuFunctions
,
defaultBar
);
if
(
picked
)
{
if
(
picked
==
allUsers
)
{
userOnly
=
false
;
...
...
@@ -604,15 +619,15 @@ int main(int argc, char** argv) {
killPanel
=
(
Panel
*
)
SignalsPanel_new
(
0
,
0
,
0
,
0
);
}
SignalsPanel_reset
((
SignalsPanel
*
)
killPanel
);
char
*
fuFunctions
[
2
]
=
{
"Send "
,
"Cancel "
};
Signal
*
signal
=
(
Signal
*
)
pickFrom
List
(
panel
,
killPanel
,
15
,
headerHeight
,
fuFunctions
,
defaultBar
);
char
*
fuFunctions
[]
=
{
"Send "
,
"Cancel "
,
NULL
};
Signal
*
signal
=
(
Signal
*
)
pickFrom
Vector
(
panel
,
killPanel
,
15
,
headerHeight
,
fuFunctions
,
defaultBar
);
if
(
signal
)
{
if
(
signal
->
number
!=
0
)
{
Panel_setHeader
(
panel
,
"Sending..."
);
Panel_draw
(
panel
,
true
);
refresh
();
bool
anyTagged
=
false
;
for
(
int
i
=
0
;
i
<
Panel_
getS
ize
(
panel
);
i
++
)
{
for
(
int
i
=
0
;
i
<
Panel_
s
ize
(
panel
);
i
++
)
{
Process
*
p
=
(
Process
*
)
Panel_get
(
panel
,
i
);
if
(
p
->
tag
)
{
Process_sendSignal
(
p
,
signal
->
number
);
...
...
@@ -642,12 +657,12 @@ int main(int argc, char** argv) {
Panel
*
affinityPanel
=
AffinityPanel_new
(
pl
->
processorCount
,
curr
);
char
*
fuFunctions
[
2
]
=
{
"Set "
,
"Cancel "
};
void
*
set
=
pickFrom
List
(
panel
,
affinityPanel
,
15
,
headerHeight
,
fuFunctions
,
defaultBar
);
void
*
set
=
pickFrom
Vector
(
panel
,
affinityPanel
,
15
,
headerHeight
,
fuFunctions
,
defaultBar
);
if
(
set
)
{
unsigned
long
new
=
AffinityPanel_getAffinity
(
affinityPanel
);
bool
anyTagged
=
false
;
bool
ok
=
true
;
for
(
int
i
=
0
;
i
<
Panel_
getS
ize
(
panel
);
i
++
)
{
for
(
int
i
=
0
;
i
<
Panel_
s
ize
(
panel
);
i
++
)
{
Process
*
p
=
(
Process
*
)
Panel_get
(
panel
,
i
);
if
(
p
->
tag
)
{
ok
=
Process_setAffinity
(
p
,
new
)
&&
ok
;
...
...
@@ -689,7 +704,7 @@ int main(int argc, char** argv) {
Panel_setSelected
(
sortPanel
,
i
);
free
(
name
);
}
ListItem
*
field
=
(
ListItem
*
)
pickFrom
List
(
panel
,
sortPanel
,
15
,
headerHeight
,
fuFunctions
,
defaultBar
);
ListItem
*
field
=
(
ListItem
*
)
pickFrom
Vector
(
panel
,
sortPanel
,
15
,
headerHeight
,
fuFunctions
,
defaultBar
);
if
(
field
)
{
settings
->
changed
=
true
;
setSortKey
(
pl
,
field
->
key
,
panel
,
settings
);
...
...
htop.h
View file @
6330ff3a
...
...
@@ -30,6 +30,7 @@ in the source distribution for its full text.
#include "CategoriesPanel.h"
#include "SignalsPanel.h"
#include "TraceScreen.h"
#include "OpenFilesScreen.h"
#include "AffinityPanel.h"
#include "config.h"
...
...
plpa-1.1/Makefile.in
View file @
6330ff3a
...
...
@@ -122,6 +122,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION
=
@PACKAGE_VERSION@
PATH_SEPARATOR
=
@PATH_SEPARATOR@
RANLIB
=
@RANLIB@
SED
=
@SED@
SET_MAKE
=
@SET_MAKE@
SHELL
=
@SHELL@
STRIP
=
@STRIP@
...
...
plpa-1.1/src/Makefile.in
View file @
6330ff3a
...
...
@@ -157,6 +157,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION
=
@PACKAGE_VERSION@
PATH_SEPARATOR
=
@PATH_SEPARATOR@
RANLIB
=
@RANLIB@
SED
=
@SED@
SET_MAKE
=
@SET_MAKE@
SHELL
=
@SHELL@
STRIP
=
@STRIP@
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment