trendline.h 844 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef __trendline_h_
  2. #define __trendline_h_
  3. #include "../common/cf_platform.h"
  4. /*通过延迟的增长趋势确定过载参数*/
  5. typedef struct
  6. {
  7. double arrival_delta;
  8. double smoothed_delay;
  9. }delay_hist_t;
  10. typedef struct
  11. {
  12. size_t window_size;
  13. double smoothing_coef;
  14. double threshold_gain;
  15. uint32_t num_of_deltas;
  16. int64_t first_arrival_ts;
  17. double acc_delay;
  18. double smoothed_delay;
  19. double trendline;
  20. int index;
  21. delay_hist_t* que; /*最近的曲线趋势历史点数据*/
  22. }trendline_estimator_t;
  23. trendline_estimator_t* trendline_create(size_t wnd_size, double smoothing_coef, double threshold_gain);
  24. void trendline_destroy(trendline_estimator_t* est);
  25. void trendline_update(trendline_estimator_t* est, double recv_delta_ms, double send_delta_ms, int64_t arrival_ts);
  26. double trendline_slope(trendline_estimator_t* est);
  27. #endif