本文整理汇总了C++中World::GetCommands方法的典型用法代码示例。如果您正苦于以下问题:C++ World::GetCommands方法的具体用法?C++ World::GetCommands怎么用?C++ World::GetCommands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World::GetCommands方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
BOOL CMDSstatus::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
using std::setw;
World* world = World::GetPtr();
std::stringstream st;
unsigned long long int updates = 0;
unsigned long long int tu = 0; //total update time
unsigned long long int ts = 0; //total sleep time.
unsigned long long int commands = 0; //commands executed.
unsigned long long int commandTime = 0; //average command time.
struct rusage usage;
st << std::setprecision(3);
getrusage(RUSAGE_SELF, &usage);
//cpu usage
st << "userspace cpu usage: " << TimevalToString(&(usage.ru_utime)) << "." << std::endl;
st << "Kernel cpu usage: " << TimevalToString(&(usage.ru_stime)) << "." << std::endl;
//memory:
st << "Max rss: " << usage.ru_maxrss << "KB (" << (usage.ru_maxrss/1024.0F) << "mb)." << std::endl;
st << Repeat("-", 80) << std::endl;
//timing information
updates = world->GetUpdates();
tu = world->GetUpdateTime();
ts = world->GetSleepTime();
st << "Total updates: " << updates << std::endl;
st << "Average work time: " << ((double)tu/(double)updates) / 1000.0F << "MS." << std::endl;
st << "Average sleep time: " << ((double)ts / (double)updates) / 1000.0F << "MS." << std::endl;
st << "Spent ~" << ((double)tu / (double)ts) * 100.0F << "% time working." << std::endl;
st << CalloutManager::GetInstance()->Profile() << std::endl;
commands = world->GetCommands();
commandTime = world->GetCommandTime();
st << "Total commands executed (that succeeded): " << commands << std::endl;
st << "Average command time: " << ((double)commandTime/commands)/1000 << " MS." << std::endl;
mobile->Message(MSG_INFO, st.str());
return true;
}