ITPub博客

首页 > 应用开发 > IT综合 > UsingomniORBinterceptorstorecordtimecostedinCORBAcalls(转)

UsingomniORBinterceptorstorecordtimecostedinCORBAcalls(转)

原创 IT综合 作者:post0 时间:2007-08-24 17:06:00 0 删除 编辑
UsingomniORBinterceptorstorecordtimecostedinCORBAcalls(转)[@more@]

  struct CallInfo

  {

  std::string opname;

  DWORD time;

  };

  std::map > calls;

  static CORBA::Boolean sendReqFunc(omni::omniInterceptors::clientSendRequest_T::info_T& info)

  {

  if(!info.response_expected){

  CallInfo c;

  c.opname = info.opname;

  c.time = ::GetTickCount();

  calls[GetCurrentThreadId()].push(c);

  }

  return TRUE;

  }

  static CORBA::Boolean receiveRepFunc(omni::omniInterceptors::clientReceiveReply_T::info_T& info)

  {

  DWORD t = ::GetTickCount();

  if(!calls[GetCurrentThreadId()].empty()){

  const CallInfo& c = calls[GetCurrentThreadId()].top();

  TRACE("==== %s , %d ms ==== ", c.opname.c_str(), t - c.time);

  calls[GetCurrentThreadId()].pop();

  }

  return TRUE;

  }

  And here is how to register the inteceptors after the ORB_init call:

  omni::omniInterceptors* interceptors = omniORB::getInterceptors();

  interceptors->clientSendRequest.add(sendReqFunc);

  interceptors->clientReceiveReply.add(receiveRepFunc)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8225414/viewspace-965580/,如需转载,请注明出处,否则将追究法律责任。

下一篇: ASPDotNet(转)
请登录后发表评论 登录
全部评论
  • 博文量
    2031
  • 访问量
    7924665