[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / guilib / GUIControlProfiler.h
blob6dea9fc69b5862a408b16ded221fe9a99fa14ec5
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "GUIControl.h"
13 #include <vector>
15 class CGUIControlProfiler;
16 class TiXmlElement;
18 class CGUIControlProfilerItem
20 public:
21 CGUIControlProfiler *m_pProfiler;
22 CGUIControlProfilerItem * m_pParent;
23 CGUIControl *m_pControl;
24 std::vector<CGUIControlProfilerItem *> m_vecChildren;
25 std::string m_strDescription;
26 int m_controlID;
27 CGUIControl::GUICONTROLTYPES m_ControlType;
28 unsigned int m_visTime = 0;
29 unsigned int m_renderTime = 0;
30 int64_t m_i64VisStart = 0;
31 int64_t m_i64RenderStart = 0;
33 CGUIControlProfilerItem(CGUIControlProfiler *pProfiler, CGUIControlProfilerItem *pParent, CGUIControl *pControl);
34 ~CGUIControlProfilerItem(void);
36 void Reset(CGUIControlProfiler *pProfiler);
37 void BeginVisibility(void);
38 void EndVisibility(void);
39 void BeginRender(void);
40 void EndRender(void);
41 void SaveToXML(TiXmlElement *parent);
42 unsigned int GetTotalTime(void) const { return m_visTime + m_renderTime; }
44 CGUIControlProfilerItem *AddControl(CGUIControl *pControl);
45 CGUIControlProfilerItem *FindOrAddControl(CGUIControl *pControl, bool recurse);
48 class CGUIControlProfiler
50 public:
51 static CGUIControlProfiler &Instance(void);
52 static bool IsRunning(void);
54 void Start(void);
55 void EndFrame(void);
56 void BeginVisibility(CGUIControl *pControl);
57 void EndVisibility(CGUIControl *pControl);
58 void BeginRender(CGUIControl *pControl);
59 void EndRender(CGUIControl *pControl);
60 int GetMaxFrameCount(void) const { return m_iMaxFrameCount; }
61 void SetMaxFrameCount(int iMaxFrameCount) { m_iMaxFrameCount = iMaxFrameCount; }
62 void SetOutputFile(const std::string& strOutputFile) { m_strOutputFile = strOutputFile; }
63 const std::string& GetOutputFile(void) const { return m_strOutputFile; }
64 bool SaveResults(void);
65 unsigned int GetTotalTime(void) const { return m_ItemHead.GetTotalTime(); }
67 float m_fPerfScale;
68 private:
69 CGUIControlProfiler(void);
70 ~CGUIControlProfiler(void) = default;
71 CGUIControlProfiler(const CGUIControlProfiler &that) = delete;
72 CGUIControlProfiler &operator=(const CGUIControlProfiler &that) = delete;
74 CGUIControlProfilerItem m_ItemHead;
75 CGUIControlProfilerItem *m_pLastItem;
76 CGUIControlProfilerItem *FindOrAddControl(CGUIControl *pControl);
78 static bool m_bIsRunning;
79 std::string m_strOutputFile;
80 int m_iMaxFrameCount = 200;
81 int m_iFrameCount = 0;
84 #define GUIPROFILER_VISIBILITY_BEGIN(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().BeginVisibility(x); }
85 #define GUIPROFILER_VISIBILITY_END(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndVisibility(x); }
86 #define GUIPROFILER_RENDER_BEGIN(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().BeginRender(x); }
87 #define GUIPROFILER_RENDER_END(x) { if (CGUIControlProfiler::IsRunning()) CGUIControlProfiler::Instance().EndRender(x); }