• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ utils::StopWatch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中utils::StopWatch的典型用法代码示例。如果您正苦于以下问题:C++ StopWatch类的具体用法?C++ StopWatch怎么用?C++ StopWatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了StopWatch类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: get_digest_data

/// Retrieve user's digest data as JSON object. Caller is responsible for deleting.
HTTPCode HSSConnection::get_digest_data(const std::string& private_user_identity,
                                        const std::string& public_user_identity,
                                        Json::Value*& digest_data,
                                        SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_DIGEST, 0);
  event.add_var_param(private_user_identity);
  event.add_var_param(public_user_identity);
  SAS::report_event(event);

  std::string path = "/impi/" +
                     Utils::url_escape(private_user_identity) +
                     "/digest";
  if (!public_user_identity.empty())
  {
    path += "?public_id=" + Utils::url_escape(public_user_identity);
  }

  HTTPCode rc = get_json_object(path, digest_data, trail);

  unsigned long latency_us = 0;
  if (stopWatch.read(latency_us))
  {
    _latency_stat.accumulate(latency_us);
    _digest_latency_stat.accumulate(latency_us);
  }

  return rc;
}
开发者ID:oldurecu,项目名称:sprout,代码行数:33,代码来源:hssconnection.cpp


示例2: get_registration_data

HTTPCode HSSConnection::get_registration_data(const std::string& public_user_identity,
                                              std::string& regstate,
                                              std::map<std::string, Ifcs >& ifcs_map,
                                              std::vector<std::string>& associated_uris,
                                              std::deque<std::string>& ccfs,
                                              std::deque<std::string>& ecfs,
                                              SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_GET_REG, 0);
  event.add_var_param(public_user_identity);
  SAS::report_event(event);

  std::string path = "/impu/" + Utils::url_escape(public_user_identity) + "/reg-data";

  LOG_DEBUG("Making Homestead request for %s", path.c_str());
  rapidxml::xml_document<>* root_underlying_ptr = NULL;
  HTTPCode http_code = get_xml_object(path, root_underlying_ptr, trail);

  // Needs to be a shared pointer - multiple Ifcs objects will need a reference
  // to it, so we want to delete the underlying document when they all go out
  // of scope.
  std::shared_ptr<rapidxml::xml_document<> > root (root_underlying_ptr);
  unsigned long latency_us = 0;

  // Only accumulate the latency if we haven't already applied a
  // penalty
  if ((http_code != HTTP_SERVER_UNAVAILABLE) &&
      (http_code != HTTP_GATEWAY_TIMEOUT)    &&
      (stopWatch.read(latency_us)))
  {
    _latency_stat.accumulate(latency_us);
    _subscription_latency_stat.accumulate(latency_us);
  }

  if (http_code != HTTP_OK)
  {
    // If get_xml_object has returned a HTTP error code, we have either not found
    // the subscriber on the HSS or been unable to communicate with
    // the HSS successfully. In either case we should fail.
    LOG_ERROR("Could not get subscriber data from HSS");
    return http_code;
  }

  // Return whether the XML was successfully decoded. The XML can be decoded and
  // not return any IFCs (when the subscriber isn't registered), so a successful
  // response shouldn't be taken as a guarantee of IFCs.
  std::vector<std::string> unused_aliases;
  return decode_homestead_xml(public_user_identity,
                              root,
                              regstate,
                              ifcs_map,
                              associated_uris,
                              unused_aliases,
                              ccfs,
                              ecfs,
                              true) ? HTTP_OK : HTTP_SERVER_ERROR;
}
开发者ID:att-innovate,项目名称:sprout,代码行数:60,代码来源:hssconnection.cpp


示例3: get_auth_vector

