Commit b6f767b1 authored by cutealien's avatar cutealien

Allow IGUIProfiler to display all profile groups on the same page.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4971 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bc6ed7c8
......@@ -128,10 +128,14 @@ public:
break;
case KEY_F5:
IncludeOverview = !IncludeOverview;
GuiProfiler->firstPage(IncludeOverview); // not strictly needed, but otherwise the update won't update
break;
case KEY_F6:
GuiProfiler->setIgnoreUncalled( !GuiProfiler->getIgnoreUncalled() );
break;
case KEY_F7:
GuiProfiler->setShowGroupsTogether( !GuiProfiler->getShowGroupsTogether() );
break;
case KEY_F8:
NextScene();
break;
......@@ -346,12 +350,13 @@ int main()
L"<F4> to show the first page\n"
L"<F5> to flip between including the group overview\n"
L"<F6> to flip between ignoring and showing uncalled data\n"
L"<F7> to flip between showing 1 group per page or all together\n"
L"<F8> to change our scene\n"
L"<F9> to reset the \"grp runtime\" data\n"
L"<F10> to reset the scope 3 data\n"
L"<F11> to reset all data\n"
L"<f> to freeze/unfreeze the display\n"
, recti(10,10, 250, 120), true, true, 0, -1, true);
, recti(10,10, 250, 140), true, true, 0, -1, true);
staticText->setWordWrap(false);
/*
......
......@@ -37,6 +37,13 @@ namespace gui
/** \param includeOverview Include the group-overview page */
virtual void previousPage(bool includeOverview=true) = 0;
//! Try to show as many group-pages together as possible instead of showing at most one group per page.
/** \param groupsTogether When true show several groups on one page, when false show max. one group per page. Default is false. */
virtual void setShowGroupsTogether(bool groupsTogether) = 0;
//! Can several groups be displayed per page?
virtual bool getShowGroupsTogether() const = 0;
//! Don't display stats for data which never got called
virtual void setIgnoreUncalled(bool ignore) = 0;
......
......@@ -20,7 +20,7 @@ CGUIProfiler::CGUIProfiler(IGUIEnvironment* environment, IGUIElement* parent, s3
: IGUIProfiler(environment, parent, id, rectangle, profiler)
, Profiler(profiler)
, DisplayTable(0), CurrentGroupIdx(0), CurrentGroupPage(0), NumGroupPages(1), IgnoreUncalled(false)
, DrawBackground(false), Frozen(false), UnfreezeOnce(false)
, DrawBackground(false), Frozen(false), UnfreezeOnce(false), ShowGroupsTogether(false)
{
if ( !Profiler )
Profiler = &getProfiler();
......@@ -80,7 +80,7 @@ void CGUIProfiler::updateDisplay()
bool overview = CurrentGroupIdx == 0;
u32 rowIndex = 0;
const SProfileData& groupData = Profiler->getGroupData(CurrentGroupIdx);
if ( overview || !IgnoreUncalled || groupData.getCallsCounter() > 0 )
if ( !ShowGroupsTogether && (overview || !IgnoreUncalled || groupData.getCallsCounter() > 0) )
{
rowIndex = DisplayTable->addRow(rowIndex);
fillRow(rowIndex, groupData, overview, true);
......@@ -104,7 +104,6 @@ void CGUIProfiler::updateDisplay()
// show data for all elements in current group
else
{
for ( u32 i=0; i < Profiler->getProfileDataCount(); ++i )
{
const SProfileData& data = Profiler->getProfileDataByIndex(i);
......@@ -117,6 +116,24 @@ void CGUIProfiler::updateDisplay()
}
}
}
// Show the rest of the groups
if (ShowGroupsTogether)
{
for ( u32 groupIdx = CurrentGroupIdx+1; groupIdx < Profiler->getGroupCount(); ++groupIdx)
{
for ( u32 i=0; i < Profiler->getProfileDataCount(); ++i )
{
const SProfileData& data = Profiler->getProfileDataByIndex(i);
if ( data.getGroupIndex() == groupIdx
&& (!IgnoreUncalled || data.getCallsCounter() > 0) )
{
rowIndex = DisplayTable->addRow(rowIndex);
fillRow(rowIndex, data, false, false);
++rowIndex;
}
}
}
}
}
// IGUITable has no page-wise scrolling yet. The following code can be replaced when we add that.
......@@ -220,6 +237,16 @@ void CGUIProfiler::previousPage(bool includeOverview)
}
}
void CGUIProfiler::setShowGroupsTogether(bool groupsTogether)
{
ShowGroupsTogether = groupsTogether;
}
bool CGUIProfiler::getShowGroupsTogether() const
{
return ShowGroupsTogether;
}
void CGUIProfiler::firstPage(bool includeOverview)
{
UnfreezeOnce = true;
......
......@@ -36,6 +36,13 @@ namespace gui
//! Show previous page of profile data
virtual void previousPage(bool includeOverview) _IRR_OVERRIDE_;
//! Try to show as many group-pages together as possible instead of showing at most one group per page.
/** \param groupsTogether When true show several groups on one page, when false show max. one group per page. Default is false. */
virtual void setShowGroupsTogether(bool groupsTogether) _IRR_OVERRIDE_;
//! Can several groups be displayed per page?
virtual bool getShowGroupsTogether() const _IRR_OVERRIDE_;
//! Don't display stats for data which never got called
/** Default is false */
virtual void setIgnoreUncalled(bool ignore) _IRR_OVERRIDE_;
......@@ -89,6 +96,7 @@ namespace gui
bool DrawBackground;
bool Frozen;
bool UnfreezeOnce;
bool ShowGroupsTogether;
};
} // end namespace gui
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment