PageRenderTime 16ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llviewerthrottle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 90 lines | 45 code | 20 blank | 25 comment | 0 complexity | c0491f2f8a12d6873d802e2ef52b174a MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewerthrottle.h
  3. * @brief LLViewerThrottle class header file
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLVIEWERTHROTTLE_H
  27. #define LL_LLVIEWERTHROTTLE_H
  28. #include <vector>
  29. #include "llstring.h"
  30. #include "llframetimer.h"
  31. #include "llthrottle.h"
  32. class LLViewerThrottleGroup
  33. {
  34. LLViewerThrottleGroup();
  35. LLViewerThrottleGroup(const F32 settings[TC_EOF]);
  36. LLViewerThrottleGroup operator*(const F32 frac) const;
  37. LLViewerThrottleGroup operator+(const LLViewerThrottleGroup &b) const;
  38. LLViewerThrottleGroup operator-(const LLViewerThrottleGroup &b) const;
  39. F32 getTotal() { return mThrottleTotal; }
  40. void sendToSim() const;
  41. void dump();
  42. friend class LLViewerThrottle;
  43. protected:
  44. F32 mThrottles[TC_EOF];
  45. F32 mThrottleTotal;
  46. };
  47. class LLViewerThrottle
  48. {
  49. public:
  50. LLViewerThrottle();
  51. void setMaxBandwidth(F32 kbits_per_second, BOOL from_event = FALSE);
  52. void load();
  53. void save() const;
  54. void sendToSim() const;
  55. F32 getMaxBandwidth()const { return mMaxBandwidth; }
  56. F32 getCurrentBandwidth() const { return mCurrentBandwidth; }
  57. void updateDynamicThrottle();
  58. void resetDynamicThrottle();
  59. LLViewerThrottleGroup getThrottleGroup(const F32 bandwidth_kbps);
  60. static const std::string sNames[TC_EOF];
  61. protected:
  62. F32 mMaxBandwidth;
  63. F32 mCurrentBandwidth;
  64. LLViewerThrottleGroup mCurrent;
  65. std::vector<LLViewerThrottleGroup> mPresets;
  66. LLFrameTimer mUpdateTimer;
  67. F32 mThrottleFrac;
  68. };
  69. extern LLViewerThrottle gViewerThrottle;
  70. #endif // LL_LLVIEWERTHROTTLE_H