summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp21
-rw-r--r--src/effectmanager.cpp2
-rw-r--r--src/gui/widgets/tabs/socialplayerstab.h2
-rw-r--r--src/net/eathena/beinghandler.cpp6
-rw-r--r--src/resources/openglimagehelper.cpp2
-rw-r--r--src/resources/resourcemanager.cpp9
-rw-r--r--src/resources/spritedef.cpp5
-rw-r--r--src/utils/perfomance.cpp6
-rw-r--r--src/utils/physfsrwops.cpp7
-rw-r--r--src/utils/xml.cpp2
10 files changed, 58 insertions, 4 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 39f241312..70a71d960 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -555,6 +555,8 @@ void Being::takeDamage(Being *const attacker, const int amount,
if (!userPalette || !attacker)
return;
+ BLOCK_START("Being::takeDamage1")
+
Font *font = nullptr;
// TRANSLATORS: hit or miss message in attacks
const std::string damage = amount ? toString(amount) : type == FLEE ?
@@ -646,6 +648,8 @@ void Being::takeDamage(Being *const attacker, const int amount,
particleEngine->addTextSplashEffect(damage,
getPixelX(), getPixelY() - 16, color, font, true);
}
+ BLOCK_END("Being::takeDamage1")
+ BLOCK_START("Being::takeDamage2")
if (type != SKILL)
attacker->updateHit(amount);
@@ -704,6 +708,7 @@ void Being::takeDamage(Being *const attacker, const int amount,
effectManager->trigger(hitEffectId, this);
}
}
+ BLOCK_END("Being::takeDamage2")
}
int Being::getHitEffect(const Being *const attacker,
@@ -712,6 +717,7 @@ int Being::getHitEffect(const Being *const attacker,
if (!effectManager)
return 0;
+ BLOCK_START("Being::getHitEffect")
// Init the particle effect path based on current
// weapon or default.
int hitEffectId = 0;
@@ -766,6 +772,7 @@ int Being::getHitEffect(const Being *const attacker,
// move skills effects to +100000 in effects list
hitEffectId = attackId + 100000;
}
+ BLOCK_END("Being::getHitEffect")
return hitEffectId;
}
@@ -785,6 +792,8 @@ void Being::handleAttack(Being *const victim, const int damage,
if (!victim || !mInfo)
return;
+ BLOCK_START("Being::handleAttack")
+
if (this != localPlayer)
setAction(BeingAction::ATTACK, attackId);
@@ -833,6 +842,7 @@ void Being::handleAttack(Being *const victim, const int damage,
playSfx(mInfo->getSound((damage > 0) ?
ItemSoundEvent::HIT : ItemSoundEvent::MISS), victim, true, mX, mY);
}
+ BLOCK_END("Being::handleAttack")
}
void Being::handleSkill(Being *const victim, const int damage,
@@ -1065,10 +1075,15 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const
if (!victim || particle.empty() || !particleEngine)
return;
+ BLOCK_START("Being::fireMissile")
+
Particle *const target = particleEngine->createChild();
if (!target)
+ {
+ BLOCK_END("Being::fireMissile")
return;
+ }
Particle *const missile = target->addEffect(
particle, getPixelX(), getPixelY());
@@ -1083,6 +1098,7 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const
missile->setDieDistance(8);
missile->setLifetime(900);
}
+ BLOCK_END("Being::fireMissile")
}
std::string Being::getSitAction() const
@@ -3070,6 +3086,7 @@ void Being::updatePercentHP()
{
if (!mMaxHP)
return;
+ BLOCK_START("Being::updatePercentHP")
if (mHP)
{
const unsigned num = mHP * 100 / mMaxHP;
@@ -3080,6 +3097,7 @@ void Being::updatePercentHP()
setAction(mAction, 0);
}
}
+ BLOCK_END("Being::updatePercentHP")
}
uint8_t Being::genderToInt(const Gender::Type sex)
@@ -3345,6 +3363,8 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const
void Being::playSfx(const SoundInfo &sound, Being *const being,
const bool main, const int x, const int y) const
{
+ BLOCK_START("Being::playSfx")
+
if (being)
{
// here need add timer and delay sound
@@ -3372,6 +3392,7 @@ void Being::playSfx(const SoundInfo &sound, Being *const being,
{
soundManager.playSfx(sound.sound, x, y);
}
+ BLOCK_END("Being::playSfx")
}
void Being::setLook(const uint8_t look)
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index 8cc987e6e..d72824822 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -86,6 +86,7 @@ bool EffectManager::trigger(const int id, Being *const being,
if (!being || !particleEngine)
return false;
+ BLOCK_START("EffectManager::trigger")
bool rValue = false;
FOR_EACH (std::vector<EffectDescription>::const_iterator, i, mEffects)
{
@@ -106,6 +107,7 @@ bool EffectManager::trigger(const int id, Being *const being,
break;
}
}
+ BLOCK_END("EffectManager::trigger")
return rValue;
}
diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h
index 56580300b..0a642b3fe 100644
--- a/src/gui/widgets/tabs/socialplayerstab.h
+++ b/src/gui/widgets/tabs/socialplayerstab.h
@@ -73,6 +73,7 @@ class SocialPlayersTab final : public SocialTab
if (!actorManager)
return;
+ BLOCK_START("SocialPlayersTab::updateAvatar")
Avatar *const avatar = findAvatarbyName(name);
if (!avatar)
return;
@@ -96,6 +97,7 @@ class SocialPlayersTab final : public SocialTab
avatar->setIp(being->getIp());
avatar->setPoison(being->getPoison());
}
+ BLOCK_END("SocialPlayersTab::updateAvatar")
}
void resetDamage(const std::string &name) override final
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 0e36163f2..2e349808c 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -1527,10 +1527,10 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg)
void BeingHandler::processBeingAction2(Net::MessageIn &msg)
{
- BLOCK_START("BeingHandler::processBeingAction")
+ BLOCK_START("BeingHandler::processBeingAction2")
if (!actorManager)
{
- BLOCK_END("BeingHandler::processBeingAction")
+ BLOCK_END("BeingHandler::processBeingAction2")
return;
}
@@ -1617,7 +1617,7 @@ void BeingHandler::processBeingAction2(Net::MessageIn &msg)
logger->log("type: " + toString(type));
break;
}
- BLOCK_END("BeingHandler::processBeingAction")
+ BLOCK_END("BeingHandler::processBeingAction2")
}
void BeingHandler::processMonsterHp(Net::MessageIn &msg)
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 295ad3e69..e4a1a56b8 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -231,6 +231,7 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
if (!tmpImage)
return nullptr;
+ BLOCK_START("OpenGLImageHelper::glLoad")
// Flush current error flag.
graphicsManager.getLastError();
@@ -313,6 +314,7 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
// return nullptr;
}
+ BLOCK_END("OpenGLImageHelper::glLoad")
return new Image(texture, width, height, realWidth, realHeight);
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 9fd445ffc..5ae057748 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -544,13 +544,20 @@ struct DyedImageLoader final
std::string path;
static Resource *load(const void *const v)
{
+ BLOCK_START("DyedImageLoader::load")
if (!v)
+ {
+ BLOCK_END("DyedImageLoader::load")
return nullptr;
+ }
const DyedImageLoader *const rl
= static_cast<const DyedImageLoader *const>(v);
if (!rl->manager)
+ {
+ BLOCK_END("DyedImageLoader::load")
return nullptr;
+ }
std::string path1 = rl->path;
const size_t p = path1.find('|');
@@ -564,11 +571,13 @@ struct DyedImageLoader final
if (!rw)
{
delete d;
+ BLOCK_END("DyedImageLoader::load")
return nullptr;
}
Resource *const res = d ? imageHelper->load(rw, *d)
: imageHelper->load(rw);
delete d;
+ BLOCK_END("DyedImageLoader::load")
return res;
}
};
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 528151537..267dfaab0 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -81,6 +81,7 @@ unsigned SpriteDef::findNumber(const unsigned num) const
SpriteDef *SpriteDef::load(const std::string &animationFile,
const int variant, const bool prot)
{
+ BLOCK_START("SpriteDef::load")
const size_t pos = animationFile.find('|');
std::string palettes;
if (pos != std::string::npos)
@@ -95,6 +96,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile,
const std::string errorFile = paths.getStringValue("sprites").append(
paths.getStringValue("spriteErrorFile"));
+ BLOCK_END("SpriteDef::load")
if (animationFile != errorFile)
return load(errorFile, 0, prot);
else
@@ -112,6 +114,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile,
def->incRef();
def->setProtected(true);
}
+ BLOCK_END("SpriteDef::load")
return def;
}
@@ -177,6 +180,7 @@ void SpriteDef::substituteActions()
void SpriteDef::loadSprite(const XmlNodePtr spriteNode, const int variant,
const std::string &palettes)
{
+ BLOCK_START("SpriteDef::loadSprite")
// Get the variant
const int variantCount = XML::getProperty(spriteNode, "variants", 0);
int variant_offset = 0;
@@ -196,6 +200,7 @@ void SpriteDef::loadSprite(const XmlNodePtr spriteNode, const int variant,
else if (xmlNameEqual(node, "include"))
includeSprite(node, variant);
}
+ BLOCK_END("SpriteDef::loadSprite")
}
void SpriteDef::loadImageSet(const XmlNodePtr node,
diff --git a/src/utils/perfomance.cpp b/src/utils/perfomance.cpp
index d7ed52d4b..5858d43e6 100644
--- a/src/utils/perfomance.cpp
+++ b/src/utils/perfomance.cpp
@@ -25,6 +25,9 @@
#include "utils/perfomance.h"
#include "configuration.h"
+#include "game.h"
+
+#include "utils/timer.h"
#include <algorithm>
#include <cstdarg>
@@ -87,7 +90,8 @@ namespace Perfomance
void flush()
{
- file << temp;
+ if (fps < 40)
+ file << temp;
temp.clear();
// file.flush();
}
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp
index b4afa5e9e..25e6cfa8d 100644
--- a/src/utils/physfsrwops.cpp
+++ b/src/utils/physfsrwops.cpp
@@ -233,6 +233,7 @@ static bool checkFilePath(const char *const fname)
SDL_RWops *PHYSFSRWOPS_openRead(const char *const fname)
{
+ BLOCK_START("PHYSFSRWOPS_openRead")
#ifdef __APPLE__
if (!checkFilePath(fname))
return nullptr;
@@ -241,7 +242,13 @@ SDL_RWops *PHYSFSRWOPS_openRead(const char *const fname)
if (Fuzzer::conditionTerminate(fname))
return nullptr;
#endif
+#ifdef USE_PROFILER
+ SDL_RWops *const ret = create_rwops(PhysFs::openRead(fname));
+ BLOCK_END("PHYSFSRWOPS_openRead")
+ return ret;
+#else
return create_rwops(PhysFs::openRead(fname));
+#endif
} /* PHYSFSRWOPS_openRead */
SDL_RWops *PHYSFSRWOPS_openWrite(const char *const fname)
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 3ef99758e..176bc81ac 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -85,6 +85,7 @@ namespace XML
if (Fuzzer::conditionTerminate(filename.c_str()))
return;
#endif
+ BLOCK_START("XML::Document::Document")
int size = 0;
char *data = nullptr;
valid = true;
@@ -129,6 +130,7 @@ namespace XML
logger->log("Error loading %s", filename.c_str());
}
mIsValid = valid;
+ BLOCK_END("XML::Document::Document")
}
Document::Document(const char *const data, const int size) :