当前位置: 首页>>代码示例>>C++>>正文


C++ TimeStat::Get方法代码示例

本文整理汇总了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_);
//  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:35,代码来源:FeedItemI.cpp

示例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;
	}
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:53,代码来源:FeedItemI.cpp

示例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>();
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:41,代码来源:FeedFocusInvertI.cpp


注:本文中的TimeStat::Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。