diff options
author | Zhenyu Wang <zhenyuw@linux.intel.com> | 2016-04-07 17:59:52 +0800 |
---|---|---|
committer | Zhenyu Wang <zhenyuw@linux.intel.com> | 2016-04-07 17:59:52 +0800 |
commit | b0b2a1812f2a6b40ac21268408e97bf39711ed25 (patch) | |
tree | 4e5aba71861cbe4ad93f0eb8f6b54ad389c5afe8 | |
parent | bc300015b951e6e741a06b8d172071bbcd6e37d1 (diff) |
Fix sortingmem
-rw-r--r-- | tools/intel_gpu_mem_top.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/intel_gpu_mem_top.c b/tools/intel_gpu_mem_top.c index 75132c0b..02418a09 100644 --- a/tools/intel_gpu_mem_top.c +++ b/tools/intel_gpu_mem_top.c @@ -73,18 +73,19 @@ static int compare(const void *a, const void *b) struct proc_mem_stats *stat_b = (struct proc_mem_stats *)b; if (stat_a->in_use < stat_b->in_use) - return -1; + return 1; else if (stat_a->in_use == stat_b->in_use) return 0; else - return 1; + return -1; } static void print_stats(void) { qsort(stats, next_stats + 1, sizeof(stats[0]), compare); - + + printf("Top GPU mem usage:\n"); for (int i = 0; i < 128; i++) { if (strncmp(stats[i].name, "\0", 1) == 0) break; |