Skip to content

Commit b6d698a

Browse files
author
nitrocaster
committed
Delete redundant stats output.
1 parent 8bfcc3b commit b6d698a

File tree

4 files changed

+19
-64
lines changed

4 files changed

+19
-64
lines changed

src/xrEngine/Stats.cpp

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,16 @@ static void DumpColliderStatistics(CGameFont &font, PerformanceAlert *alert)
102102

103103
void CStats::Show()
104104
{
105-
{
106-
float mem_count = float(Memory.stat_calls);
107-
if (mem_count > fMem_calls)
108-
fMem_calls = mem_count;
109-
else
110-
fMem_calls = 0.9f*fMem_calls + 0.1f*mem_count;
111-
Memory.stat_calls = 0;
112-
}
105+
float memCalls = float(Memory.stat_calls);
106+
if (memCalls > fMem_calls)
107+
fMem_calls = memCalls;
108+
else
109+
fMem_calls = 0.9f*fMem_calls + 0.1f*memCalls;
110+
Memory.stat_calls = 0;
113111
if (g_dedicated_server)
114112
return;
115113
auto &font = *statsFont;
116114
auto engineTotal = Device.GetStats().EngineTotal.result;
117-
int frm = 2000;
118-
div_t ddd = div(Device.dwFrame, frm);
119-
if (ddd.rem<frm/2.0f)
120-
{
121-
font.SetColor(0xFFFFFFFF);
122-
font.OutSet(0, 0);
123-
font.OutNext(*eval_line_1);
124-
font.OutNext(*eval_line_2);
125-
font.OutNext(*eval_line_3);
126-
font.OnRender();
127-
}
128115
const float fontBaseSize = 0.01f;
129116
PerformanceAlert alertInstance(fontBaseSize, {300, 300});
130117
auto alertPtr = g_bDisableRedText ? nullptr : &alertInstance;
@@ -169,21 +156,14 @@ void CStats::Show()
169156
pInput->DumpStatistics(font, alertPtr);
170157
font.OutSkip();
171158
#ifdef DEBUG_MEMORY_MANAGER
172-
font.OutSkip();
173159
font.OutNext("str: cmp[%3d], dock[%3d], qpc[%3d]", Memory.stat_strcmp, Memory.stat_strdock, CPU::qpc_counter);
174160
Memory.stat_strcmp = 0;
175161
Memory.stat_strdock = 0;
176162
CPU::qpc_counter = 0;
177-
#else // DEBUG_MEMORY_MANAGER
178-
font.OutSkip();
163+
#else
179164
font.OutNext("qpc[%3d]", CPU::qpc_counter);
180165
CPU::qpc_counter = 0;
181-
#endif // DEBUG_MEMORY_MANAGER
182-
font.OutSkip();
183-
// process pureStats
184-
font.OutSet(400, 0);
185-
font.SetHeightI(fontBaseSize);
186-
seqStats.Process(rp_Stats);
166+
#endif
187167
font.OnRender();
188168
}
189169
if (psDeviceFlags.test(rsCameraPos))
@@ -196,43 +176,24 @@ void CStats::Show()
196176
font.OnRender();
197177
}
198178
#ifdef DEBUG
199-
// Show errors
200179
if (!g_bDisableRedText && errors.size())
201180
{
202181
font.SetColor(color_rgba(255, 16, 16, 191));
203182
font.OutSet(200, 0);
204183
font.SetHeightI(fontBaseSize);
205-
#if 0
206-
for (u32 it = 0; it < errors.size(); it++)
207-
font.OutNext("%s", errors[it].c_str());
208-
#else
209184
for (u32 it = (u32)_max(int(0), (int)errors.size() - g_ErrorLineCount); it < errors.size(); it++)
210185
font.OutNext("%s", errors[it].c_str());
211-
#endif
212186
font.OnRender();
213187
}
214188
#endif
215189
}
216190

217191
void CStats::OnDeviceCreate()
218192
{
219-
g_bDisableRedText = strstr(Core.Params, "-xclsx") ? TRUE : FALSE;
220-
221-
// if (!strstr(Core.Params, "-dedicated"))
193+
g_bDisableRedText = !!strstr(Core.Params, "-xclsx");
222194
#ifndef DEDICATED_SERVER
223195
statsFont = xr_new<CGameFont>("stat_font", CGameFont::fsDeviceIndependent);
224196
#endif
225-
226-
if (!pSettings->section_exist("evaluation")
227-
|| !pSettings->line_exist("evaluation", "line1")
228-
|| !pSettings->line_exist("evaluation", "line2")
229-
|| !pSettings->line_exist("evaluation", "line3"))
230-
FATAL("");
231-
232-
eval_line_1 = pSettings->r_string_wb("evaluation", "line1");
233-
eval_line_2 = pSettings->r_string_wb("evaluation", "line2");
234-
eval_line_3 = pSettings->r_string_wb("evaluation", "line3");
235-
//
236197
#ifdef DEBUG
237198
if (!g_bDisableRedText)
238199
{

src/xrEngine/Stats.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,23 @@ DECLARE_MESSAGE(Stats);
1212

1313
class ENGINE_API CStats : public pureRender
1414
{
15-
public:
15+
private:
1616
CGameFont *statsFont;
1717
float fMem_calls;
18-
u32 dwMem_calls;
19-
shared_str eval_line_1;
20-
shared_str eval_line_2;
21-
shared_str eval_line_3;
18+
xr_vector<shared_str> errors;
19+
20+
public:
21+
CStats();
22+
~CStats();
2223

2324
void Show(void);
2425
virtual void OnRender();
2526
void OnDeviceCreate(void);
2627
void OnDeviceDestroy(void);
28+
IC CGameFont* Font() { return statsFont; }
29+
2730
private:
2831
void FilteredLog(const char *s);
29-
public:
30-
xr_vector <shared_str> errors;
31-
CRegistrator <pureStats> seqStats; // XXX: not used
32-
public:
33-
CStats();
34-
~CStats();
35-
36-
IC CGameFont* Font() { return statsFont; }
3732
};
3833

3934
enum

src/xrEngine/device.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,7 @@ void CRenderDevice::on_idle()
248248
{
249249
seqRender.Process(rp_Render);
250250
CalcFrameStats();
251-
if (psDeviceFlags.test(rsCameraPos) || psDeviceFlags.test(rsStatistic) || Statistic->errors.size())
252-
Statistic->Show();
251+
Statistic->Show();
253252
End(); // Present goes here
254253
}
255254
renderTotalReal.End();

src/xrEngine/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class ENGINE_API CRenderDeviceBase :
116116
public CRenderDeviceData
117117
{
118118
protected:
119-
CStats* Statistic; // XXX: remove (global stats)
119+
CStats* Statistic;
120120
CRenderDeviceBase() { Statistic = nullptr; }
121121
};
122122

0 commit comments

Comments
 (0)