/// Get an Authentication Vector as JSON object. Caller is responsible for deleting.
HTTPCode HSSConnection::get_auth_vector(const std::string& private_user_identity,
                                        const std::string& public_user_identity,
                                        const std::string& auth_type,
                                        const std::string& autn,
                                        Json::Value*& av,
                                        SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_VECTOR, 0);
  event.add_var_param(private_user_identity);
  event.add_var_param(public_user_identity);
  event.add_var_param(auth_type);
  SAS::report_event(event);

  std::string path = "/impi/" +
                     Utils::url_escape(private_user_identity) +
                     "/av";

  if (!auth_type.empty())
  {
    path += "/" + auth_type;
  }

  if (!public_user_identity.empty())
  {
    path += "?impu=" + Utils::url_escape(public_user_identity);
  }

  if (!autn.empty())
  {
    path += public_user_identity.empty() ? "?" : "&";
    path += "autn=" + Utils::url_escape(autn);
  }

  HTTPCode rc = get_json_object(path, av, trail);

  unsigned long latency_us = 0;

  // Only accumulate the latency if we haven't already applied a
  // penalty
  if ((rc != HTTP_SERVER_UNAVAILABLE) &&
      (rc != HTTP_GATEWAY_TIMEOUT)    &&
      (stopWatch.read(latency_us)))
  {
    _latency_stat.accumulate(latency_us);
    _digest_latency_stat.accumulate(latency_us);
  }

  if (av == NULL)
  {
    LOG_ERROR("Failed to get Authentication Vector for %s",
              private_user_identity.c_str());
  }

  return rc;
}
开发者ID:att-innovate,项目名称:sprout,代码行数:59,代码来源:hssconnection.cpp


示例4: update_registration_state

HTTPCode HSSConnection::update_registration_state(const std::string& public_user_identity,
                                                  const std::string& private_user_identity,
                                                  const std::string& type,
                                                  std::string& regstate,
                                                  std::map<std::string, Ifcs >& ifcs_map,
                                                  std::vector<std::string>& associated_uris,
                                                  std::deque<std::string>& ccfs,
                                                  std::deque<std::string>& ecfs,
                                                  SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_CHECK_STATE, 0);
  event.add_var_param(public_user_identity);
  event.add_var_param(private_user_identity);
  event.add_var_param(type);
  SAS::report_event(event);

  std::string path = "/impu/" + Utils::url_escape(public_user_identity) + "/reg-data";
  if (!private_user_identity.empty())
  {
    path += "?private_id=" + Utils::url_escape(private_user_identity);
  }

  LOG_DEBUG("Making Homestead request for %s", path.c_str());
  // Needs to be a shared pointer - multiple Ifcs objects will need a reference
  // to it, so we want to delete the underlying document when they all go out
  // of scope.

  rapidxml::xml_document<>* root_underlying_ptr = NULL;
  HTTPCode http_code = put_for_xml_object(path, "{\"reqtype\": \""+type+"\"}", root_underlying_ptr, trail);
  std::shared_ptr<rapidxml::xml_document<> > root (root_underlying_ptr);

  unsigned long latency_us = 0;

  // Only accumulate the latency if we haven't already applied a
  // penalty
  if ((http_code != HTTP_SERVER_UNAVAILABLE) &&
      (http_code != HTTP_GATEWAY_TIMEOUT)    &&
      (stopWatch.read(latency_us)))
  {
    _latency_stat.accumulate(latency_us);
    _subscription_latency_stat.accumulate(latency_us);
  }

  if (http_code != HTTP_OK)
  {
    // If get_xml_object has returned a HTTP error code, we have either not found
    // the subscriber on the HSS or been unable to communicate with
    // the HSS successfully. In either case we should fail.
    LOG_ERROR("Could not get subscriber data from HSS");
    return http_code;
  }

  return decode_homestead_xml(root, regstate, ifcs_map, associated_uris, ccfs, ecfs, false) ? HTTP_OK : HTTP_SERVER_ERROR;
}
开发者ID:jmmL,项目名称:sprout,代码行数:57,代码来源:hssconnection.cpp


示例5: get_user_auth_status

// Makes a user authorization request, and returns the data as a JSON object.
HTTPCode HSSConnection::get_user_auth_status(const std::string& private_user_identity,
                                             const std::string& public_user_identity,
                                             const std::string& visited_network,
                                             const std::string& auth_type,
                                             const bool& emergency,
                                             rapidjson::Document*& user_auth_status,
                                             SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_AUTH_STATUS, 0);
  event.add_var_param(private_user_identity);
  event.add_var_param(public_user_identity);
  SAS::report_event(event);

  std::string path = "/impi/" +
                     Utils::url_escape(private_user_identity) +
                     "/registration-status" +
                     "?impu=" +
                     Utils::url_escape(public_user_identity);

  if (!visited_network.empty())
  {
    path += "&visited-network=" + Utils::url_escape(visited_network);
  }
  if (!auth_type.empty())
  {
    path += "&auth-type=" + Utils::url_escape(auth_type);
  }
  if (emergency)
  {
    path += "&sos=true";
  }

  HTTPCode rc = get_json_object(path, user_auth_status, trail);

  unsigned long latency_us = 0;
  // Only accumulate the latency if we haven't already applied a
  // penalty
  if ((rc != HTTP_SERVER_UNAVAILABLE) &&
      (rc != HTTP_GATEWAY_TIMEOUT)    &&
      (stopWatch.read(latency_us)))
  {
    _latency_tbl->accumulate(latency_us);
    _uar_latency_tbl->accumulate(latency_us);
  }

  return rc;
}
开发者ID:ClearwaterCore,项目名称:sprout,代码行数:51,代码来源:hssconnection.cpp


