Add log test command #logtest

This commit is contained in:
Akkadius 2015-01-10 23:25:50 -06:00
parent b1fbcc51e0
commit 2159a56b17
2 changed files with 14 additions and 1 deletions

View File

@ -36,6 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <ctime>
#ifdef _WINDOWS #ifdef _WINDOWS
#define strcasecmp _stricmp #define strcasecmp _stricmp
@ -428,7 +429,8 @@ int command_init(void) {
command_add("open_shop", nullptr, 100, command_merchantopenshop) || command_add("open_shop", nullptr, 100, command_merchantopenshop) ||
command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) || command_add("merchant_close_shop", "Closes a merchant shop", 100, command_merchantcloseshop) ||
command_add("close_shop", nullptr, 100, command_merchantcloseshop) || command_add("close_shop", nullptr, 100, command_merchantcloseshop) ||
command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) command_add("shownumhits", "Shows buffs numhits for yourself.", 0, command_shownumhits) ||
command_add("logtest", "Performs log performance testing.", 250, command_logtest)
) )
{ {
command_deinit(); command_deinit();
@ -10665,3 +10667,13 @@ void command_shownumhits(Client *c, const Seperator *sep)
c->ShowNumHits(); c->ShowNumHits();
return; return;
} }
void command_logtest(Client *c, const Seperator *sep){
clock_t t = std::clock(); /* Function timer start */
if (sep->IsNumber(1)){
uint32 i = 0;
for (i = 0; i < atoi(sep->arg[1]); i++){
logger.LogDebug(EQEmuLogSys::General, "[%u] Test... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
}
}
}

View File

@ -326,6 +326,7 @@ void command_npctype_cache(Client *c, const Seperator *sep);
void command_merchantopenshop(Client *c, const Seperator *sep); void command_merchantopenshop(Client *c, const Seperator *sep);
void command_merchantcloseshop(Client *c, const Seperator *sep); void command_merchantcloseshop(Client *c, const Seperator *sep);
void command_shownumhits(Client *c, const Seperator *sep); void command_shownumhits(Client *c, const Seperator *sep);
void command_logtest(Client *c, const Seperator *sep);
#ifdef EQPROFILE #ifdef EQPROFILE
void command_profiledump(Client *c, const Seperator *sep); void command_profiledump(Client *c, const Seperator *sep);