dump the status of the mempool on the console */
| 1220 | |
| 1221 | /* dump the status of the mempool on the console */ |
| 1222 | void |
| 1223 | rte_mempool_dump(FILE *f, struct rte_mempool *mp) |
| 1224 | { |
| 1225 | #ifdef RTE_LIBRTE_MEMPOOL_STATS |
| 1226 | struct rte_mempool_info info; |
| 1227 | struct rte_mempool_debug_stats sum; |
| 1228 | unsigned lcore_id; |
| 1229 | #endif |
| 1230 | struct rte_mempool_memhdr *memhdr; |
| 1231 | struct rte_mempool_ops *ops; |
| 1232 | unsigned common_count; |
| 1233 | unsigned cache_count; |
| 1234 | size_t mem_len = 0; |
| 1235 | |
| 1236 | RTE_ASSERT(f != NULL); |
| 1237 | RTE_ASSERT(mp != NULL); |
| 1238 | |
| 1239 | fprintf(f, "mempool <%s>@%p\n", mp->name, mp); |
| 1240 | fprintf(f, " flags=%x\n", mp->flags); |
| 1241 | fprintf(f, " socket_id=%d\n", mp->socket_id); |
| 1242 | fprintf(f, " pool=%p\n", mp->pool_data); |
| 1243 | fprintf(f, " iova=0x%" PRIx64 "\n", mp->mz->iova); |
| 1244 | fprintf(f, " nb_mem_chunks=%u\n", mp->nb_mem_chunks); |
| 1245 | fprintf(f, " size=%"PRIu32"\n", mp->size); |
| 1246 | fprintf(f, " populated_size=%"PRIu32"\n", mp->populated_size); |
| 1247 | fprintf(f, " header_size=%"PRIu32"\n", mp->header_size); |
| 1248 | fprintf(f, " elt_size=%"PRIu32"\n", mp->elt_size); |
| 1249 | fprintf(f, " trailer_size=%"PRIu32"\n", mp->trailer_size); |
| 1250 | fprintf(f, " total_obj_size=%"PRIu32"\n", |
| 1251 | mp->header_size + mp->elt_size + mp->trailer_size); |
| 1252 | |
| 1253 | fprintf(f, " private_data_size=%"PRIu32"\n", mp->private_data_size); |
| 1254 | |
| 1255 | fprintf(f, " ops_index=%d\n", mp->ops_index); |
| 1256 | ops = rte_mempool_get_ops(mp->ops_index); |
| 1257 | fprintf(f, " ops_name: <%s>\n", (ops != NULL) ? ops->name : "NA"); |
| 1258 | |
| 1259 | STAILQ_FOREACH(memhdr, &mp->mem_list, next) |
| 1260 | mem_len += memhdr->len; |
| 1261 | if (mem_len != 0) { |
| 1262 | fprintf(f, " avg bytes/object=%#Lf\n", |
| 1263 | (long double)mem_len / mp->size); |
| 1264 | } |
| 1265 | |
| 1266 | cache_count = rte_mempool_dump_cache(f, mp); |
| 1267 | common_count = rte_mempool_ops_get_count(mp); |
| 1268 | if ((cache_count + common_count) > mp->size) |
| 1269 | common_count = mp->size - cache_count; |
| 1270 | fprintf(f, " common_pool_count=%u\n", common_count); |
| 1271 | |
| 1272 | /* sum and dump statistics */ |
| 1273 | #ifdef RTE_LIBRTE_MEMPOOL_STATS |
| 1274 | rte_mempool_ops_get_info(mp, &info); |
| 1275 | memset(&sum, 0, sizeof(sum)); |
| 1276 | for (lcore_id = 0; lcore_id < RTE_MAX_LCORE + 1; lcore_id++) { |
| 1277 | sum.put_bulk += mp->stats[lcore_id].put_bulk; |
| 1278 | sum.put_objs += mp->stats[lcore_id].put_objs; |
| 1279 | sum.put_common_pool_bulk += mp->stats[lcore_id].put_common_pool_bulk; |