Nebula
Loading...
Searching...
No Matches
memorypanel.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12//------------------------------------------------------------------------------
13#if WITH_NEBULA_EDITOR
14#include "foundation/stdneb.h"
15#include "imgui.h"
17#include "neweditor/core/editorpanel.h"
18#include "util/array.h"
19#include "util/string.h"
20
21namespace Scripting
22{
23
24//------------------------------------------------------------------------------
27class MemoryProfilerPanel final : public Editor::EditorPanel
28{
30public:
32 virtual ~MemoryProfilerPanel();
33
34 bool BeginWindow() override;
35 void Draw() override;
36
37protected:
38 bool OnSetup() override;
39
40private:
42 void ReadSample();
43
45 void Append(Util::Array<float>& history, float value);
46
48 void DrawGraph(const char* label, const char* id, const Util::Array<float>& values, const ImVec4& color, bool asBars, const Util::String& overlay);
49
51 void DrawBar(const char* label, uint64_t value, uint64_t budget);
52
54 void DrawGenerations();
55
57 void CommandCollect(const Util::Array<Util::String>& args);
58
59 bool pauseProfiling;
60
62 bool sampled;
63 MemoryProfile::Sample sample;
64 uint64_t prevTotalAllocated;
65 double prevTotalPauseMs;
66 int prevCollections;
67
69 uint64_t frameAllocated;
70 double framePauseMs;
71 int collectionsThisFrame;
72
74 float heapBudgetMb;
75 float frameAllocBudgetKb;
76
78 static const IndexT MaxHistory = 240;
79 Util::Array<float> allocatedHistory;
80 Util::Array<float> frameAllocHistory;
81 Util::Array<float> pauseHistory;
83 Util::Array<int> collectionHistory;
84};
85
86} // namespace Scripting
87
88#endif // WITH_NEBULA_EDITOR
89//------------------------------------------------------------------------------
Nebula's dynamic array class.
Definition array.h:61
Nebula's universal string class.
Definition string.h:50
Definition game.cc:16
#define __DeclareClass(type)
int IndexT
Definition types.h:49