Patch level : 10.0 patch ???

Files correlati     : agalib
Ricompilazione Demo : [ ]
Commento            :
Modifiche sul profiling in debug sotto la guida di Guy


git-svn-id: svn://10.65.10.50/branches/R_10_00@21479 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca83 2011-01-20 09:39:11 +00:00
parent c7f052ec5a
commit 6a0c18b1d4

View File

@ -20,13 +20,6 @@ TPerformance_profiler::TPerformance_profiler(const char* desc, bool trc)
_depth++;
_start = clock();
if (!_trc)
{
TString80 msg;
msg << "Profiling " << desc << "...";
statbar_set_title(TASK_WIN, msg);
}
while (true)
{
const clock_t clk = clock();
@ -44,34 +37,29 @@ void TPerformance_profiler::show() const
#ifdef DBG
const double s = double(clock() - _start) / CLOCKS_PER_SEC;
int hour = 0, min = 0;
int sec = int(s);
const int cent = int((s - sec)*100);
if (sec >= 3600)
if (s > 0.1 && (_trc || _depth <= 1)) //visualizzo solo tempi significativi
{
hour = sec / 3600;
sec -= hour * 3600;
}
if (sec >= 60)
{
min = sec / 60;
sec -= min * 60;
}
int hour = 0, min = 0;
int sec = int(s);
const int cent = int((s - sec)*100);
TString256 msg = _desc;
msg.format("%s %02d:%02d:%02d.%02d", (const char*)_desc, hour, min, sec, cent);
if (_trc)
__trace(msg);
else
{
if (_depth <= 1)
if (sec >= 3600)
{
statbar_set_title(TASK_WIN, msg);
if (s > 0)
xvt_sys_sleep(500);
hour = sec / 3600;
sec -= hour * 3600;
}
if (sec >= 60)
{
min = sec / 60;
sec -= min * 60;
}
TString256 msg = _desc;
msg.format("%s %02d:%02d:%02d.%02d", (const char*)_desc, hour, min, sec, cent);
if (_trc)
__trace(msg);
statbar_set_title(TASK_WIN, msg);
}
#endif
}