@@ -1730,6 +1730,8 @@ int _odp_ishm_status(const char *title)
int nb_blocks = 0;
int single_va_blocks = 0;
int max_name_len = 0;
+ uint64_t lost_total = 0; /* statistics for total unused memory */
+ uint64_t len_total = 0; /* statistics for total allocated memory */
odp_spinlock_lock(&ishm_tbl->lock);
procsync();
@@ -1747,10 +1749,10 @@ int _odp_ishm_status(const char *title)
max_name_len = str_len;
}
- ODP_PRINT("ishm blocks allocated at: %s\n", title);
-
- ODP_PRINT(" %-*s flag len user_len seq ref start fd"
- " file\n", max_name_len, "name");
+ ODP_PRINT("%s\n", title);
+ ODP_PRINT(" %-*s flag %-08s %-08s %-08s %-3s %-3s %-08s %-3s file\n",
+ max_name_len, "name", "len", "user_len", "lost",
+ "seq", "ref", "start", "fd");
/* display block table: 1 line per entry +1 extra line if mapped here */
for (i = 0; i < ISHM_MAX_NB_BLOCKS; i++) {
@@ -1780,23 +1782,30 @@ int _odp_ishm_status(const char *title)
huge = '?';
}
proc_index = procfind_block(i);
- ODP_PRINT("%2i %-*s %s%c 0x%-08lx 0x%-08lx %-3lu %-3lu",
+ lost_total += ishm_tbl->block[i].len -
+ ishm_tbl->block[i].user_len;
+ len_total += ishm_tbl->block[i].len;
+ ODP_PRINT("%2i %-*s %s%c 0x%-08lx 0x%-08lx 0x%-08lx %-3lu %-3lu",
i, max_name_len, ishm_tbl->block[i].name,
flags, huge,
ishm_tbl->block[i].len,
ishm_tbl->block[i].user_len,
+ ishm_tbl->block[i].len - ishm_tbl->block[i].user_len,
ishm_tbl->block[i].seq,
ishm_tbl->block[i].refcnt);
if (proc_index < 0)
continue;
- ODP_PRINT("%-08lx %-3d",
+ ODP_PRINT(" 0x%-08lx %-3d",
ishm_proctable->entry[proc_index].start,
ishm_proctable->entry[proc_index].fd);
- ODP_PRINT("%s\n", ishm_tbl->block[i].filename);
+ ODP_PRINT("%s\n", ishm_tbl->block[i].filename[0] ?
+ ishm_tbl->block[i].filename : "(none)");
}
+ ODP_PRINT("TOTAL: %41s%-08lx 0x%-08lx\n",
+ "0x", len_total, lost_total);
/* display the virtual space allocations... : */
ODP_PRINT("\nishm virtual space:\n");