示例6: get_location_data

/// Makes a location information request, and returns the data as a JSON object.
HTTPCode HSSConnection::get_location_data(const std::string& public_user_identity,
                                          const bool& originating,
                                          const std::string& auth_type,
                                          Json::Value*& location_data,
                                          SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_LOCATION, 0);
  event.add_var_param(public_user_identity);
  SAS::report_event(event);

  std::string path = "/impu/" +
                     Utils::url_escape(public_user_identity) +
                     "/location";

  if (originating)
  {
    path += "?originating=true";
  }
  if (!auth_type.empty())
  {
    std::string prefix = !originating ? "?" : "&";
    path += prefix + "auth-type=" + Utils::url_escape(auth_type);
  }

  HTTPCode rc = get_json_object(path, location_data, trail);

  unsigned long latency_us = 0;
  // Only accumulate the latency if we haven't already applied a
  // penalty
  if ((rc != HTTP_SERVER_UNAVAILABLE) &&
      (rc != HTTP_GATEWAY_TIMEOUT)    &&
      (stopWatch.read(latency_us)))
  {
    _latency_stat.accumulate(latency_us);
    _location_latency_stat.accumulate(latency_us);
  }

  return rc;
}
开发者ID:att-innovate,项目名称:sprout,代码行数:43,代码来源:hssconnection.cpp


示例7: get_simservs

bool XDMConnection::get_simservs(const std::string& user,
                                 std::string& xml_data,
                                 const std::string& password,
                                 SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  std::string url = "/org.etsi.ngn.simservs/users/" + Utils::url_escape(user) + "/simservs.xml";

  HTTPCode http_code = _http->send_get(url, xml_data, user, trail);

  unsigned long latency_us = 0;
  if (stopWatch.read(latency_us))
  {
    _latency_stat.accumulate(latency_us);
  }

  return (http_code == HTTP_OK);
}
开发者ID:matt-williams,项目名称:sprout,代码行数:20,代码来源:xdmconnection.cpp


示例8: get_user_auth_status

// Makes a user authorization request, and returns the data as a JSON object.
HTTPCode HSSConnection::get_user_auth_status(const std::string& private_user_identity,
                                             const std::string& public_user_identity,
                                             const std::string& visited_network,
                                             const std::string& auth_type,
                                             Json::Value*& user_auth_status,
                                             SAS::TrailId trail)
{
  Utils::StopWatch stopWatch;
  stopWatch.start();

  SAS::Event event(trail, SASEvent::HTTP_HOMESTEAD_AUTH_STATUS, 0);
  event.add_var_param(private_user_identity);
  event.add_var_param(public_user_identity);
  SAS::report_event(event);

  std::string path = "/impi/" +
                     Utils::url_escape(private_user_identity) +
                     "/registration-status" +
                     "?impu=" +
                     Utils::url_escape(public_user_identity);

  if (!visited_network.empty())
  {
    path += "&visited-network=" + Utils::url_escape(visited_network);
  }
  if (!auth_type.empty())
  {
    path += "&auth-type=" + Utils::url_escape(auth_type);
  }

  HTTPCode rc = get_json_object(path, user_auth_status, trail);

  unsigned long latency_us = 0;
  if (stopWatch.read(latency_us))
  {
    _latency_stat.accumulate(latency_us);
    _user_auth_latency_stat.accumulate(latency_us);
  }

  return rc;
}
开发者ID:oldurecu,项目名称:sprout,代码行数:42,代码来源:hssconnection.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ fs::path类代码示例发布时间:2022-05-31
下一篇:
C++ utils::MimeType类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap