diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2023-03-01 21:50:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-01 21:50:47 +0100 |
commit | 22fb8349b96d19a6fe784c2323b674e13996b7ac (patch) | |
tree | bcf7d700f5dec0dd3075b383a1f2f3de835f4981 /example | |
parent | 2768366969308ebf55c5804266baba72205618db (diff) |
ndpiReader: print how many packets (per flow) were needed to perform full DPI (#1891)
Average values are already printed, but this change should ease to
identify regressions/improvements.
Diffstat (limited to 'example')
-rw-r--r-- | example/ndpiReader.c | 1 | ||||
-rw-r--r-- | example/reader_util.c | 1 | ||||
-rw-r--r-- | example/reader_util.h | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 5fea3b303..d9f4c5fdf 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -1425,6 +1425,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa #if 0 fprintf(out, "[Num calls: %d]", flow->num_dissector_calls); #endif + fprintf(out, "[DPI packets: %d]", flow->dpi_packets); if(flow->detected_protocol.category != 0) fprintf(out, "[cat: %s/%u]", diff --git a/example/reader_util.c b/example/reader_util.c index b1f72c650..ac152813e 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1662,6 +1662,7 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, workflow->stats.dpi_packet_count[1]++; else workflow->stats.dpi_packet_count[2]++; + flow->dpi_packets++; memset(&input_info, '\0', sizeof(input_info)); /* To be sure to set to "unknown" any fields */ /* Set here any information (easily) available; in this trivial example we don't have any */ diff --git a/example/reader_util.h b/example/reader_util.h index 6f8e8ba20..b30ddbf1f 100644 --- a/example/reader_util.h +++ b/example/reader_util.h @@ -206,6 +206,7 @@ typedef struct ndpi_flow_info { ndpi_protocol detected_protocol; ndpi_confidence_t confidence; u_int16_t num_dissector_calls; + u_int16_t dpi_packets; // Flow data analysis pkt_timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time; |