aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-05-29 16:53:11 +0200
committerGitHub <noreply@github.com>2023-05-29 16:53:11 +0200
commit46ff0691176f9c33a7ea4838b197568e2bd84c39 (patch)
tree1cdcb25139cd5ca876c32b961c038aa41af23a99 /example/ndpiReader.c
parent7ce14da0c8c06967013503187081fa3a146ab8bb (diff)
ndpiReader: improve printing of payload statistics (#1989)
Add a basic unit test Fix an endianess issue
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index e43211ddd..5b608b84d 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -252,7 +252,7 @@ static int dpdk_port_id = 0, dpdk_run_capture = 1;
void test_lib(); /* Forward */
-extern void ndpi_report_payload_stats(int print);
+extern void ndpi_report_payload_stats(FILE *out);
extern int parse_proto_name_list(char *str, NDPI_PROTOCOL_BITMASK *bitmask, int inverted_logic);
/* ********************************** */
@@ -420,10 +420,10 @@ flowGetBDMeanandVariance(struct ndpi_flow_info* flow) {
if(csv_fp) {
fprintf(csv_fp, ",%.3f,%.3f,%.3f,%.3f", mean, variance, entropy, entropy * num_bytes);
} else {
- fprintf(out, "[byte_dist_mean: %f", mean);
- fprintf(out, "][byte_dist_std: %f]", variance);
- fprintf(out, "[entropy: %f]", entropy);
- fprintf(out, "[total_entropy: %f]", entropy * num_bytes);
+ fprintf(out, "[byte_dist_mean: %.3f", mean);
+ fprintf(out, "][byte_dist_std: %.3f]", variance);
+ fprintf(out, "[entropy: %.3f]", entropy);
+ fprintf(out, "[total_entropy: %.3f]", entropy * num_bytes);
}
} else {
if(csv_fp)
@@ -2747,7 +2747,7 @@ static void printFlowsStats() {
FILE *out = results_file ? results_file : stdout;
if(enable_payload_analyzer)
- ndpi_report_payload_stats(1);
+ ndpi_report_payload_stats(out);
for(thread_id = 0; thread_id < num_threads; thread_id++)
total_flows += ndpi_thread_info[thread_id].workflow->num_allocated_flows;