summaryrefslogtreecommitdiff
path: root/src/trace_output.c
diff options
context:
space:
mode:
authortongzongzhen <[email protected]>2024-05-06 18:42:40 +0800
committertongzongzhen <[email protected]>2024-05-06 18:42:40 +0800
commitd717475982e08f95f64306601689efbf374dbafa (patch)
tree71297cd81ce4936efeb90a3577fe8014108aebb7 /src/trace_output.c
parentfadf6b0309f0cd56ae1f8ad6a034043c8bdc00fc (diff)
When the program starts, clear old packets;dump ctx; Use the type in marsio.h to replace the custom role;
Diffstat (limited to 'src/trace_output.c')
-rw-r--r--src/trace_output.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/trace_output.c b/src/trace_output.c
index 98e57cd..73bbc75 100644
--- a/src/trace_output.c
+++ b/src/trace_output.c
@@ -156,7 +156,7 @@ void * dp_trace_process_thread(void * arg)
}
uint8_t role = job_id_role_get(index_to_job_id(i));
- if (role == DP_TRACE_ROLE)
+ if (role == DP_TRACE_MEASUREMENT_TYPE_TRACE)
{
for (unsigned int j = 0; j < nr_mbufs; j++)
{
@@ -165,7 +165,7 @@ void * dp_trace_process_thread(void * arg)
job_bitmap_t job_id = index_to_job_id(i);
cli_job_mbufs_write_process(tx_buff, nr_mbufs, job_id);
}
- else if (role == DP_TELEMETRY_ROLE)
+ else if (role == DP_TRACE_MEASUREMENT_TYPE_TELEMETRY)
{
for (unsigned int j = 0; j < nr_mbufs; j++)
{
@@ -750,4 +750,25 @@ static void thread_id_to_ring_id_calculate(unsigned int nr_thread, unsigned int
qids[i] = (++prefix_index);
(*nr_qids)++;
}
+}
+
+void dp_trace_ring_clear()
+{
+ unsigned int ring_clear_cnt = 0;
+ unsigned int nr_ring = DP_TRACE_RING_NUM;
+ marsio_buff_t * rx_buff[1024];
+
+ saving_stat = record_saving_stat_point_get(0);
+
+ for (unsigned int i = 0; i < nr_ring; i++)
+ {
+ unsigned int nr_recv = marsio_dp_trace_mbuf_recv_burst(mr_instance, i, rx_buff, TELEMETRY_DIM(rx_buff));
+ saving_stat->recv_success += nr_recv;
+ saving_stat->init_old_packet_drop += nr_recv;
+
+ marsio_dp_trace_mbuf_free(mr_instance, rx_buff, nr_recv);
+ ring_clear_cnt += nr_recv;
+ }
+
+ dzlog_info("The program starts and clears %u mbufs", ring_clear_cnt);
} \ No newline at end of file