harmonizer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "defs.h"
  3. #include "config.h"
  4. namespace NActors {
  5. class IExecutorPool;
  6. struct TPoolHarmonizerStats {
  7. ui64 IncreasingThreadsByNeedyState = 0;
  8. ui64 IncreasingThreadsByExchange = 0;
  9. ui64 DecreasingThreadsByStarvedState = 0;
  10. ui64 DecreasingThreadsByHoggishState = 0;
  11. ui64 DecreasingThreadsByExchange = 0;
  12. i64 MaxConsumedCpu = 0.0;
  13. i64 MinConsumedCpu = 0.0;
  14. i64 MaxBookedCpu = 0.0;
  15. i64 MinBookedCpu = 0.0;
  16. i16 PotentialMaxThreadCount = 0;
  17. bool IsNeedy = false;
  18. bool IsStarved = false;
  19. bool IsHoggish = false;
  20. };
  21. struct THarmonizerStats {
  22. i64 MaxConsumedCpu = 0.0;
  23. i64 MinConsumedCpu = 0.0;
  24. i64 MaxBookedCpu = 0.0;
  25. i64 MinBookedCpu = 0.0;
  26. };
  27. // Pool cpu harmonizer
  28. class IHarmonizer {
  29. public:
  30. virtual ~IHarmonizer() {}
  31. virtual void Harmonize(ui64 ts) = 0;
  32. virtual void DeclareEmergency(ui64 ts) = 0;
  33. virtual void AddPool(IExecutorPool* pool, TSelfPingInfo *pingInfo = nullptr) = 0;
  34. virtual void Enable(bool enable) = 0;
  35. virtual TPoolHarmonizerStats GetPoolStats(i16 poolId) const = 0;
  36. virtual THarmonizerStats GetStats() const = 0;
  37. };
  38. IHarmonizer* MakeHarmonizer(ui64 ts);
  39. }