summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-26 01:14:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-26 01:14:22 +0300
commitb328b78653133f05107eadba31572874e4c35e95 (patch)
treef426ca2b61fecab7dd115f2b12083e94502ae989 /src
parenta57ee0d8a7c729ea2887c71b5262dd0a6cb56a71 (diff)
downloadmanaplus-b328b78653133f05107eadba31572874e4c35e95.tar.gz
manaplus-b328b78653133f05107eadba31572874e4c35e95.tar.bz2
manaplus-b328b78653133f05107eadba31572874e4c35e95.tar.xz
manaplus-b328b78653133f05107eadba31572874e4c35e95.zip
Add LPS counter to debug window (Logic per second).
Normally must be always 100 LPS.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp5
-rw-r--r--src/client.h1
-rw-r--r--src/gui/debugwindow.cpp19
-rw-r--r--src/gui/debugwindow.h1
4 files changed, 18 insertions, 8 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 56d7c2d25..b51d8cdac 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -164,7 +164,9 @@ void ErrorListener::action(const gcn::ActionEvent &)
volatile int tick_time; /**< Tick counter */
volatile int fps = 0; /**< Frames counted in the last second */
+volatile int lps = 0; /**< Logic processed per second */
volatile int frame_count = 0; /**< Counts the frames during one second */
+volatile int logic_count = 0; /**< Counts the logic during one second */
volatile int cur_time;
volatile bool runCounters;
bool isSafeMode = false;
@@ -197,7 +199,9 @@ Uint32 nextTick(Uint32 interval, void *param A_UNUSED)
Uint32 nextSecond(Uint32 interval, void *param A_UNUSED)
{
fps = frame_count;
+ lps = logic_count;
frame_count = 0;
+ logic_count = 0;
return interval;
}
@@ -926,6 +930,7 @@ int Client::gameExec()
++lastTickTime;
k ++;
}
+ logic_count += k;
// This is done because at some point tick_time will wrap.
lastTickTime = tick_time;
diff --git a/src/client.h b/src/client.h
index 000f8749e..9e3996526 100644
--- a/src/client.h
+++ b/src/client.h
@@ -53,6 +53,7 @@ static const int MILLISECONDS_IN_A_TICK = 10;
static const short DEFAULT_PORT = 6901;
extern volatile int fps;
+extern volatile int lps;
extern volatile int tick_time;
extern volatile int cur_time;
extern bool isSafeMode;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index fa01b5aa8..aa551df24 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -176,19 +176,21 @@ MapDebugTab::MapDebugTab() :
#endif
mFPSLabel = new Label(strprintf(_("%d FPS"), 0));
+ mLPSLabel = new Label(strprintf(_("%d LPS"), 0));
place(0, 0, mFPSLabel, 2);
- place(0, 1, mMusicFileLabel, 2);
- place(0, 2, mMapLabel, 2);
- place(0, 3, mMinimapLabel, 2);
- place(0, 4, mXYLabel, 2);
- place(0, 5, mTileMouseLabel, 2);
- place(0, 6, mParticleCountLabel, 2);
- place(0, 7, mMapActorCountLabel, 2);
+ place(0, 1, mLPSLabel, 2);
+ place(0, 2, mMusicFileLabel, 2);
+ place(0, 3, mMapLabel, 2);
+ place(0, 4, mMinimapLabel, 2);
+ place(0, 5, mXYLabel, 2);
+ place(0, 6, mTileMouseLabel, 2);
+ place(0, 7, mParticleCountLabel, 2);
+ place(0, 8, mMapActorCountLabel, 2);
#ifdef USE_OPENGL
#ifdef DEBUG_OPENGL_LEAKS
mTexturesLabel = new Label(strprintf("%s %s", _("Textures count:"), "?"));
- place(0, 8, mTexturesLabel, 2);
+ place(0, 9, mTexturesLabel, 2);
#endif
#endif
place.getCell().matchColWidth(0, 0);
@@ -260,6 +262,7 @@ void MapDebugTab::logic()
mParticleCountLabel->adjustSize();
mFPSLabel->setCaption(strprintf(mFPSText.c_str(), fps));
+ mLPSLabel->setCaption(strprintf(_("%d LPS"), lps));
}
TargetDebugTab::TargetDebugTab()
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 8be6f1220..dfbaa82be 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -66,6 +66,7 @@ class MapDebugTab : public DebugTab
Label *mTexturesLabel;
int mUpdateTime;
Label *mFPSLabel;
+ Label *mLPSLabel;
std::string mFPSText;
};