Skyscraper 2.0
profilergui.cpp
Go to the documentation of this file.
1/*
2 Skyscraper 2.0 Alpha - Profiler GUI
3 Copyright (C)2003-2024 Ryan Thoryk
4 https://www.skyscrapersim.net
5 https://sourceforge.net/projects/skyscraper/
6 Contact - ryan@skyscrapersim.net
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21*/
22
23#include "globals.h"
24#include "sbs.h"
25#include "profilergui.h"
26#include "profiler.h"
27#include "debugpanel.h"
28
29//(*InternalHeaders(Profiler)
30#include <wx/intl.h>
31#include <wx/string.h>
32//*)
33
34namespace Skyscraper {
35
36//(*IdInit(Profiler)
37const long Profiler::ID_chkAdvanced = wxNewId();
38const long Profiler::ID_chkCapture = wxNewId();
39const long Profiler::ID_txtMain = wxNewId();
40//*)
41
42BEGIN_EVENT_TABLE(Profiler,wxDialog)
43 //(*EventTable(Profiler)
44 //*)
45END_EVENT_TABLE()
46
47Profiler::Profiler(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
48{
49 //(*Initialize(Profiler)
50 wxBoxSizer* BoxSizer1;
51 wxBoxSizer* BoxSizer2;
52 wxFlexGridSizer* FlexGridSizer1;
53
54 Create(parent, wxID_ANY, _("Profiler"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY"));
55 BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
56 FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
57 BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
58 chkAdvanced = new wxCheckBox(this, ID_chkAdvanced, _("Advanced Profiling"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkAdvanced"));
59 chkAdvanced->SetValue(false);
60 BoxSizer2->Add(chkAdvanced, 1, wxALIGN_TOP, 5);
61 chkCapture = new wxCheckBox(this, ID_chkCapture, _("Capture"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkCapture"));
62 chkCapture->SetValue(true);
63 BoxSizer2->Add(chkCapture, 1, wxALIGN_TOP, 5);
64 FlexGridSizer1->Add(BoxSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
65 txtMain = new wxTextCtrl(this, ID_txtMain, wxEmptyString, wxDefaultPosition, wxSize(800,600), wxTE_MULTILINE|wxTE_READONLY|wxVSCROLL, wxDefaultValidator, _T("ID_txtMain"));
66 FlexGridSizer1->Add(txtMain, 1, wxALL|wxEXPAND, 5);
67 BoxSizer1->Add(FlexGridSizer1, 1, wxEXPAND, 5);
68 SetSizer(BoxSizer1);
69 BoxSizer1->SetSizeHints(this);
70 Center();
71 //*)
72 advanced = false;
73 count = 0;
74}
75
77{
79
80 //(*Destroy(Profiler)
81 //*)
82}
83
85{
86 if (advanced != chkAdvanced->GetValue())
88
89 advanced = chkAdvanced->GetValue();
91
92 if (count == 0)
93 {
94 std::string output;
95
96 /*SBS::ProfileIterator* profileIterator = SBS::ProfileManager::Get_Iterator();
97 SBS::ProfileManager::dumpRecursive(output, profileIterator, 0);
98 SBS::ProfileManager::Release_Iterator(profileIterator);*/
99
100 if (chkCapture->GetValue() == true)
101 {
103 txtMain->SetValue(output);
104 }
105 }
106 count++;
107
108 if (count == 10)
109 count = 0;
110}
111
112void Profiler::OnResize(wxSizeEvent& event)
113{
114}
115
116}
117
static void dumpAll(std::string &output)
Definition profiler.cpp:356
static void CleanupMemory(void)
Definition profiler.h:91
wxCheckBox * chkCapture
Definition profilergui.h:45
void OnResize(wxSizeEvent &event)
wxCheckBox * chkAdvanced
Definition profilergui.h:44
static const long ID_txtMain
Definition profilergui.h:54
static const long ID_chkCapture
Definition profilergui.h:53
wxTextCtrl * txtMain
Definition profilergui.h:46
static const long ID_chkAdvanced
Definition profilergui.h:52
bool SBSIMPEXP enable_advanced_profiling
Definition profiler.cpp:16