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
9791901b
Commit
9791901b
authored
7 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Fix sorting of OS-specific fields
parent
5fdfb3d8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Object.c
+1
-1
Object.c
Object.h
+1
-1
Object.h
darwin/DarwinProcessList.c
+1
-1
darwin/DarwinProcessList.c
linux/LinuxProcess.c
+4
-5
linux/LinuxProcess.c
linux/LinuxProcessList.c
+2
-1
linux/LinuxProcessList.c
with
9 additions
and
9 deletions
+9
-9
Object.c
View file @
9791901b
...
...
@@ -27,7 +27,7 @@ typedef void(*Object_Delete)(Object*);
#define Class(class_) ((ObjectClass*)(&(class_ ## _class)))
#define AllocThis(class_) (class_*) x
M
alloc(sizeof(class_)); Object_setClass(this, Class(class_));
#define AllocThis(class_) (class_*) x
C
alloc(sizeof(class_)
, 1
); Object_setClass(this, Class(class_));
typedef struct ObjectClass_ {
const void* extends;
...
...
This diff is collapsed.
Click to expand it.
Object.h
View file @
9791901b
...
...
@@ -28,7 +28,7 @@ typedef void(*Object_Delete)(Object*);
#define Class(class_) ((ObjectClass*)(&(class_ ## _class)))
#define AllocThis(class_) (class_*) x
M
alloc(sizeof(class_)); Object_setClass(this, Class(class_));
#define AllocThis(class_) (class_*) x
C
alloc(sizeof(class_)
, 1
); Object_setClass(this, Class(class_));
typedef
struct
ObjectClass_
{
const
void
*
extends
;
...
...
This diff is collapsed.
Click to expand it.
darwin/DarwinProcessList.c
View file @
9791901b
...
...
@@ -108,7 +108,7 @@ struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) {
ProcessList
*
ProcessList_new
(
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
)
{
DarwinProcessList
*
this
=
xCalloc
(
1
,
sizeof
(
DarwinProcessList
));
ProcessList_init
(
&
this
->
super
,
Class
(
Process
),
usersTable
,
pidWhiteList
,
userId
);
ProcessList_init
(
&
this
->
super
,
Class
(
Darwin
Process
),
usersTable
,
pidWhiteList
,
userId
);
/* Initialize the CPU information */
this
->
super
.
cpuCount
=
ProcessList_allocateCPULoadInfo
(
&
this
->
prev_load
);
...
...
This diff is collapsed.
Click to expand it.
linux/LinuxProcess.c
View file @
9791901b
...
...
@@ -268,8 +268,7 @@ ObjectClass LinuxProcess_class = {
};
Process
*
Process_new
(
Settings
*
settings
)
{
LinuxProcess
*
this
=
xCalloc
(
1
,
sizeof
(
LinuxProcess
));
Object_setClass
(
this
,
Class
(
LinuxProcess
));
LinuxProcess
*
this
=
AllocThis
(
LinuxProcess
);
Process_init
(
&
this
->
super
,
settings
);
return
(
Process
*
)
this
;
}
...
...
@@ -441,9 +440,9 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
case
RBYTES
:
diff
=
p2
->
io_read_bytes
-
p1
->
io_read_bytes
;
goto
test_diff
;
case
WBYTES
:
diff
=
p2
->
io_write_bytes
-
p1
->
io_write_bytes
;
goto
test_diff
;
case
CNCLWB
:
diff
=
p2
->
io_cancelled_write_bytes
-
p1
->
io_cancelled_write_bytes
;
goto
test_diff
;
case
IO_READ_RATE
:
diff
=
p2
->
io_rate_read_bps
-
p1
->
io_rate_read_bps
;
goto
test_diff
;
case
IO_WRITE_RATE
:
diff
=
p2
->
io_rate_write_bps
-
p1
->
io_rate_write_bps
;
goto
test_diff
;
case
IO_RATE
:
diff
=
(
p2
->
io_rate_read_bps
+
p2
->
io_rate_write_bps
)
-
(
p1
->
io_rate_read_bps
+
p1
->
io_rate_write_bps
)
;
goto
test_diff
;
case
IO_READ_RATE
:
return
p2
->
io_rate_read_bps
>
p1
->
io_rate_read_bps
?
1
:
-
1
;
case
IO_WRITE_RATE
:
return
p2
->
io_rate_write_bps
>
p1
->
io_rate_write_bps
?
1
:
-
1
;
case
IO_RATE
:
return
(
p2
->
io_rate_read_bps
+
p2
->
io_rate_write_bps
)
>
(
p1
->
io_rate_read_bps
+
p1
->
io_rate_write_bps
)
?
1
:
-
1
;
#endif
#ifdef HAVE_OPENVZ
case
CTID
:
...
...
This diff is collapsed.
Click to expand it.
linux/LinuxProcessList.c
View file @
9791901b
...
...
@@ -6,6 +6,7 @@ in the source distribution for its full text.
*/
#include "LinuxProcessList.h"
#include "LinuxProcess.h"
#include "CRT.h"
#include "StringUtils.h"
#include <errno.h>
...
...
@@ -217,7 +218,7 @@ static void LinuxProcessList_initNetlinkSocket(LinuxProcessList* this) {
ProcessList
*
ProcessList_new
(
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
)
{
LinuxProcessList
*
this
=
xCalloc
(
1
,
sizeof
(
LinuxProcessList
));
ProcessList
*
pl
=
&
(
this
->
super
);
ProcessList_init
(
pl
,
Class
(
Process
),
usersTable
,
pidWhiteList
,
userId
);
ProcessList_init
(
pl
,
Class
(
Linux
Process
),
usersTable
,
pidWhiteList
,
userId
);
LinuxProcessList_initTtyDrivers
(
this
);
...
...
This diff is collapsed.
Click to expand it.
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