diff options
author | Luca Deri <deri@ntop.org> | 2021-02-09 15:56:03 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2021-02-09 15:56:03 +0100 |
commit | 1331e0aec90f5a648371eee1a3a1117669485a11 (patch) | |
tree | 9508df13b5c8bbad0316dc60afaace32b7edd63d /example/ndpiReader.c | |
parent | b960809d3ed775aa37adc489a1664635aeaaba28 (diff) |
Extended the API to calculate jitter
- ndpi_jitter_init()
- ndpi_jitter_free()
- ndpi_jitter_add_value()
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index f837a5c29..a2caeaad9 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -3765,6 +3765,25 @@ void hwUnitTest() { /* *********************************************** */ +void jitterUnitTest() { + struct ndpi_jitter_struct jitter; + float v[] = { 10, 14, 8, 25, 16, 22, 14, 35, 15, 27, 218, 40, 28, 40, 25, 65 }; + u_int i, num = sizeof(v) / sizeof(float); + u_int num_learning_points = 4; + u_int8_t trace = 0; + + assert(ndpi_jitter_init(&jitter, num_learning_points) == 0); + + for(i=0; i<num; i++) { + float rc = ndpi_jitter_add_value(&jitter, v[i]); + + if(trace) + printf("%2u)\t%.3f\t%.3f\n", i, v[i], rc); + } +} + +/* *********************************************** */ + /** @brief MAIN FUNCTION **/ @@ -3788,6 +3807,7 @@ int orginal_main(int argc, char **argv) { /* Internal checks */ // binUnitTest(); hwUnitTest(); + jitterUnitTest(); rsiUnitTest(); hashUnitTest(); dgaUnitTest(); |