1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

Fixed top_mem as per Nattfodd's email on conky-development list

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@338 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-09-29 03:34:05 +00:00
parent 3d21ef7aa1
commit b8e385f663
2 changed files with 8 additions and 4 deletions

View File

@ -2,6 +2,7 @@
2005-09-29 2005-09-29
* Fixed build on FreeBSD for non-i386 * Fixed build on FreeBSD for non-i386
* Made it so top_mem doesn't show all the forks of one process
2005-09-27 2005-09-27
* Fixed small bug in config parsing (thanks robgrady, bug 1306032) * Fixed small bug in config parsing (thanks robgrady, bug 1306032)

View File

@ -405,7 +405,7 @@ inline void process_find_top(struct process **cpu, struct process **mem)
assert(sorttmp != NULL); assert(sorttmp != NULL);
} }
int total; int total;
unsigned int i/*, max*/; unsigned int i, j;
total = calc_cpu_total(); /* calculate the total of the processor */ total = calc_cpu_total(); /* calculate the total of the processor */
@ -477,9 +477,12 @@ inline void process_find_top(struct process **cpu, struct process **mem)
sizeof(struct process) * sorttmp_size); sizeof(struct process) * sorttmp_size);
} }
qsort(sorttmp, i, sizeof(struct process *), comparemem); qsort(sorttmp, i, sizeof(struct process *), comparemem);
for (i = 0; i < 10; i++) { for (i = 0, j = 0; i < sorttmp_size && j < 10; i++) {
mem[i] = sorttmp[i]; if (j == 0 || sorttmp[i]->totalmem != mem[j-1]->totalmem
|| strncmp(sorttmp[i]->name, mem[j-1]->name,128)) {
mem[j++] = sorttmp[i];
}
} }
} }
} }