diff options
author | Luca <deri@ntop.org> | 2019-08-28 14:02:39 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2019-08-28 14:02:39 +0200 |
commit | e4e40e3c70e2cd49fd537a526fa70805c8c391c5 (patch) | |
tree | 98c605df4ac69cdef449d4eec700f5b74f621feb /src/include | |
parent | 84aeee49bda71f71877ca114a1946a6d359be5d5 (diff) |
Added entropy, average, stddev, variance, bytes ratio calculation
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h | 7 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 03f21d4cd..c6d17a4b5 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -899,8 +899,11 @@ extern "C" { float ndpi_data_average(struct ndpi_analyze_struct *s); float ndpi_data_window_average(struct ndpi_analyze_struct *s); - float ndpi_entropy(struct ndpi_analyze_struct *s); - + float ndpi_data_entropy(struct ndpi_analyze_struct *s); + float ndpi_data_variance(struct ndpi_analyze_struct *s); + float ndpi_data_stddev(struct ndpi_analyze_struct *s); + float ndpi_data_ratio(u_int32_t sent, u_int32_t rcvd); + void ndpi_data_print_window_values(struct ndpi_analyze_struct *s); /* debug */ #ifdef __cplusplus } diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 2aacf847a..0db1ccf91 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1369,6 +1369,11 @@ struct ndpi_analyze_struct { u_int32_t *values; u_int32_t sum_total, num_data_entries, next_value_insert_index; u_int16_t num_values_array_len /* lenght of the values array */; + + struct { + /* https://www.johndcook.com/blog/standard_deviation/ */ + float mu, q; + } stddev; }; #define DEFAULT_SERIES_LEN 64 |