mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-15 13:34:35 +03:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d891c3851 | |||
d357c67717 | |||
e1a7e2bdef | |||
d2f767e607 | |||
b1e9d716f2 | |||
6271138237 | |||
255c62a460 | |||
9710a43001 | |||
df20abfd67 | |||
d46dcf99fd | |||
f56c8014f7 | |||
a227b20fef |
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
What's new in version 0.6.6
|
||||
|
||||
* Add support of NLWP field
|
||||
(thanks to Bert Wesarg)
|
||||
* BUGFIX: Fix use of configurable /proc location
|
||||
(thanks to Florent Thoumie)
|
||||
* Fix memory percentage calculation and make it saner
|
||||
(thanks to Olev Kartau for the report)
|
||||
* Added display of DRS, DT, LRS and TRS
|
||||
(thanks to Matthias Lederhofer)
|
||||
* BUGFIX: LRS and DRS memory values were flipped
|
||||
(thanks to Matthias Lederhofer)
|
||||
* BUGFIX: Don't crash on very high UIDs
|
||||
(thanks to Egmont Koblinger)
|
||||
|
||||
What's new in version 0.6.5
|
||||
|
||||
|
16
Hashtable.c
16
Hashtable.c
@ -19,7 +19,7 @@ typedef struct Hashtable_ Hashtable;
|
||||
typedef void(*Hashtable_PairFunction)(int, void*, void*);
|
||||
|
||||
typedef struct HashtableItem {
|
||||
int key;
|
||||
unsigned int key;
|
||||
void* value;
|
||||
struct HashtableItem* next;
|
||||
} HashtableItem;
|
||||
@ -61,7 +61,7 @@ int Hashtable_count(Hashtable* this) {
|
||||
|
||||
#endif
|
||||
|
||||
HashtableItem* HashtableItem_new(int key, void* value) {
|
||||
HashtableItem* HashtableItem_new(unsigned int key, void* value) {
|
||||
HashtableItem* this;
|
||||
|
||||
this = (HashtableItem*) malloc(sizeof(HashtableItem));
|
||||
@ -104,8 +104,8 @@ inline int Hashtable_size(Hashtable* this) {
|
||||
return this->items;
|
||||
}
|
||||
|
||||
void Hashtable_put(Hashtable* this, int key, void* value) {
|
||||
int index = key % this->size;
|
||||
void Hashtable_put(Hashtable* this, unsigned int key, void* value) {
|
||||
unsigned int index = key % this->size;
|
||||
HashtableItem** bucketPtr = &(this->buckets[index]);
|
||||
while (true)
|
||||
if (*bucketPtr == NULL) {
|
||||
@ -122,8 +122,8 @@ void Hashtable_put(Hashtable* this, int key, void* value) {
|
||||
assert(Hashtable_isConsistent(this));
|
||||
}
|
||||
|
||||
void* Hashtable_remove(Hashtable* this, int key) {
|
||||
int index = key % this->size;
|
||||
void* Hashtable_remove(Hashtable* this, unsigned int key) {
|
||||
unsigned int index = key % this->size;
|
||||
|
||||
assert(Hashtable_isConsistent(this));
|
||||
|
||||
@ -149,8 +149,8 @@ void* Hashtable_remove(Hashtable* this, int key) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline void* Hashtable_get(Hashtable* this, int key) {
|
||||
int index = key % this->size;
|
||||
inline void* Hashtable_get(Hashtable* this, unsigned int key) {
|
||||
unsigned int index = key % this->size;
|
||||
HashtableItem* bucketPtr = this->buckets[index];
|
||||
while (true) {
|
||||
if (bucketPtr == NULL) {
|
||||
|
10
Hashtable.h
10
Hashtable.h
@ -21,7 +21,7 @@ typedef struct Hashtable_ Hashtable;
|
||||
typedef void(*Hashtable_PairFunction)(int, void*, void*);
|
||||
|
||||
typedef struct HashtableItem {
|
||||
int key;
|
||||
unsigned int key;
|
||||
void* value;
|
||||
struct HashtableItem* next;
|
||||
} HashtableItem;
|
||||
@ -41,7 +41,7 @@ int Hashtable_count(Hashtable* this);
|
||||
|
||||
#endif
|
||||
|
||||
HashtableItem* HashtableItem_new(int key, void* value);
|
||||
HashtableItem* HashtableItem_new(unsigned int key, void* value);
|
||||
|
||||
Hashtable* Hashtable_new(int size, bool owner);
|
||||
|
||||
@ -49,11 +49,11 @@ void Hashtable_delete(Hashtable* this);
|
||||
|
||||
inline int Hashtable_size(Hashtable* this);
|
||||
|
||||
void Hashtable_put(Hashtable* this, int key, void* value);
|
||||
void Hashtable_put(Hashtable* this, unsigned int key, void* value);
|
||||
|
||||
void* Hashtable_remove(Hashtable* this, int key);
|
||||
void* Hashtable_remove(Hashtable* this, unsigned int key);
|
||||
|
||||
inline void* Hashtable_get(Hashtable* this, int key);
|
||||
inline void* Hashtable_get(Hashtable* this, unsigned int key);
|
||||
|
||||
void Hashtable_foreach(Hashtable* this, Hashtable_PairFunction f, void* userData);
|
||||
|
||||
|
42
Makefile.am
42
Makefile.am
@ -11,22 +11,27 @@ pixmap_DATA = htop.png
|
||||
AM_CFLAGS = -pedantic -Wall -std=c99
|
||||
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
|
||||
htop_SOURCES = AvailableMetersPanel.c CategoriesPanel.c ClockMeter.c \
|
||||
CPUMeter.c CRT.c DebugMemory.c DisplayOptionsPanel.c FunctionBar.c \
|
||||
Hashtable.c Header.c htop.c Panel.c ListItem.c LoadAverageMeter.c \
|
||||
MemoryMeter.c Meter.c MetersPanel.c Object.c Process.c \
|
||||
ProcessList.c RichString.c ScreenManager.c Settings.c SignalItem.c \
|
||||
SignalsPanel.c String.c SwapMeter.c TasksMeter.c Vector.c \
|
||||
UptimeMeter.c UsersTable.c AvailableMetersPanel.h CategoriesPanel.h \
|
||||
ClockMeter.h config.h CPUMeter.h CRT.h debug.h DebugMemory.h \
|
||||
DisplayOptionsPanel.h FunctionBar.h Hashtable.h Header.h htop.h Panel.h \
|
||||
ListItem.h LoadAverageMeter.h MemoryMeter.h Meter.h \
|
||||
MetersPanel.h Object.h Process.h ProcessList.h RichString.h ScreenManager.h \
|
||||
Settings.h SignalItem.h SignalsPanel.h String.h SwapMeter.h TasksMeter.h \
|
||||
Vector.h UptimeMeter.h UsersTable.h CheckItem.c CheckItem.h \
|
||||
ColorsPanel.c ColorsPanel.h TraceScreen.c TraceScreen.h \
|
||||
AvailableColumnsPanel.c AvailableColumnsPanel.h ColumnsPanel.c \
|
||||
ColumnsPanel.h
|
||||
myhtopsources = AvailableMetersPanel.c CategoriesPanel.c CheckItem.c \
|
||||
ClockMeter.c ColorsPanel.c ColumnsPanel.c CPUMeter.c CRT.c DebugMemory.c \
|
||||
DisplayOptionsPanel.c FunctionBar.c Hashtable.c Header.c htop.c ListItem.c \
|
||||
LoadAverageMeter.c MemoryMeter.c Meter.c MetersPanel.c Object.c Panel.c \
|
||||
Process.c ProcessList.c RichString.c ScreenManager.c Settings.c \
|
||||
SignalItem.c SignalsPanel.c String.c SwapMeter.c TasksMeter.c TraceScreen.c \
|
||||
UptimeMeter.c UsersTable.c Vector.c AvailableColumnsPanel.c
|
||||
|
||||
myhtopheaders = AvailableColumnsPanel.h AvailableMetersPanel.h \
|
||||
CategoriesPanel.h CheckItem.h ClockMeter.h ColorsPanel.h ColumnsPanel.h \
|
||||
CPUMeter.h CRT.h DebugMemory.h DisplayOptionsPanel.h FunctionBar.h \
|
||||
Hashtable.h Header.h htop.h ListItem.h LoadAverageMeter.h MemoryMeter.h \
|
||||
Meter.h MetersPanel.h Object.h Panel.h ProcessList.h RichString.h \
|
||||
ScreenManager.h Settings.h SignalItem.h SignalsPanel.h String.h \
|
||||
SwapMeter.h TasksMeter.h TraceScreen.h UptimeMeter.h UsersTable.h Vector.h \
|
||||
Process.h
|
||||
|
||||
SUFFIXES = .h
|
||||
|
||||
BUILT_SOURCES = $(myhtopheaders)
|
||||
htop_SOURCES = $(myhtopheaders) $(myhtopsources) config.h debug.h
|
||||
|
||||
profile:
|
||||
$(MAKE) all CFLAGS="-pg -O2"
|
||||
@ -40,3 +45,8 @@ hardened-debug:
|
||||
debuglite:
|
||||
$(MAKE) all CFLAGS="-ggdb -DDEBUGLITE"
|
||||
|
||||
.c.h:
|
||||
scripts/MakeHeader.py $<
|
||||
|
||||
|
||||
|
||||
|
51
Process.c
51
Process.c
@ -28,7 +28,9 @@ in the source distribution for its full text.
|
||||
|
||||
// This works only with glibc 2.1+. On earlier versions
|
||||
// the behavior is similar to have a hardcoded page size.
|
||||
#ifndef PAGE_SIZE
|
||||
#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
|
||||
#endif
|
||||
|
||||
#define PROCESS_COMM_LEN 300
|
||||
|
||||
@ -39,7 +41,7 @@ typedef enum ProcessField_ {
|
||||
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
|
||||
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
|
||||
PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
|
||||
USER, TIME, LAST_PROCESSFIELD
|
||||
USER, TIME, NLWP, LAST_PROCESSFIELD
|
||||
} ProcessField;
|
||||
|
||||
struct ProcessList_;
|
||||
@ -50,16 +52,16 @@ typedef struct Process_ {
|
||||
struct ProcessList_ *pl;
|
||||
bool updated;
|
||||
|
||||
int pid;
|
||||
unsigned int pid;
|
||||
char* comm;
|
||||
int indent;
|
||||
char state;
|
||||
bool tag;
|
||||
int ppid;
|
||||
int pgrp;
|
||||
int session;
|
||||
int tty_nr;
|
||||
int tpgid;
|
||||
unsigned int ppid;
|
||||
unsigned int pgrp;
|
||||
unsigned int session;
|
||||
unsigned int tty_nr;
|
||||
unsigned int tpgid;
|
||||
unsigned long int flags;
|
||||
#ifdef DEBUG
|
||||
unsigned long int minflt;
|
||||
@ -73,6 +75,7 @@ typedef struct Process_ {
|
||||
long int cstime;
|
||||
long int priority;
|
||||
long int nice;
|
||||
long int nlwp;
|
||||
#ifdef DEBUG
|
||||
long int itrealvalue;
|
||||
unsigned long int starttime;
|
||||
@ -116,7 +119,7 @@ char* PROCESS_CLASS = "Process";
|
||||
#endif
|
||||
|
||||
char *Process_fieldNames[] = {
|
||||
"", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", "UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE", "STARTTIME", "VSIZE", "RSS", "RLIM", "STARTCODE", "ENDCODE", "STARTSTACK", "KSTKESP", "KSTKEIP", "SIGNAL", "BLOCKED", "SIGIGNORE", "SIGCATCH", "WCHAN", "NSWAP", "CNSWAP", "EXIT_SIGNAL", "PROCESSOR", "M_SIZE", "M_RESIDENT", "M_SHARE", "M_TRS", "M_DRS", "M_LRS", "M_DT", "ST_UID", "PERCENT_CPU", "PERCENT_MEM", "USER", "TIME", "*** report bug! ***"
|
||||
"", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", "UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE", "STARTTIME", "VSIZE", "RSS", "RLIM", "STARTCODE", "ENDCODE", "STARTSTACK", "KSTKESP", "KSTKEIP", "SIGNAL", "BLOCKED", "SIGIGNORE", "SIGCATCH", "WCHAN", "NSWAP", "CNSWAP", "EXIT_SIGNAL", "PROCESSOR", "M_SIZE", "M_RESIDENT", "M_SHARE", "M_TRS", "M_DRS", "M_LRS", "M_DT", "ST_UID", "PERCENT_CPU", "PERCENT_MEM", "USER", "TIME", "NLWP", "*** report bug! ***"
|
||||
};
|
||||
|
||||
static int Process_getuid = -1;
|
||||
@ -261,13 +264,14 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) {
|
||||
int n = PROCESS_COMM_LEN;
|
||||
|
||||
switch (field) {
|
||||
case PID: snprintf(buffer, n, "%5d ", this->pid); break;
|
||||
case PPID: snprintf(buffer, n, "%5d ", this->ppid); break;
|
||||
case PGRP: snprintf(buffer, n, "%5d ", this->pgrp); break;
|
||||
case SESSION: snprintf(buffer, n, "%5d ", this->session); break;
|
||||
case TTY_NR: snprintf(buffer, n, "%5d ", this->tty_nr); break;
|
||||
case TPGID: snprintf(buffer, n, "%5d ", this->tpgid); break;
|
||||
case PID: snprintf(buffer, n, "%5u ", this->pid); break;
|
||||
case PPID: snprintf(buffer, n, "%5u ", this->ppid); break;
|
||||
case PGRP: snprintf(buffer, n, "%5u ", this->pgrp); break;
|
||||
case SESSION: snprintf(buffer, n, "%5u ", this->session); break;
|
||||
case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
|
||||
case TPGID: snprintf(buffer, n, "%5u ", this->tpgid); break;
|
||||
case PROCESSOR: snprintf(buffer, n, "%3d ", this->processor+1); break;
|
||||
case NLWP: snprintf(buffer, n, "%4ld ", this->nlwp); break;
|
||||
case COMM: {
|
||||
if (!this->pl->treeView || this->indent == 0) {
|
||||
Process_writeCommand(this, attr, str);
|
||||
@ -316,6 +320,10 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) {
|
||||
: attr;
|
||||
break;
|
||||
}
|
||||
case M_DRS: Process_printLargeNumber(this, str, this->m_drs * PAGE_SIZE); return;
|
||||
case M_DT: Process_printLargeNumber(this, str, this->m_dt * PAGE_SIZE); return;
|
||||
case M_LRS: Process_printLargeNumber(this, str, this->m_lrs * PAGE_SIZE); return;
|
||||
case M_TRS: Process_printLargeNumber(this, str, this->m_trs * PAGE_SIZE); return;
|
||||
case M_SIZE: Process_printLargeNumber(this, str, this->m_size * PAGE_SIZE); return;
|
||||
case M_RESIDENT: Process_printLargeNumber(this, str, this->m_resident * PAGE_SIZE); return;
|
||||
case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE); return;
|
||||
@ -391,6 +399,14 @@ int Process_compare(const void* v1, const void* v2) {
|
||||
return (p1->state - p2->state);
|
||||
case NICE:
|
||||
return (p1->nice - p2->nice);
|
||||
case M_DRS:
|
||||
return (p2->m_drs - p1->m_drs);
|
||||
case M_DT:
|
||||
return (p2->m_dt - p1->m_dt);
|
||||
case M_LRS:
|
||||
return (p2->m_lrs - p1->m_lrs);
|
||||
case M_TRS:
|
||||
return (p2->m_trs - p1->m_trs);
|
||||
case M_SIZE:
|
||||
return (p2->m_size - p1->m_size);
|
||||
case M_RESIDENT:
|
||||
@ -409,6 +425,8 @@ int Process_compare(const void* v1, const void* v2) {
|
||||
return ((p2->utime+p2->stime) - (p1->utime+p1->stime));
|
||||
case COMM:
|
||||
return strcmp(p1->comm, p2->comm);
|
||||
case NLWP:
|
||||
return (p1->nlwp - p2->nlwp);
|
||||
default:
|
||||
return (p1->pid - p2->pid);
|
||||
}
|
||||
@ -427,6 +445,10 @@ char* Process_printField(ProcessField field) {
|
||||
case STATE: return "S ";
|
||||
case PRIORITY: return "PRI ";
|
||||
case NICE: return " NI ";
|
||||
case M_DRS: return " DATA ";
|
||||
case M_DT: return " DIRTY ";
|
||||
case M_LRS: return " LIB ";
|
||||
case M_TRS: return " CODE ";
|
||||
case M_SIZE: return " VIRT ";
|
||||
case M_RESIDENT: return " RES ";
|
||||
case M_SHARE: return " SHR ";
|
||||
@ -438,6 +460,7 @@ char* Process_printField(ProcessField field) {
|
||||
case PERCENT_CPU: return "CPU% ";
|
||||
case PERCENT_MEM: return "MEM% ";
|
||||
case PROCESSOR: return "CPU ";
|
||||
case NLWP: return "NLWP ";
|
||||
default: return "- ";
|
||||
}
|
||||
}
|
||||
|
17
Process.h
17
Process.h
@ -31,7 +31,9 @@ in the source distribution for its full text.
|
||||
|
||||
// This works only with glibc 2.1+. On earlier versions
|
||||
// the behavior is similar to have a hardcoded page size.
|
||||
#ifndef PAGE_SIZE
|
||||
#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
|
||||
#endif
|
||||
|
||||
#define PROCESS_COMM_LEN 300
|
||||
|
||||
@ -41,7 +43,7 @@ typedef enum ProcessField_ {
|
||||
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
|
||||
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
|
||||
PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
|
||||
USER, TIME, LAST_PROCESSFIELD
|
||||
USER, TIME, NLWP, LAST_PROCESSFIELD
|
||||
} ProcessField;
|
||||
|
||||
struct ProcessList_;
|
||||
@ -52,16 +54,16 @@ typedef struct Process_ {
|
||||
struct ProcessList_ *pl;
|
||||
bool updated;
|
||||
|
||||
int pid;
|
||||
unsigned int pid;
|
||||
char* comm;
|
||||
int indent;
|
||||
char state;
|
||||
bool tag;
|
||||
int ppid;
|
||||
int pgrp;
|
||||
int session;
|
||||
int tty_nr;
|
||||
int tpgid;
|
||||
unsigned int ppid;
|
||||
unsigned int pgrp;
|
||||
unsigned int session;
|
||||
unsigned int tty_nr;
|
||||
unsigned int tpgid;
|
||||
unsigned long int flags;
|
||||
#ifdef DEBUG
|
||||
unsigned long int minflt;
|
||||
@ -75,6 +77,7 @@ typedef struct Process_ {
|
||||
long int cstime;
|
||||
long int priority;
|
||||
long int nice;
|
||||
long int nlwp;
|
||||
#ifdef DEBUG
|
||||
long int itrealvalue;
|
||||
unsigned long int starttime;
|
||||
|
@ -37,11 +37,11 @@ in the source distribution for its full text.
|
||||
#endif
|
||||
|
||||
#ifndef PROCSTATFILE
|
||||
#define PROCSTATFILE "/proc/stat"
|
||||
#define PROCSTATFILE PROCDIR "/stat"
|
||||
#endif
|
||||
|
||||
#ifndef PROCMEMINFOFILE
|
||||
#define PROCMEMINFOFILE "/proc/meminfo"
|
||||
#define PROCMEMINFOFILE PROCDIR "/meminfo"
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NAME
|
||||
@ -312,7 +312,7 @@ void ProcessList_remove(ProcessList* this, Process* p) {
|
||||
assert(Hashtable_get(this->processTable, p->pid) != NULL);
|
||||
Process* pp = Hashtable_remove(this->processTable, p->pid);
|
||||
assert(pp == p); (void)pp;
|
||||
int pid = p->pid;
|
||||
unsigned int pid = p->pid;
|
||||
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
|
||||
assert(index != -1);
|
||||
Vector_remove(this->processes, index);
|
||||
@ -408,7 +408,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
|
||||
|
||||
#ifdef DEBUG_PROC
|
||||
int num = ProcessList_read(this, location,
|
||||
"%c %d %d %d %d %d %lu %lu %lu %lu "
|
||||
"%c %u %u %u %u %u %lu %lu %lu %lu "
|
||||
"%lu %lu %lu %ld %ld %ld %ld %ld %ld "
|
||||
"%lu %lu %ld %lu %lu %lu %lu %lu "
|
||||
"%lu %lu %lu %lu %lu %lu %lu %lu "
|
||||
@ -417,7 +417,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
|
||||
&proc->tpgid, &proc->flags,
|
||||
&proc->minflt, &proc->cminflt, &proc->majflt, &proc->cmajflt,
|
||||
&proc->utime, &proc->stime, &proc->cutime, &proc->cstime,
|
||||
&proc->priority, &proc->nice, &zero, &proc->itrealvalue,
|
||||
&proc->priority, &proc->nice, &proc->nlwp, &proc->itrealvalue,
|
||||
&proc->starttime, &proc->vsize, &proc->rss, &proc->rlim,
|
||||
&proc->startcode, &proc->endcode, &proc->startstack, &proc->kstkesp,
|
||||
&proc->kstkeip, &proc->signal, &proc->blocked, &proc->sigignore,
|
||||
@ -426,7 +426,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
|
||||
#else
|
||||
long int uzero;
|
||||
int num = ProcessList_read(this, location,
|
||||
"%c %d %d %d %d %d %lu %lu %lu %lu "
|
||||
"%c %u %u %u %u %u %lu %lu %lu %lu "
|
||||
"%lu %lu %lu %ld %ld %ld %ld %ld %ld "
|
||||
"%lu %lu %ld %lu %lu %lu %lu %lu "
|
||||
"%lu %lu %lu %lu %lu %lu %lu %lu "
|
||||
@ -435,7 +435,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
|
||||
&proc->tpgid, &proc->flags,
|
||||
&zero, &zero, &zero, &zero,
|
||||
&proc->utime, &proc->stime, &proc->cutime, &proc->cstime,
|
||||
&proc->priority, &proc->nice, &uzero, &uzero,
|
||||
&proc->priority, &proc->nice, &proc->nlwp, &uzero,
|
||||
&zero, &zero, &uzero, &zero,
|
||||
&zero, &zero, &zero, &zero,
|
||||
&zero, &zero, &zero, &zero,
|
||||
@ -555,7 +555,7 @@ void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, fl
|
||||
}
|
||||
int num = ProcessList_fread(this, status, "%d %d %d %d %d %d %d",
|
||||
&process->m_size, &process->m_resident, &process->m_share,
|
||||
&process->m_trs, &process->m_drs, &process->m_lrs,
|
||||
&process->m_trs, &process->m_lrs, &process->m_drs,
|
||||
&process->m_dt);
|
||||
|
||||
fclose(status);
|
||||
@ -602,8 +602,8 @@ void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, fl
|
||||
process->percent_cpu = (process->utime + process->stime - lasttimes) /
|
||||
period * 100.0;
|
||||
|
||||
process->percent_mem = process->m_resident /
|
||||
(float)(this->usedMem - this->cachedMem - this->buffersMem) *
|
||||
process->percent_mem = (process->m_resident * PAGE_SIZE) /
|
||||
(float)(this->totalMem) *
|
||||
100.0;
|
||||
|
||||
this->totalTasks++;
|
||||
|
@ -39,11 +39,11 @@ in the source distribution for its full text.
|
||||
#endif
|
||||
|
||||
#ifndef PROCSTATFILE
|
||||
#define PROCSTATFILE "/proc/stat"
|
||||
#define PROCSTATFILE PROCDIR "/stat"
|
||||
#endif
|
||||
|
||||
#ifndef PROCMEMINFOFILE
|
||||
#define PROCMEMINFOFILE "/proc/meminfo"
|
||||
#define PROCMEMINFOFILE PROCDIR "/meminfo"
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NAME
|
||||
|
@ -35,7 +35,7 @@ void UsersTable_delete(UsersTable* this) {
|
||||
free(this);
|
||||
}
|
||||
|
||||
char* UsersTable_getRef(UsersTable* this, int uid) {
|
||||
char* UsersTable_getRef(UsersTable* this, unsigned int uid) {
|
||||
char* name = (char*) (Hashtable_get(this->users, uid));
|
||||
if (name == NULL) {
|
||||
struct passwd* userData = getpwuid(uid);
|
||||
|
@ -28,7 +28,7 @@ UsersTable* UsersTable_new();
|
||||
|
||||
void UsersTable_delete(UsersTable* this);
|
||||
|
||||
char* UsersTable_getRef(UsersTable* this, int uid);
|
||||
char* UsersTable_getRef(UsersTable* this, unsigned int uid);
|
||||
|
||||
inline int UsersTable_size(UsersTable* this);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([htop],[0.6.5],[loderunner@users.sourceforge.net])
|
||||
AC_INIT([htop],[0.6.6],[loderunner@users.sourceforge.net])
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_SRCDIR([htop.c])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
|
2
htop.1
2
htop.1
@ -1,4 +1,4 @@
|
||||
.TH "htop" "1" "0.6.5" "Bartosz Fenski <fenio@o2.pl>" "Utils"
|
||||
.TH "htop" "1" "0.6.6" "Bartosz Fenski <fenio@o2.pl>" "Utils"
|
||||
.SH "NAME"
|
||||
htop \- interactive process viewer
|
||||
.SH "SYNTAX"
|
||||
|
4
htop.c
4
htop.c
@ -312,7 +312,7 @@ int main(int argc, char** argv) {
|
||||
incSearchIndex = 0;
|
||||
incSearchBuffer[0] = 0;
|
||||
int currPos = Panel_getSelectedIndex(panel);
|
||||
int currPid = 0;
|
||||
unsigned int currPid = 0;
|
||||
int currScrollV = panel->scrollV;
|
||||
if (follow)
|
||||
currPid = ProcessList_get(pl, currPos)->pid;
|
||||
@ -406,7 +406,7 @@ int main(int argc, char** argv) {
|
||||
continue;
|
||||
}
|
||||
if (isdigit((char)ch)) {
|
||||
int pid = ch-48 + acc;
|
||||
unsigned int pid = ch-48 + acc;
|
||||
for (int i = 0; i < ProcessList_size(pl) && ((Process*) Panel_getSelected(panel))->pid != pid; i++)
|
||||
Panel_setSelected(panel, i);
|
||||
acc = pid * 10;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Version=0.6.5
|
||||
Version=0.6.6
|
||||
Name=Htop
|
||||
Type=Application
|
||||
Comment=Show System Processes
|
||||
|
@ -21,6 +21,8 @@ class writer:
|
||||
self.file.write(text + "\n")
|
||||
out = writer(out)
|
||||
|
||||
print("Generating "+name+".h")
|
||||
|
||||
selfheader = '#include "' + name + '.h"'
|
||||
|
||||
out.write( "/* Do not edit this file. It was automatically generated. */" )
|
||||
|
Reference in New Issue
Block a user