diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2010-03-29 18:44:14 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2010-03-29 18:44:14 +0000 |
commit | 8d0fff2f661e1ebe0feaa69f34122dbb81916ede (patch) | |
tree | 1c05622eaf2221638f0485653536daea5d7b72c8 | |
parent | dc262f4df67e3241d3af67e28fc45936af5a7025 (diff) |
Good heuristic for processes started in the same second
-rw-r--r-- | Process.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -581,8 +581,12 @@ int Process_compare(const void* v1, const void* v2) { return strcmp(p1->comm, p2->comm); case NLWP: return (p1->nlwp - p2->nlwp); - case STARTTIME: - return (p1->starttime_ctime - p2->starttime_ctime); + case STARTTIME: { + if (p1->starttime_ctime == p2->starttime_ctime) + return (p1->pid - p2->pid); + else + return (p1->starttime_ctime - p2->starttime_ctime); + } #ifdef HAVE_OPENVZ case CTID: return (p1->ctid - p2->ctid); |