本文整理汇总了C++中SCOPED_PROFILE函数的典型用法代码示例。如果您正苦于以下问题:C++ SCOPED_PROFILE函数的具体用法?C++ SCOPED_PROFILE怎么用?C++ SCOPED_PROFILE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SCOPED_PROFILE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SCOPED_PROFILE
//-------------------------------------------------------------------------------------
void Entity::onLeaveTrapID(ENTITY_ID entityID, float range, int controllerID)
{
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
SCRIPT_OBJECT_CALL_ARGS3(this, const_cast<char*>("onLeaveTrapID"),
const_cast<char*>("kfi"), entityID, range, controllerID);
}
示例2: SCOPED_PROFILE
//-------------------------------------------------------------------------------------
bool Loginapp::initializeEnd()
{
PythonApp::initializeEnd();
// 添加一个timer, 每秒检查一些状态
mainProcessTimer_ = this->dispatcher().addTimer(1000000 / 50, this,
reinterpret_cast<void *>(TIMEOUT_TICK));
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
// 所有脚本都加载完毕
PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(),
const_cast<char*>("onLoginAppReady"),
const_cast<char*>(""));
if(pyResult != NULL)
Py_DECREF(pyResult);
else
SCRIPT_ERROR_CHECK();
pTelnetServer_ = new TelnetServer(&this->dispatcher(), &this->networkInterface());
pTelnetServer_->pScript(&this->getScript());
bool ret = pTelnetServer_->start(g_kbeSrvConfig.getLoginApp().telnet_passwd,
g_kbeSrvConfig.getLoginApp().telnet_deflayer,
g_kbeSrvConfig.getLoginApp().telnet_port);
Components::getSingleton().extraData4(pTelnetServer_->port());
return ret;
}
示例3: SCOPED_PROFILE
//-------------------------------------------------------------------------------------
void Proxy::onStreamComplete(int16 id, bool success)
{
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
SCRIPT_OBJECT_CALL_ARGS2(this, const_cast<char*>("onStreamComplete"),
const_cast<char*>("hO"), id, success ? Py_True : Py_False);
}
示例4: CLOSE_CHANNEL_INACTIVITIY_DETECTION
//-------------------------------------------------------------------------------------
bool Interfaces::initializeEnd()
{
PythonApp::initializeEnd();
mainProcessTimer_ = this->dispatcher().addTimer(1000000 / g_kbeSrvConfig.gameUpdateHertz(), this,
reinterpret_cast<void *>(TIMEOUT_TICK));
// 不做频道超时检查
CLOSE_CHANNEL_INACTIVITIY_DETECTION();
if (!initDB())
return false;
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
// 所有脚本都加载完毕
PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(),
const_cast<char*>("onInterfaceAppReady"),
const_cast<char*>(""));
if(pyResult != NULL)
Py_DECREF(pyResult);
else
SCRIPT_ERROR_CHECK();
pTelnetServer_ = new TelnetServer(&this->dispatcher(), &this->networkInterface());
pTelnetServer_->pScript(&this->getScript());
bool ret = pTelnetServer_->start(g_kbeSrvConfig.getInterfaces().telnet_passwd,
g_kbeSrvConfig.getInterfaces().telnet_deflayer,
g_kbeSrvConfig.getInterfaces().telnet_port);
Components::getSingleton().extraData4(pTelnetServer_->port());
return ret;
}
示例5: EntityMailbox
//-------------------------------------------------------------------------------------
void Proxy::onClientGetCell(Network::Channel* pChannel, COMPONENT_ID componentID)
{
// 回调给脚本,获得了cell
if(cellMailbox_ == NULL)
cellMailbox_ = new EntityMailbox(pScriptModule_, NULL, componentID, id_, MAILBOX_TYPE_CELL);
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onClientGetCell"));
}
示例6: SCOPED_PROFILE
//-------------------------------------------------------------------------------------
void Base::onDestroy(bool callScript)
{
if(callScript)
{
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onDestroy"));
}
if(this->hasDB())
{
onCellWriteToDBCompleted(0, -1);
}
eraseEntityLog();
}
示例7: KBE_ASSERT
//-------------------------------------------------------------------------------------
void Entity::onLoseWitness(Mercury::Channel* pChannel)
{
KBE_ASSERT(this->getClientMailbox() != NULL && this->hasWitness());
getClientMailbox()->addr(Mercury::Address::NONE);
Py_DECREF(getClientMailbox());
setClientMailbox(NULL);
pWitness_->detach(this);
Witness::ObjPool().reclaimObject(pWitness_);
pWitness_ = NULL;
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onLoseWitness"));
}
示例8: CreateAccountTask
//-------------------------------------------------------------------------------------
void Interfaces::reqCreateAccount(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
std::string registerName, accountName, password, datas;
COMPONENT_ID cid;
uint8 accountType = 0;
s >> cid >> registerName >> password >> accountType;
s.readBlob(datas);
if(accountType == (uint8)ACCOUNT_TYPE_MAIL)
{
}
REQCREATE_MAP::iterator iter = reqCreateAccount_requests_.find(registerName);
if(iter != reqCreateAccount_requests_.end())
{
return;
}
CreateAccountTask* pinfo = new CreateAccountTask();
pinfo->commitName = registerName;
pinfo->accountName = registerName;
pinfo->getDatas = "";
pinfo->password = password;
pinfo->postDatas = datas;
pinfo->retcode = SERVER_ERR_OP_FAILED;
pinfo->baseappID = cid;
pinfo->dbmgrID = pChannel->componentID();
pinfo->address = pChannel->addr();
pinfo->enable = true;
reqCreateAccount_requests_[pinfo->commitName] = pinfo;
// 把请求交由脚本处理
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(),
const_cast<char*>("onRequestCreateAccount"),
const_cast<char*>("ssy#"),
registerName.c_str(),
password.c_str(),
datas.c_str(), datas.length());
if(pyResult != NULL)
Py_DECREF(pyResult);
else
SCRIPT_ERROR_CHECK();
}
示例9: OrdersCharge
//-------------------------------------------------------------------------------------
void Interfaces::charge(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
OrdersCharge* pOrdersCharge = new OrdersCharge();
pOrdersCharge->timeout = timestamp() + uint64(g_kbeSrvConfig.interfaces_orders_timeout_ * stampsPerSecond());
pOrdersCharge->dbmgrID = pChannel->componentID();
pOrdersCharge->address = pChannel->addr();
s >> pOrdersCharge->baseappID;
s >> pOrdersCharge->ordersID;
s >> pOrdersCharge->dbid;
s.readBlob(pOrdersCharge->postDatas);
s >> pOrdersCharge->cbid;
INFO_MSG(fmt::format("Interfaces::charge: componentID={4}, chargeID={0}, dbid={1}, cbid={2}, datas={3}!\n",
pOrdersCharge->ordersID, pOrdersCharge->dbid, pOrdersCharge->cbid, pOrdersCharge->postDatas, pOrdersCharge->baseappID));
ORDERS::iterator iter = orders_.find(pOrdersCharge->ordersID);
if(iter != orders_.end())
{
ERROR_MSG(fmt::format("Interfaces::charge: chargeID={} is exist!\n", pOrdersCharge->ordersID));
delete pOrdersCharge;
return;
}
ChargeTask* pinfo = new ChargeTask();
pinfo->orders = *pOrdersCharge;
pinfo->pOrders = pOrdersCharge;
orders_[pOrdersCharge->ordersID].reset(pOrdersCharge);
// 把请求交由脚本处理
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(),
const_cast<char*>("onRequestCharge"),
const_cast<char*>("sKy#"),
pOrdersCharge->ordersID.c_str(),
pOrdersCharge->dbid,
pOrdersCharge->postDatas.c_str(), pOrdersCharge->postDatas.length());
if(pyResult != NULL)
Py_DECREF(pyResult);
else
SCRIPT_ERROR_CHECK();
}
示例10: WinMain
int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/ )
{
redirect_io_to_console();
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//::boost::unit_test::unit_test_main(init_unit_test_suite, 0, 0);
boost::shared_ptr<System> system(new System());
system->init();
boost::shared_ptr<EffectManager> effect_manager(new EffectManager(system->handle_manager()));
// Renderable* renderer = new SpringTest(system, effect_manager);
//Renderable* renderer = new M2Renderer(system, effect_manager);
Renderable *renderer = new MarchingCubes(system, effect_manager);
SCOPED_PROFILE("Loading");
try {
renderer->init();
} catch (std::exception& e) {
LOG_ERROR_LN("%s", e.what());
return 0;
}
Profiler::instance().print();
Serializer::instance().load("codename_ch.dat");
system->run();
system->close();
Serializer::instance().save("codename_ch.dat");
SAFE_DELETE(renderer);
effect_manager.reset();
system.reset();
Profiler::close();
StringIdTable::close();
LogMgr::close();
return 0;
}
示例11: LoginAccountTask
//-------------------------------------------------------------------------------------
void Interfaces::onAccountLogin(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
std::string loginName, accountName, password, datas;
COMPONENT_ID cid;
s >> cid >> loginName >> password;
s.readBlob(datas);
REQLOGIN_MAP::iterator iter = reqAccountLogin_requests_.find(loginName);
if(iter != reqAccountLogin_requests_.end())
{
return;
}
LoginAccountTask* pinfo = new LoginAccountTask();
pinfo->commitName = loginName;
pinfo->accountName = loginName;
pinfo->getDatas = "";
pinfo->password = password;
pinfo->postDatas = datas;
pinfo->retcode = SERVER_ERR_OP_FAILED;
pinfo->baseappID = cid;
pinfo->dbmgrID = pChannel->componentID();
pinfo->address = pChannel->addr();
pinfo->enable = true;
reqAccountLogin_requests_[pinfo->commitName] = pinfo;
// 把请求交由脚本处理
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(),
const_cast<char*>("onRequestAccountLogin"),
const_cast<char*>("ssy#"),
loginName.c_str(),
password.c_str(),
datas.c_str(), datas.length());
if(pyResult != NULL)
Py_DECREF(pyResult);
else
SCRIPT_ERROR_CHECK();
}
示例12: ERROR_MSG
//-------------------------------------------------------------------------------------
void Proxy::onClientDeath(void)
{
if(getClientMailbox() == NULL)
{
ERROR_MSG(boost::format("%1%::onClientDeath: %2%, channel is null!\n") %
this->getScriptName() % this->getID());
return;
}
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
DEBUG_MSG(boost::format("%1%::onClientDeath: %2%.\n") %
this->getScriptName() % this->getID());
Py_DECREF(getClientMailbox());
setClientMailbox(NULL);
addr(Mercury::Address::NONE);
entitiesEnabled_ = false;
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onClientDeath"));
}
示例13: ERROR_MSG
//-------------------------------------------------------------------------------------
void Proxy::onClientDeath(void)
{
if(clientMailbox() == NULL)
{
ERROR_MSG(fmt::format("{}::onClientDeath: {}, channel is null!\n",
this->scriptName(), this->id()));
return;
}
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
DEBUG_MSG(fmt::format("{}::onClientDeath: {}.\n",
this->scriptName(), this->id()));
Py_DECREF(clientMailbox());
clientMailbox(NULL);
addr(Network::Address::NONE);
entitiesEnabled_ = false;
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onClientDeath"));
}
示例14: setDirty
//-------------------------------------------------------------------------------------
void Base::onDestroy(bool callScript)
{
setDirty();
if(callScript)
{
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onDestroy"));
}
if(this->hasDB())
{
onCellWriteToDBCompleted(0, -1, -1);
}
eraseEntityLog();
// 按照当前的设计来说,有clientMailbox_必定是proxy
// 至于为何跑到base里来和python本身是C语言实现有关
if(clientMailbox_)
static_cast<Proxy*>(this)->kick();
}
示例15: AUTO_SCOPED_PROFILE
//-------------------------------------------------------------------------------------
bool Loginapp::_createAccount(Network::Channel* pChannel, std::string& accountName,
std::string& password, std::string& datas, ACCOUNT_TYPE type)
{
AUTO_SCOPED_PROFILE("createAccount");
ACCOUNT_TYPE oldType = type;
if(!g_kbeSrvConfig.getDBMgr().account_registration_enable)
{
WARNING_MSG(fmt::format("Loginapp::_createAccount({}): not available!\n", accountName));
std::string retdatas = "";
Network::Bundle* pBundle = Network::Bundle::createPoolObject();
(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_ACCOUNT_REGISTER_NOT_AVAILABLE;
(*pBundle) << retcode;
(*pBundle).appendBlob(retdatas);
pChannel->send(pBundle);
return false;
}
accountName = KBEngine::strutil::kbe_trim(accountName);
password = KBEngine::strutil::kbe_trim(password);
if(accountName.size() > ACCOUNT_NAME_MAX_LENGTH)
{
ERROR_MSG(fmt::format("Loginapp::_createAccount: accountName too big, size={}, limit={}.\n",
accountName.size(), ACCOUNT_NAME_MAX_LENGTH));
return false;
}
if(password.size() > ACCOUNT_PASSWD_MAX_LENGTH)
{
ERROR_MSG(fmt::format("Loginapp::_createAccount: password too big, size={}, limit={}.\n",
password.size(), ACCOUNT_PASSWD_MAX_LENGTH));
return false;
}
if(datas.size() > ACCOUNT_DATA_MAX_LENGTH)
{
ERROR_MSG(fmt::format("Loginapp::_createAccount: bindatas too big, size={}, limit={}.\n",
datas.size(), ACCOUNT_DATA_MAX_LENGTH));
return false;
}
std::string retdatas = "";
if(shuttingdown_ != SHUTDOWN_STATE_STOP)
{
WARNING_MSG(fmt::format("Loginapp::_createAccount: shutting down, create {} failed!\n", accountName));
Network::Bundle* pBundle = Network::Bundle::createPoolObject();
(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_IN_SHUTTINGDOWN;
(*pBundle) << retcode;
(*pBundle).appendBlob(retdatas);
pChannel->send(pBundle);
return false;
}
PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.find(const_cast<std::string&>(accountName));
if(ptinfos != NULL)
{
WARNING_MSG(fmt::format("Loginapp::_createAccount: pendingCreateMgr has {}, request create failed!\n",
accountName));
Network::Bundle* pBundle = Network::Bundle::createPoolObject();
(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_BUSY;
(*pBundle) << retcode;
(*pBundle).appendBlob(retdatas);
pChannel->send(pBundle);
return false;
}
{
// 把请求交由脚本处理
SERVER_ERROR_CODE retcode = SERVER_SUCCESS;
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
PyObject* pyResult = PyObject_CallMethod(getEntryScript().get(),
const_cast<char*>("onRequestCreateAccount"),
const_cast<char*>("ssy#"),
accountName.c_str(),
password.c_str(),
datas.c_str(), datas.length());
if(pyResult != NULL)
{
if(PySequence_Check(pyResult) && PySequence_Size(pyResult) == 4)
{
char* sname;
char* spassword;
char *extraDatas;
Py_ssize_t extraDatas_size = 0;
if(PyArg_ParseTuple(pyResult, "H|s|s|y#", &retcode, &sname, &spassword, &extraDatas, &extraDatas_size) == -1)
//.........这里部分代码省略.........