llfasttimerview.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. * @file llfasttimerview.h
  3. * @brief LLFastTimerView class definition
  4. *
  5. * $LicenseInfo:firstyear=2004&license=viewergpl$
  6. *
  7. * Copyright (c) 2004-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLFASTTIMERVIEW_H
  33. #define LL_LLFASTTIMERVIEW_H
  34. #include "llfasttimer.h"
  35. #if LL_FAST_TIMERS_ENABLED
  36. # include "llfloater.h"
  37. # include "llframetimer.h"
  38. class LLFontGL;
  39. class LLFastTimerView final : public LLFloater
  40. {
  41. protected:
  42. LOG_CLASS(LLFastTimerView);
  43. public:
  44. LLFastTimerView(const std::string& name);
  45. ~LLFastTimerView() override;
  46. void setVisible(bool visible) override;
  47. void onClose(bool app_quitting) override;
  48. void draw() override;
  49. bool handleMouseDown(S32 x, S32 y, MASK mask) override;
  50. bool handleRightMouseDown(S32 x, S32 y, MASK mask) override;
  51. bool handleMouseUp(S32 x, S32 y, MASK mask) override;
  52. bool handleHover(S32 x, S32 y, MASK mask) override;
  53. bool handleScrollWheel(S32 x, S32 y, S32 clicks) override;
  54. S32 getLegendIndex(S32 y);
  55. F64 getTime(LLFastTimer::EFastTimerType tidx);
  56. private:
  57. void resize();
  58. void setDisplayModeText();
  59. void setCenterModeText();
  60. private:
  61. LLFrameTimer mHighlightTimer;
  62. LLRect mBarRect;
  63. S32* mBarStart;
  64. S32* mBarEnd;
  65. U64 mAvgCountTotal;
  66. U64 mMaxCountTotal;
  67. LLFontGL* mFont;
  68. LLWString mCenterModeText;
  69. LLWString mDisplayModeText;
  70. S32 mDisplayModeTextWidth;
  71. S32 mDisplayMode;
  72. S32 mDisplayCenter;
  73. S32 mDisplayCalls;
  74. S32 mDisplayHz;
  75. S32 mScrollIndex;
  76. S32 mHoverIndex;
  77. S32 mHoverBarIndex;
  78. S32 mSubtractHidden;
  79. S32 mPrintStats;
  80. S32 mWindowHeight;
  81. S32 mWindowWidth;
  82. bool mFirstDrawLoop;
  83. };
  84. extern LLFastTimerView* gFastTimerViewp;
  85. #endif // LL_FAST_TIMERS_ENABLED
  86. #if TRACY_ENABLE
  87. # include "llerror.h"
  88. class LLProcessLauncher;
  89. // Purely static class, used to launch the Tracy profiler executable
  90. class HBTracyProfiler
  91. {
  92. protected:
  93. LOG_CLASS(HBTracyProfiler);
  94. public:
  95. HBTracyProfiler() = delete;
  96. ~HBTracyProfiler() = delete;
  97. static bool running();
  98. static void launch();
  99. static void detach();
  100. static void kill();
  101. private:
  102. static LLProcessLauncher* sProcess;
  103. };
  104. #endif // TRACY_ENABLE
  105. #endif // LL_LLFASTTIMERVIEW_H