- Timestamp:
- 02/20/15 17:41:55 (6 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 10c47a0
- Parents:
- e8c0a9c
- git-author:
- Richard Sanger <rsangerarj@…> (02/20/15 17:36:30)
- git-committer:
- Richard Sanger <rsangerarj@…> (02/20/15 17:41:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_dag25.c
r16840ea r5df059b 1215 1215 * If DUCK reporting is enabled, the packet returned may be a DUCK update 1216 1216 */ 1217 static int dag_read_packet_ real(libtrace_t *libtrace,1217 static int dag_read_packet_stream(libtrace_t *libtrace, 1218 1218 struct dag_per_stream_t *stream_data, 1219 1219 libtrace_thread_t *t, /* Optional */ … … 1285 1285 static int dag_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) 1286 1286 { 1287 return dag_read_packet_ real(libtrace, FORMAT_DATA_FIRST, NULL, packet);1287 return dag_read_packet_stream(libtrace, FORMAT_DATA_FIRST, NULL, packet); 1288 1288 } 1289 1289 … … 1300 1300 /* Read as many packets as we can, but read atleast one packet */ 1301 1301 do { 1302 ret = dag_read_packet_ real(libtrace, stream_data, t,1302 ret = dag_read_packet_stream(libtrace, stream_data, t, 1303 1303 packets[read_packets]); 1304 1304 if (ret < 0) … … 1427 1427 } 1428 1428 1429 /* Gets the number of dropped packets */ 1430 static uint64_t dag_get_dropped_packets(libtrace_t *libtrace) 1431 { 1432 uint64_t sum = 0; 1433 libtrace_list_node_t *tmp = FORMAT_DATA_HEAD; 1434 1435 /* Sum the drop counter for all the packets */ 1429 static void dag_get_statistics(libtrace_t *libtrace, libtrace_stat_t *stat) 1430 { 1431 libtrace_list_node_t *tmp; 1432 assert(stat && libtrace); 1433 tmp = FORMAT_DATA_HEAD; 1434 1435 /* We don't filter packets on the card itself */ 1436 stat->filtered_valid = 1; 1437 stat->filtered = 0; 1438 1439 /* Dropped, filtered the */ 1440 stat->dropped_valid = 1; 1441 stat->dropped = 0; 1436 1442 while (tmp != NULL) { 1437 s um+= STREAM_DATA(tmp)->drops;1443 stat->dropped += STREAM_DATA(tmp)->drops; 1438 1444 tmp = tmp->next; 1439 1445 } 1440 1446 1441 return sum; 1447 } 1448 1449 static void dag_get_thread_statisitics(libtrace_t *libtrace, libtrace_thread_t *t, 1450 libtrace_stat_t *stat) { 1451 struct dag_per_stream_t *stream_data = t->format_data; 1452 assert(stat && libtrace); 1453 1454 stat->dropped_valid = 1; 1455 stat->dropped = stream_data->drops; 1456 1457 stat->filtered_valid = 1; 1458 stat->filtered = 0; 1442 1459 } 1443 1460 … … 1479 1496 { 1480 1497 struct dag_per_stream_t *stream_data; 1498 libtrace_list_node_t *node; 1481 1499 1482 1500 if (reader) { 1483 1501 if (t->type == THREAD_PERPKT) { 1484 stream_data = 1485 (struct dag_per_stream_t *) 1486 libtrace_list_get_index(FORMAT_DATA->per_stream, 1487 t->perpkt_num)->data; 1502 1503 node = libtrace_list_get_index(FORMAT_DATA->per_stream, 1504 t->perpkt_num); 1505 if (node == NULL) { 1506 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, 1507 "Too few streams supplied for the" 1508 " number of threads lanuched"); 1509 return -1; 1510 } 1511 stream_data = node->data; 1488 1512 1489 1513 /* Pass the per thread data to the thread */ … … 1542 1566 NULL, /* get_received_packets */ 1543 1567 NULL, /* get_filtered_packets */ 1544 dag_get_dropped_packets,/* get_dropped_packets */1545 NULL,/* get_statistics */1568 NULL, /* get_dropped_packets */ 1569 dag_get_statistics, /* get_statistics */ 1546 1570 NULL, /* get_fd */ 1547 1571 trace_event_dag, /* trace_event */ … … 1556 1580 dag_pregister_thread, 1557 1581 NULL, 1558 NULL/* get thread stats */1582 dag_get_thread_statisitics /* get thread stats */ 1559 1583 }; 1560 1584
Note: See TracChangeset
for help on using the changeset viewer.