本文整理汇总了C++中TimeStat::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeStat::Get方法的具体用法?C++ TimeStat::Get怎么用?C++ TimeStat::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeStat
的用法示例。
在下文中一共展示了TimeStat::Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_pair
pair<float,float> FeedItemManagerI::GetFeedContentDict(GetRequest & req,FeedContentDict & fdict){
set<long> & fidset = req.GetShowedFids();;
vector<long> fids(fidset.begin(),fidset.end());
TimeStat ts;
try {
fdict = FeedContentAdapter::instance().getFeedDict(fids);
} catch (Ice::Exception& e) {
MCE_WARN("FeedItemManagerI::GetFeedContentDict. get memcached fail. uid:" << req.uid_ << " err:" << e);
}
int memcnt = fdict.size();
float memcost = ts.Get();
bool load_db = false;
if(fdict.size() < fids.size()){
CheckLoad(req.uid_,fids,fdict);
load_db = true;
}
int dbcnt = fdict.size() - memcnt;
float dbcost = ts.Get();
MCE_INFO("FeedItemManagerI::GetFeedContentDict. uid:" << req.uid_
<< " request:" << fids.size()
<< " load_db:" << load_db
<< " memcnt:" << memcnt << " dbcnt:" << dbcnt
<< " total:" << fdict.size()
<< " memcost:" << memcost << " dbcost:" << dbcost
);
return make_pair(memcost,dbcost);
// MCE_INFO("show fids:" << PrintHelper::Print(fids));
// if(fids.size() > 100){
// MCE_WARN("@@@@@@@@@@ TOOLARGE. uid:" << req.uid_);
// PrintHelper::Print(req.item3d_);
// }
}
示例2: GetFeedDataImpl
FeedDataResPtr FeedItemManagerI::GetFeedDataImpl(int uid, const IntSeq& types,
bool stype, int begin, int limit, bool hot) {
FeedDataResPtr res = new FeedDataRes;
try{
TimeStat ts; GetCost tc;
GetRequest req(uid,types,stype,begin,limit,hot);
if(!req.CheckArgs()) return res;
UserInfoPtr uinfo = LocateUserInfo(uid);
if(!uinfo) return res;
tc.loadtime = ts.Get();
uinfo->GetFeeds(req);
tc.mergetime = ts.Get();
FeedContentDict fdict;
GetFeedContentDict(req,fdict);
// tc.contenttime = ts.Get();
//
FeedBuilder builder(uid,fdict,req.showed_comment_map_,req.sort_);
res = builder.BuildFeedData(req);
// tc.buildtime = ts.Get();
//
uinfo->SetMaxRead(req.GetMaxFid());
uinfo->SetReadByIdsExactly(builder.GetNullFids());
// tc.othertime = ts.Get();
//
uinfo->UploadMaxRead();
// uinfo->RefreshPreMaxRead();
// uinfo->AddRefresh(req.GetNowTime(),req.GetMaxFid());
//
//
MCE_INFO("FeedItemManagerI::GetFeedDataImpl --> uid:" << uid << " begin:" << begin << " limit:" << limit
<< " types:" << types.size() << " bystype:" << stype << " hot:" << hot << " feedsize:" << uinfo->Size()
// << " res:" << builder.GetSucc()
<< tc.ToString()
<< " fdict:" << fdict.size()
<< " nullfids:" << PrintHelper::Print(builder.GetNullFids())
<< " types:" << PrintHelper::Print(types)
<< " mark_fids:" << PrintHelper::Print(req.GetMarkedFids())
);
return res;
} catch(Ice::Exception& e) {
MCE_WARN(" FeedItemManagerI::GetFeedDataImpl uid:" << uid
<<" error:" << e);
return res;
}
}
示例3: GetSources
MyUtil::IntSeq FeedFocusInvertI::GetSources(int target, const Ice::Current& ){
MCE_INFO("FeedFocusInvertI::GetSources. target:" << target << " begin" );
try{
TargetInfoPtr tinfo;
TimeStat ts;
set<int> sources;
bool in_mem = false;;
{
IceUtil::Mutex::Lock lock(mutex_);
tinfo = Find(target);
if(tinfo){
sources=(tinfo->GetSources());
in_mem = true;
}
}
if(in_mem){
MCE_INFO("FeedFocusInvertI::GetSources. target:" << target << " in mem:1" << " cost:" << ts.Get() << " source:" << PrintHelper::Print(sources) );
return vector<int>(sources.begin(),sources.end());
}
if( !GetDB(target, tinfo)){
MCE_WARN("FeedFocusInvertI::GetTargets --> call GetDB fail , target:" << target << " cost:" << ts.Get());
return vector<int>();
}
sources = tinfo->GetSources();
AddCache(target,tinfo);
MCE_INFO("FeedFocusInvertI::GetSources. target:" << target << " in mem:0" << " cost:" << ts.Get() << " source:" << PrintHelper::Print(sources) );
return vector<int>(sources.begin(),sources.end());
} catch (Ice::Exception& e) {
MCE_WARN(" FeedFocusInvertI::GetDB --> error:" << e << ",target = " << target);
} catch (std::exception& e) {
MCE_WARN(" FeedFocusInvertI::GetDB --> error:" << e.what() << ",target = " << target);
}
return vector<int>();
}