Implemented more efficient and memory savvy RSI

This commit is contained in:
Luca Deri
2021-02-05 12:38:41 +01:00
parent 60b58dbd67
commit 8dd7716ae5
4 changed files with 66 additions and 26 deletions
+1 -1
View File
@@ -1391,7 +1391,7 @@ extern "C" {
/* ******************************* */
void ndpi_init_rsi(struct ndpi_rsi_struct *s, u_int16_t num_learning_values);
int ndpi_alloc_rsi(struct ndpi_rsi_struct *s, u_int16_t num_learning_values);
void ndpi_free_rsi(struct ndpi_rsi_struct *s);
float ndpi_rsi_add_value(struct ndpi_rsi_struct *s, const u_int32_t value);
+4 -2
View File
@@ -1545,8 +1545,10 @@ struct ndpi_analyze_struct {
/* **************************************** */
struct ndpi_rsi_struct {
struct ndpi_analyze_struct gains, losses;
u_int32_t last_value;
u_int8_t empty:1, rsi_ready:1, _notused:6;
u_int16_t num_values, next_index;
u_int32_t *gains, *losses;
u_int32_t last_value, total_gains, total_losses;
};
/* **************************************** */