From c868e3f8d629e1caddff1a51a7d2dd04f49994a3 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:16 +0200 Subject: Imported Upstream version 0.5.1 --- CRT.c | 7 +- CRT.h | 2 +- ChangeLog | 11 ++ DisplayOptionsListBox.c | 1 + Makefile.in | 53 ++--- MetersListBox.c | 3 + Process.c | 3 +- ProcessList.c | 209 +++++++++++--------- ProcessList.h | 1 + Settings.c | 4 + SignalsListBox.c | 3 +- aclocal.m4 | 516 +++++++++++++++++++++--------------------------- config.h | 6 +- configure | 86 ++++---- configure.ac | 2 +- htop.c | 14 +- 16 files changed, 457 insertions(+), 464 deletions(-) diff --git a/CRT.c b/CRT.c index 6c2149c..b4651e0 100644 --- a/CRT.c +++ b/CRT.c @@ -92,10 +92,15 @@ typedef enum ColorElements_ { LAST_COLORELEMENT } ColorElements; +extern int CRT_delay; + extern int CRT_colors[LAST_COLORELEMENT]; }*/ +/* private property */ +int CRT_delay; + /* private property */ int CRT_colors[LAST_COLORELEMENT]; @@ -254,7 +259,7 @@ int CRT_readKey() { nocbreak(); cbreak(); int ret = getch(); - halfdelay(MIN_UPDATE_SLICE); + halfdelay(CRT_delay); return ret; } diff --git a/CRT.h b/CRT.h index 55a4282..8e08eee 100644 --- a/CRT.h +++ b/CRT.h @@ -96,7 +96,7 @@ typedef enum ColorElements_ { extern int CRT_colors[LAST_COLORELEMENT]; - +extern int CRT_delay; void CRT_init(); diff --git a/ChangeLog b/ChangeLog index b80c4ee..0e62106 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,15 @@ +What's new in version 0.5.1 + +* BUGFIX: Correctly displays NPTL threads from + /proc//task subdirectories + (thanks to Mike Pot for the report) +* BUGFIX: Fixes key handling on Signals listbox + (thanks to Ondrej Vlach) +* Renicing no longer displays temporary illegal values + (thanks to Ondrej Vlach) +* 'Hide userland threads' feature for NPTL threads + What's new in version 0.5 * Tree view diff --git a/DisplayOptionsListBox.c b/DisplayOptionsListBox.c index e0dff29..37541f2 100644 --- a/DisplayOptionsListBox.c +++ b/DisplayOptionsListBox.c @@ -34,6 +34,7 @@ DisplayOptionsListBox* DisplayOptionsListBox_new(Settings* settings, ScreenManag ListBox_add(super, (Object*) CheckItem_new(String_copy("Tree view"), &(settings->pl->treeView))); ListBox_add(super, (Object*) CheckItem_new(String_copy("Shadow other users' processes"), &(settings->pl->shadowOtherUsers))); ListBox_add(super, (Object*) CheckItem_new(String_copy("Hide kernel threads"), &(settings->pl->hideKernelThreads))); + ListBox_add(super, (Object*) CheckItem_new(String_copy("Hide userland threads"), &(settings->pl->hideUserlandThreads))); ListBox_add(super, (Object*) CheckItem_new(String_copy("Highlight program \"basename\""), &(settings->pl->highlightBaseName))); ListBox_add(super, (Object*) CheckItem_new(String_copy("Highlight megabytes in memory counters"), &(settings->pl->highlightMegabytes))); ListBox_add(super, (Object*) CheckItem_new(String_copy("Leave a margin around header"), &(settings->header->margin))); diff --git a/Makefile.in b/Makefile.in index c6a6c57..959710c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -74,29 +74,6 @@ htop_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/AvailableMetersListBox.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/CPUMeter.Po ./$(DEPDIR)/CRT.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/CategoriesListBox.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/CheckItem.Po ./$(DEPDIR)/ClockMeter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/DebugMemory.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/DisplayOptionsListBox.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/FunctionBar.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/Hashtable.Po ./$(DEPDIR)/Header.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ListBox.Po ./$(DEPDIR)/ListItem.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/LoadAverageMeter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/LoadMeter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/MemoryMeter.Po ./$(DEPDIR)/Meter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/MetersListBox.Po ./$(DEPDIR)/Object.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/Process.Po ./$(DEPDIR)/ProcessList.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/RichString.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ScreenManager.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/Settings.Po ./$(DEPDIR)/Signal.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/SignalsListBox.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/String.Po ./$(DEPDIR)/SwapMeter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/TasksMeter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/TypedVector.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/UptimeMeter.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/UsersTable.Po ./$(DEPDIR)/htop.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -168,6 +145,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ @@ -331,16 +310,14 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: install-man1: $(man1_MANS) $(man_MANS) @@ -410,7 +387,7 @@ TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ + test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi @@ -472,15 +449,15 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir - $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir @@ -493,7 +470,7 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -502,11 +479,11 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ @@ -589,7 +566,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/MetersListBox.c b/MetersListBox.c index 2eb67aa..5f09c2b 100644 --- a/MetersListBox.c +++ b/MetersListBox.c @@ -52,6 +52,9 @@ HandlerResult MetersListBox_eventHandler(ListBox* super, int ch) { HandlerResult result = IGNORED; switch(ch) { + case 0x0a: + case 0x0d: + case KEY_ENTER: case KEY_F(4): case 't': { diff --git a/Process.c b/Process.c index 4483325..81fea4e 100644 --- a/Process.c +++ b/Process.c @@ -170,8 +170,9 @@ bool Process_equals(const Object* o1, const Object* o2) { } void Process_setPriority(Process* this, int priority) { + int old_prio = getpriority(PRIO_PROCESS, this->pid); int err = setpriority(PRIO_PROCESS, this->pid, priority); - if (err == 0) { + if (err == 0 && old_prio != getpriority(PRIO_PROCESS, this->pid)) { this->nice = priority; } } diff --git a/ProcessList.c b/ProcessList.c index 9f09f48..61241a4 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -83,6 +83,7 @@ typedef struct ProcessList_ { bool hideThreads; bool shadowOtherUsers; bool hideKernelThreads; + bool hideUserlandThreads; bool treeView; bool highlightBaseName; bool highlightMegabytes; @@ -157,6 +158,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable) { this->hideThreads = false; this->shadowOtherUsers = false; this->hideKernelThreads = false; + this->hideUserlandThreads = false; this->treeView = false; this->highlightBaseName = false; this->highlightMegabytes = false; @@ -343,94 +345,14 @@ int ProcessList_readStatFile(Process *proc, FILE *f, char *command) { return 1; } -void ProcessList_scan(ProcessList* this) { - DIR* proc; +void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, float period) { + DIR* dir; struct dirent* entry; Process* prototype = this->prototype; - long int usertime, nicetime, systemtime, idletime, totaltime; - - FILE* status; - char buffer[128]; - status = fopen(PROCMEMINFOFILE, "r"); - assert(status != NULL); - while (!feof(status)) { - fgets(buffer, 128, status); - if (String_startsWith(buffer, "MemTotal:")) { - sscanf(buffer, "MemTotal: %ld kB", &this->totalMem); - } else if (String_startsWith(buffer, "MemFree:")) { - sscanf(buffer, "MemFree: %ld kB", &this->freeMem); - this->usedMem = this->totalMem - this->freeMem; - } else if (String_startsWith(buffer, "MemShared:")) { - sscanf(buffer, "MemShared: %ld kB", &this->sharedMem); - } else if (String_startsWith(buffer, "Buffers:")) { - sscanf(buffer, "Buffers: %ld kB", &this->buffersMem); - } else if (String_startsWith(buffer, "Cached:")) { - sscanf(buffer, "Cached: %ld kB", &this->cachedMem); - } else if (String_startsWith(buffer, "SwapTotal:")) { - sscanf(buffer, "SwapTotal: %ld kB", &this->totalSwap); - } else if (String_startsWith(buffer, "SwapFree:")) { - long int swapFree; - sscanf(buffer, "SwapFree: %ld kB", &swapFree); - this->usedSwap = this->totalSwap - swapFree; - } - } - fclose(status); - - status = fopen(PROCSTATFILE, "r"); - assert(status != NULL); - for (int i = 0; i <= this->processorCount; i++) { - int cpuid; - if (this->kernelMajor == 2 && this->kernelMiddle <= 4) { - if (i == 0) { - fscanf(status, "cpu %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime); - } else { - fscanf(status, "cpu%d %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime); - assert(cpuid == i - 1); - } - totaltime = usertime + nicetime + systemtime + idletime; - } else { - long int ioWait, irq, softIrq; - if (i == 0) - fscanf(status, "cpu %ld %ld %ld %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq); - else { - fscanf(status, "cpu%d %ld %ld %ld %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq); - assert(cpuid == i - 1); - } - systemtime += ioWait + irq + softIrq; - totaltime = usertime + nicetime + systemtime + idletime; - } - assert (usertime >= this->userTime[i]); - assert (nicetime >= this->niceTime[i]); - assert (systemtime >= this->systemTime[i]); - assert (idletime >= this->idleTime[i]); - assert (totaltime >= this->totalTime[i]); - this->userPeriod[i] = usertime - this->userTime[i]; - this->nicePeriod[i] = nicetime - this->niceTime[i]; - this->systemPeriod[i] = systemtime - this->systemTime[i]; - this->idlePeriod[i] = idletime - this->idleTime[i]; - this->totalPeriod[i] = totaltime - this->totalTime[i]; - this->userTime[i] = usertime; - this->niceTime[i] = nicetime; - this->systemTime[i] = systemtime; - this->idleTime[i] = idletime; - this->totalTime[i] = totaltime; - } - float period = (float)this->totalPeriod[0] / this->processorCount; - fclose(status); - // mark all process as "dirty" - for (int i = 0; i < TypedVector_size(this->processes); i++) { - Process* p = (Process*) TypedVector_get(this->processes, i); - p->updated = false; - } - - this->totalTasks = 0; - this->runningTasks = 0; - - proc = opendir(PROCDIR); - assert(proc != NULL); - signal(11, ProcessList_dontCrash); - while ((entry = readdir(proc)) != NULL) { + dir = opendir(dirname); + assert(dir != NULL); + while ((entry = readdir(dir)) != NULL) { char* name = entry->d_name; int pid; // filename is a number: process directory @@ -446,9 +368,18 @@ void ProcessList_scan(ProcessList* this) { isThread = true; } - if (pid > 0) { - FILE* status; + if (pid > 0 && pid != parent) { const int MAX_NAME = 128; + if (!this->hideUserlandThreads) { + char subdirname[MAX_NAME+1]; + snprintf(subdirname, MAX_NAME, "%s/%s/task", dirname, name); + + if (access(subdirname, X_OK) == 0) { + ProcessList_processEntries(this, subdirname, pid, period); + } + } + + FILE* status; char statusfilename[MAX_NAME+1]; char command[PROCESS_COMM_LEN + 1]; @@ -464,7 +395,7 @@ void ProcessList_scan(ProcessList* this) { process->updated = true; struct stat sstat; - snprintf(statusfilename, MAX_NAME, "%s/%s/stat", PROCDIR, name); + snprintf(statusfilename, MAX_NAME, "%s/%s/stat", dirname, name); int statok = stat(statusfilename, &sstat); if (statok == -1) goto errorReadingProcess; @@ -493,7 +424,7 @@ void ProcessList_scan(ProcessList* this) { period * 100.0; if(!existingProcess) { - snprintf(statusfilename, MAX_NAME, "%s/%s/cmdline", PROCDIR, name); + snprintf(statusfilename, MAX_NAME, "%s/%s/cmdline", dirname, name); status = fopen(statusfilename, "r"); if (!status) { goto errorReadingProcess; @@ -514,7 +445,7 @@ void ProcessList_scan(ProcessList* this) { fclose(status); } - snprintf(statusfilename, MAX_NAME, "%s/%s/statm", PROCDIR, name); + snprintf(statusfilename, MAX_NAME, "%s/%s/statm", dirname, name); status = fopen(statusfilename, "r"); if(!status) { goto errorReadingProcess; @@ -547,8 +478,104 @@ void ProcessList_scan(ProcessList* this) { } } } + closedir(dir); +} + +void ProcessList_scan(ProcessList* this) { + long int usertime, nicetime, systemtime, idletime, totaltime; + long int swapFree; + + FILE* status; + char buffer[128]; + status = fopen(PROCMEMINFOFILE, "r"); + assert(status != NULL); + while (!feof(status)) { + fgets(buffer, 128, status); + + switch (buffer[0]) { + case 'M': + if (String_startsWith(buffer, "MemTotal:")) + sscanf(buffer, "MemTotal: %ld kB", &this->totalMem); + else if (String_startsWith(buffer, "MemFree:")) + sscanf(buffer, "MemFree: %ld kB", &this->freeMem); + else if (String_startsWith(buffer, "MemShared:")) + sscanf(buffer, "MemShared: %ld kB", &this->sharedMem); + break; + case 'B': + if (String_startsWith(buffer, "Buffers:")) + sscanf(buffer, "Buffers: %ld kB", &this->buffersMem); + break; + case 'C': + if (String_startsWith(buffer, "Cached:")) + sscanf(buffer, "Cached: %ld kB", &this->cachedMem); + break; + case 'S': + if (String_startsWith(buffer, "SwapTotal:")) + sscanf(buffer, "SwapTotal: %ld kB", &this->totalSwap); + if (String_startsWith(buffer, "SwapFree:")) + sscanf(buffer, "SwapFree: %ld kB", &swapFree); + break; + } + } + this->usedMem = this->totalMem - this->freeMem; + this->usedSwap = this->totalSwap - swapFree; + fclose(status); + + status = fopen(PROCSTATFILE, "r"); + assert(status != NULL); + for (int i = 0; i <= this->processorCount; i++) { + int cpuid; + if (this->kernelMajor == 2 && this->kernelMiddle <= 4) { + if (i == 0) { + fscanf(status, "cpu %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime); + } else { + fscanf(status, "cpu%d %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime); + assert(cpuid == i - 1); + } + totaltime = usertime + nicetime + systemtime + idletime; + } else { + long int ioWait, irq, softIrq; + if (i == 0) + fscanf(status, "cpu %ld %ld %ld %ld %ld %ld %ld\n", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq); + else { + fscanf(status, "cpu%d %ld %ld %ld %ld %ld %ld %ld\n", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq); + assert(cpuid == i - 1); + } + systemtime += ioWait + irq + softIrq; + totaltime = usertime + nicetime + systemtime + idletime; + } + assert (usertime >= this->userTime[i]); + assert (nicetime >= this->niceTime[i]); + assert (systemtime >= this->systemTime[i]); + assert (idletime >= this->idleTime[i]); + assert (totaltime >= this->totalTime[i]); + this->userPeriod[i] = usertime - this->userTime[i]; + this->nicePeriod[i] = nicetime - this->niceTime[i]; + this->systemPeriod[i] = systemtime - this->systemTime[i]; + this->idlePeriod[i] = idletime - this->idleTime[i]; + this->totalPeriod[i] = totaltime - this->totalTime[i]; + this->userTime[i] = usertime; + this->niceTime[i] = nicetime; + this->systemTime[i] = systemtime; + this->idleTime[i] = idletime; + this->totalTime[i] = totaltime; + } + float period = (float)this->totalPeriod[0] / this->processorCount; + fclose(status); + + // mark all process as "dirty" + for (int i = 0; i < TypedVector_size(this->processes); i++) { + Process* p = (Process*) TypedVector_get(this->processes, i); + p->updated = false; + } + + this->totalTasks = 0; + this->runningTasks = 0; + + signal(11, ProcessList_dontCrash); + + ProcessList_processEntries(this, PROCDIR, 0, period); signal(11, SIG_DFL); - closedir(proc); for (int i = TypedVector_size(this->processes) - 1; i >= 0; i--) { Process* p = (Process*) TypedVector_get(this->processes, i); diff --git a/ProcessList.h b/ProcessList.h index 45639d3..b77ba2a 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -83,6 +83,7 @@ typedef struct ProcessList_ { bool hideThreads; bool shadowOtherUsers; bool hideKernelThreads; + bool hideUserlandThreads; bool treeView; bool highlightBaseName; bool highlightMegabytes; diff --git a/Settings.c b/Settings.c index a32bde2..5e9bbfd 100644 --- a/Settings.c +++ b/Settings.c @@ -108,6 +108,9 @@ bool Settings_read(Settings* this, char* fileName) { // hide_kernel_threads } else if (String_eq(option[0], "hide_kernel_threads")) { this->pl->hideKernelThreads = atoi(option[1]); + // hide_kernel_threads + } else if (String_eq(option[0], "hide_userland_threads")) { + this->pl->hideUserlandThreads = atoi(option[1]); // shadow_other_users } else if (String_eq(option[0], "shadow_other_users")) { this->pl->shadowOtherUsers = atoi(option[1]); @@ -166,6 +169,7 @@ bool Settings_write(Settings* this) { fprintf(fd, "sort_direction=%d\n", (int) this->pl->direction); fprintf(fd, "hide_threads=%d\n", (int) this->pl->hideThreads); fprintf(fd, "hide_kernel_threads=%d\n", (int) this->pl->hideKernelThreads); + fprintf(fd, "hide_userland_threads=%d\n", (int) this->pl->hideUserlandThreads); fprintf(fd, "shadow_other_users=%d\n", (int) this->pl->shadowOtherUsers); fprintf(fd, "highlight_base_name=%d\n", (int) this->pl->highlightBaseName); fprintf(fd, "highlight_megabytes=%d\n", (int) this->pl->highlightMegabytes); diff --git a/SignalsListBox.c b/SignalsListBox.c index 591483b..a087db0 100644 --- a/SignalsListBox.c +++ b/SignalsListBox.c @@ -55,7 +55,8 @@ HandlerResult SignalsListBox_eventHandler(ListBox* super, int ch) { SignalsListBox* this = (SignalsListBox*) super; int size = ListBox_getSize(super); - if (isdigit(ch)) { + + if (ch <= 255 && isdigit(ch)) { int signal = ch-48 + this->state; for (int i = 0; i < size; i++) if (((Signal*) ListBox_get(super, i))->number == signal) { diff --git a/aclocal.m4 b/aclocal.m4 index 1b5a5f1..965df90 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.8.4 -*- Autoconf -*- +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,55 +11,32 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.8.4])]) - -# AM_AUX_DIR_EXPAND - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. + [AM_AUTOMAKE_VERSION([1.9.5])]) -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# AM_CONDITIONAL -*- Autoconf -*- -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -145,30 +112,19 @@ else fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]) + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -177,7 +133,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -317,26 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Generate code to set up dependency tracking. -*- Autoconf -*- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -#serial 2 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -355,27 +300,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -401,30 +340,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- - -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. +# Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# serial 12 -# serial 11 +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -482,7 +410,6 @@ AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -491,7 +418,9 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl - +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -525,51 +454,27 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 1 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -584,26 +489,15 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Check to see how 'make' treats includes. -*- Autoconf -*- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -647,27 +541,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- - - -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -693,27 +576,16 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -734,13 +606,21 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -759,26 +639,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# Helper functions for option handling. -*- Autoconf -*- -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 2 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -803,28 +672,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# -# Check to make sure that the build environment is sane. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# Check to make sure that the build environment is sane. -*- Autoconf -*- -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# serial 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -867,25 +724,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. +# AM_PROG_INSTALL_STRIP +# --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip @@ -906,3 +752,99 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/config.h b/config.h index b077bf9..ebc5b69 100644 --- a/config.h +++ b/config.h @@ -105,13 +105,13 @@ #define PACKAGE_NAME "htop" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "htop 0.5" +#define PACKAGE_STRING "htop 0.5.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "htop" /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.5" +#define PACKAGE_VERSION "0.5.1" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -120,7 +120,7 @@ #define STDC_HEADERS 1 /* Version number of package */ -#define VERSION "0.5" +#define VERSION "0.5.1" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ diff --git a/configure b/configure index 3c90aeb..7ecb438 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for htop 0.5. +# Generated by GNU Autoconf 2.59 for htop 0.5.1. # # Report bugs to . # @@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='htop' PACKAGE_TARNAME='htop' -PACKAGE_VERSION='0.5' -PACKAGE_STRING='htop 0.5' +PACKAGE_VERSION='0.5.1' +PACKAGE_STRING='htop 0.5.1' PACKAGE_BUGREPORT='loderunner@users.sourceforge.net' ac_unique_file="htop.c" @@ -311,7 +311,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -780,7 +780,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures htop 0.5 to adapt to many kinds of systems. +\`configure' configures htop 0.5.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -842,7 +842,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of htop 0.5:";; + short | recursive ) echo "Configuration of htop 0.5.1:";; esac cat <<\_ACEOF @@ -960,7 +960,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -htop configure 0.5 +htop configure 0.5.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -974,7 +974,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by htop $as_me 0.5, which was +It was created by htop $as_me 0.5.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1310,7 +1310,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version="1.8" +am__api_version="1.9" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -1487,13 +1487,21 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -1609,7 +1617,7 @@ fi # Define the identity of the package. PACKAGE='htop' - VERSION='0.5' + VERSION='0.5.1' cat >>confdefs.h <<_ACEOF @@ -1637,9 +1645,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -AMTAR=${AMTAR-"${am_missing_run}tar"} - install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user @@ -1732,6 +1737,13 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + @@ -5566,7 +5578,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by htop $as_me 0.5, which was +This file was extended by htop $as_me 0.5.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5629,7 +5641,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -htop config.status 0.5 +htop config.status 0.5.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -5838,7 +5850,6 @@ s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t @@ -5847,6 +5858,9 @@ s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t @@ -6489,27 +6503,21 @@ echo X"$mf" | else continue fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue diff --git a/configure.ac b/configure.ac index 5f33459..cbf799e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT([htop],[0.5],[loderunner@users.sourceforge.net]) +AC_INIT([htop],[0.5.1],[loderunner@users.sourceforge.net]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([htop.c]) AC_CONFIG_HEADER([config.h]) diff --git a/htop.c b/htop.c index be162f0..a0f431a 100644 --- a/htop.c +++ b/htop.c @@ -416,7 +416,18 @@ int main(int argc, char** argv) { int acc = 0; bool follow = false; + + struct timeval tv; + double time = 0.0; + double oldTime = 0.0; + bool recalculate; + while (!quit) { + gettimeofday(&tv, NULL); + time = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000); + recalculate = (time - oldTime > CRT_delay); + if (recalculate) + oldTime = time; if (doRefresh) { incSearchIndex = 0; incSearchBuffer[0] = 0; @@ -425,7 +436,8 @@ int main(int argc, char** argv) { int currScrollV = lb->scrollV; if (follow) currPid = ProcessList_get(pl, currPos)->pid; - ProcessList_scan(pl); + if (recalculate) + ProcessList_scan(pl); if (refreshTimeout == 0) { ProcessList_sort(pl); refreshTimeout = 1; -- cgit v1.2.3