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
797bcd09
Commit
797bcd09
authored
Feb 20, 2016
by
Hisham
Browse files
Catch invalid IO values due to no permissions.
Display them properly. Not fully convinced of the "no perm" message...
parent
baec4bdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Process.c
View file @
797bcd09
...
...
@@ -335,7 +335,10 @@ void Process_outputRate(RichString* str, char* buffer, int n, double rate, int c
largeNumberColor
=
CRT_colors
[
PROCESS
];
processMegabytesColor
=
CRT_colors
[
PROCESS
];
}
if
(
rate
<
ONE_K
)
{
if
(
rate
==
-
1
)
{
int
len
=
snprintf
(
buffer
,
n
,
" no perm "
);
RichString_appendn
(
str
,
CRT_colors
[
PROCESS_SHADOW
],
buffer
,
len
);
}
else
if
(
rate
<
ONE_K
)
{
int
len
=
snprintf
(
buffer
,
n
,
"%7.2f B/s "
,
rate
);
RichString_appendn
(
str
,
processColor
,
buffer
,
len
);
}
else
if
(
rate
<
ONE_K
*
ONE_K
)
{
...
...
linux/LinuxProcess.c
View file @
797bcd09
...
...
@@ -313,7 +313,12 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
case
CNCLWB
:
Process_colorNumber
(
str
,
lp
->
io_cancelled_write_bytes
,
coloring
);
return
;
case
IO_READ_RATE
:
Process_outputRate
(
str
,
buffer
,
n
,
lp
->
io_rate_read_bps
,
coloring
);
return
;
case
IO_WRITE_RATE
:
Process_outputRate
(
str
,
buffer
,
n
,
lp
->
io_rate_write_bps
,
coloring
);
return
;
case
IO_RATE
:
Process_outputRate
(
str
,
buffer
,
n
,
lp
->
io_rate_read_bps
+
lp
->
io_rate_write_bps
,
coloring
);
return
;
case
IO_RATE
:
{
double
totalRate
=
(
lp
->
io_rate_read_bps
!=
-
1
)
?
(
lp
->
io_rate_read_bps
+
lp
->
io_rate_write_bps
)
:
-
1
;
Process_outputRate
(
str
,
buffer
,
n
,
totalRate
,
coloring
);
return
;
}
#endif
#ifdef HAVE_OPENVZ
case
CTID
:
snprintf
(
buffer
,
n
,
"%7u "
,
lp
->
ctid
);
break
;
...
...
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