mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-02 00:40:17 +00:00
ndpiReader: add statistics about nDPI performance (#1240)
The goal is to have a (roughly) idea about how many packets nDPI needs to properly classify a flow. Log this information (and guessed flows number too) during unit tests, to keep track of improvements/regressions across commits.
This commit is contained in:
parent
96b71def49
commit
cccf794265
219 changed files with 989 additions and 0 deletions
|
|
@ -893,6 +893,12 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
|
|||
|
||||
ndpi_tsearch(newflow, &workflow->ndpi_flows_root[idx], ndpi_workflow_node_cmp); /* Add */
|
||||
workflow->stats.ndpi_flow_count++;
|
||||
if(*proto == IPPROTO_TCP)
|
||||
workflow->stats.flow_count[0]++;
|
||||
else if(*proto == IPPROTO_UDP)
|
||||
workflow->stats.flow_count[1]++;
|
||||
else
|
||||
workflow->stats.flow_count[2]++;
|
||||
|
||||
*src = newflow->src_id, *dst = newflow->dst_id;
|
||||
newflow->entropy.src2dst_pkt_len[newflow->entropy.src2dst_pkt_count] = l4_data_len;
|
||||
|
|
@ -1511,6 +1517,13 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
|
|||
printf("%s()\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
if(proto == IPPROTO_TCP)
|
||||
workflow->stats.dpi_packet_count[0]++;
|
||||
else if(proto == IPPROTO_UDP)
|
||||
workflow->stats.dpi_packet_count[1]++;
|
||||
else
|
||||
workflow->stats.dpi_packet_count[2]++;
|
||||
|
||||
flow->detected_protocol = ndpi_detection_process_packet(workflow->ndpi_struct, ndpi_flow,
|
||||
iph ? (uint8_t *)iph : (uint8_t *)iph6,
|
||||
ipsize, time_ms, src, dst);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue