/*-
* BSD LICENSE
- *
+ *
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
/* dump the status of the ring on the console */
void
-rte_ring_dump(const struct rte_ring *r)
+rte_ring_dump(FILE *f, const struct rte_ring *r)
{
#ifdef RTE_LIBRTE_RING_DEBUG
struct rte_ring_debug_stats sum;
unsigned lcore_id;
#endif
- printf("ring <%s>@%p\n", r->name, r);
- printf(" flags=%x\n", r->flags);
- printf(" size=%"PRIu32"\n", r->prod.size);
- printf(" ct=%"PRIu32"\n", r->cons.tail);
- printf(" ch=%"PRIu32"\n", r->cons.head);
- printf(" pt=%"PRIu32"\n", r->prod.tail);
- printf(" ph=%"PRIu32"\n", r->prod.head);
- printf(" used=%u\n", rte_ring_count(r));
- printf(" avail=%u\n", rte_ring_free_count(r));
+ fprintf(f, "ring <%s>@%p\n", r->name, r);
+ fprintf(f, " flags=%x\n", r->flags);
+ fprintf(f, " size=%"PRIu32"\n", r->prod.size);
+ fprintf(f, " ct=%"PRIu32"\n", r->cons.tail);
+ fprintf(f, " ch=%"PRIu32"\n", r->cons.head);
+ fprintf(f, " pt=%"PRIu32"\n", r->prod.tail);
+ fprintf(f, " ph=%"PRIu32"\n", r->prod.head);
+ fprintf(f, " used=%u\n", rte_ring_count(r));
+ fprintf(f, " avail=%u\n", rte_ring_free_count(r));
if (r->prod.watermark == r->prod.size)
- printf(" watermark=0\n");
+ fprintf(f, " watermark=0\n");
else
- printf(" watermark=%"PRIu32"\n", r->prod.watermark);
+ fprintf(f, " watermark=%"PRIu32"\n", r->prod.watermark);
/* sum and dump statistics */
#ifdef RTE_LIBRTE_RING_DEBUG
sum.deq_fail_bulk += r->stats[lcore_id].deq_fail_bulk;
sum.deq_fail_objs += r->stats[lcore_id].deq_fail_objs;
}
- printf(" size=%"PRIu32"\n", r->prod.size);
- printf(" enq_success_bulk=%"PRIu64"\n", sum.enq_success_bulk);
- printf(" enq_success_objs=%"PRIu64"\n", sum.enq_success_objs);
- printf(" enq_quota_bulk=%"PRIu64"\n", sum.enq_quota_bulk);
- printf(" enq_quota_objs=%"PRIu64"\n", sum.enq_quota_objs);
- printf(" enq_fail_bulk=%"PRIu64"\n", sum.enq_fail_bulk);
- printf(" enq_fail_objs=%"PRIu64"\n", sum.enq_fail_objs);
- printf(" deq_success_bulk=%"PRIu64"\n", sum.deq_success_bulk);
- printf(" deq_success_objs=%"PRIu64"\n", sum.deq_success_objs);
- printf(" deq_fail_bulk=%"PRIu64"\n", sum.deq_fail_bulk);
- printf(" deq_fail_objs=%"PRIu64"\n", sum.deq_fail_objs);
+ fprintf(f, " size=%"PRIu32"\n", r->prod.size);
+ fprintf(f, " enq_success_bulk=%"PRIu64"\n", sum.enq_success_bulk);
+ fprintf(f, " enq_success_objs=%"PRIu64"\n", sum.enq_success_objs);
+ fprintf(f, " enq_quota_bulk=%"PRIu64"\n", sum.enq_quota_bulk);
+ fprintf(f, " enq_quota_objs=%"PRIu64"\n", sum.enq_quota_objs);
+ fprintf(f, " enq_fail_bulk=%"PRIu64"\n", sum.enq_fail_bulk);
+ fprintf(f, " enq_fail_objs=%"PRIu64"\n", sum.enq_fail_objs);
+ fprintf(f, " deq_success_bulk=%"PRIu64"\n", sum.deq_success_bulk);
+ fprintf(f, " deq_success_objs=%"PRIu64"\n", sum.deq_success_objs);
+ fprintf(f, " deq_fail_bulk=%"PRIu64"\n", sum.deq_fail_bulk);
+ fprintf(f, " deq_fail_objs=%"PRIu64"\n", sum.deq_fail_objs);
#else
- printf(" no statistics available\n");
+ fprintf(f, " no statistics available\n");
#endif
}
/* dump the status of all rings on the console */
void
-rte_ring_list_dump(void)
+rte_ring_list_dump(FILE *f)
{
const struct rte_ring *mp;
struct rte_ring_list *ring_list;
/* check that we have an initialised tail queue */
- if ((ring_list =
+ if ((ring_list =
RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_RING, rte_ring_list)) == NULL) {
rte_errno = E_RTE_NO_TAILQ;
- return;
+ return;
}
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(mp, ring_list, next) {
- rte_ring_dump(mp);
+ rte_ring_dump(f, mp);
}
rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK);
struct rte_ring_list *ring_list;
/* check that we have an initialized tail queue */
- if ((ring_list =
+ if ((ring_list =
RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_RING, rte_ring_list)) == NULL) {
rte_errno = E_RTE_NO_TAILQ;
- return NULL;
+ return NULL;
}
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
-
+
TAILQ_FOREACH(r, ring_list, next) {
if (strncmp(name, r->name, RTE_RING_NAMESIZE) == 0)
break;