Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
perftest Class Reference

Public Types

typedef perftest type
 
typedef std::chrono::duration< int, std::micro > dur_type
 

Public Member Functions

 perftest ()
 
void start (std::string uri)
 
void on_socket_init (websocketpp::connection_hdl)
 
context_ptr on_tls_init (websocketpp::connection_hdl)
 
void on_fail (websocketpp::connection_hdl hdl)
 
void on_open (websocketpp::connection_hdl hdl)
 
void on_message (websocketpp::connection_hdl hdl, message_ptr)
 
void on_close (websocketpp::connection_hdl)
 

Detailed Description

Definition at line 52 of file debug_client.cpp.

Member Typedef Documentation

◆ dur_type

std::chrono::duration<int,std::micro> perftest::dur_type

Definition at line 55 of file debug_client.cpp.

◆ type

Definition at line 54 of file debug_client.cpp.

Constructor & Destructor Documentation

◆ perftest()

perftest::perftest ( )
inline

Definition at line 57 of file debug_client.cpp.

57 {
60
61 // Initialize ASIO
62 m_endpoint.init_asio();
63
64 // Register our handlers
65 m_endpoint.set_socket_init_handler(bind(&type::on_socket_init,this,::_1));
66 //m_endpoint.set_tls_init_handler(bind(&type::on_tls_init,this,::_1));
67 m_endpoint.set_message_handler(bind(&type::on_message,this,::_1,::_2));
68 m_endpoint.set_open_handler(bind(&type::on_open,this,::_1));
69 m_endpoint.set_close_handler(bind(&type::on_close,this,::_1));
70 m_endpoint.set_fail_handler(bind(&type::on_fail,this,::_1));
71 }
void on_close(websocketpp::connection_hdl)
void on_open(websocketpp::connection_hdl hdl)
void on_message(websocketpp::connection_hdl hdl, message_ptr)
void on_fail(websocketpp::connection_hdl hdl)
void on_socket_init(websocketpp::connection_hdl)
void set_fail_handler(fail_handler h)
Definition endpoint.hpp:287
void set_message_handler(message_handler h)
Definition endpoint.hpp:322
void set_open_handler(open_handler h)
Definition endpoint.hpp:277
void set_access_channels(log::level channels)
Set Access logging channel.
Definition endpoint.hpp:220
void set_error_channels(log::level channels)
Set Error logging channel.
Definition endpoint.hpp:242
void set_close_handler(close_handler h)
Definition endpoint.hpp:282
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:152
static level const all
Special aggregate value representing "all levels".
Definition levels.hpp:80
Here is the call graph for this function:

Member Function Documentation

◆ on_close()

void perftest::on_close ( websocketpp::connection_hdl )
inline

Definition at line 130 of file debug_client.cpp.

130 {
131 m_close = std::chrono::high_resolution_clock::now();
132
133 std::cout << "Socket Init: " << std::chrono::duration_cast<dur_type>(m_socket_init-m_start).count() << std::endl;
134 std::cout << "TLS Init: " << std::chrono::duration_cast<dur_type>(m_tls_init-m_start).count() << std::endl;
135 std::cout << "Open: " << std::chrono::duration_cast<dur_type>(m_open-m_start).count() << std::endl;
136 std::cout << "Message: " << std::chrono::duration_cast<dur_type>(m_message-m_start).count() << std::endl;
137 std::cout << "Close: " << std::chrono::duration_cast<dur_type>(m_close-m_start).count() << std::endl;
138 }
Here is the caller graph for this function:

◆ on_fail()

void perftest::on_fail ( websocketpp::connection_hdl hdl)
inline

Definition at line 110 of file debug_client.cpp.

110 {
111 client::connection_ptr con = m_endpoint.get_con_from_hdl(hdl);
112
113 std::cout << "Fail handler" << std::endl;
114 std::cout << con->get_state() << std::endl;
115 std::cout << con->get_local_close_code() << std::endl;
116 std::cout << con->get_local_close_reason() << std::endl;
117 std::cout << con->get_remote_close_code() << std::endl;
118 std::cout << con->get_remote_close_reason() << std::endl;
119 std::cout << con->get_ec() << " - " << con->get_ec().message() << std::endl;
120 }
connection_ptr get_con_from_hdl(connection_hdl hdl, lib::error_code &ec)
Retrieves a connection_ptr from a connection_hdl (exception free)
Definition endpoint.hpp:643
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_message()

void perftest::on_message ( websocketpp::connection_hdl hdl,
message_ptr  )
inline

Definition at line 126 of file debug_client.cpp.

126 {
127 m_message = std::chrono::high_resolution_clock::now();
128 m_endpoint.close(hdl,websocketpp::close::status::going_away,"");
129 }
void close(connection_hdl hdl, close::status::value const code, std::string const &reason, lib::error_code &ec)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_open()

void perftest::on_open ( websocketpp::connection_hdl hdl)
inline

Definition at line 122 of file debug_client.cpp.

122 {
123 m_open = std::chrono::high_resolution_clock::now();
124 m_endpoint.send(hdl, "", websocketpp::frame::opcode::text);
125 }
void send(connection_hdl hdl, std::string const &payload, frame::opcode::value op, lib::error_code &ec)
Create a message and add it to the outgoing send queue (exception free)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_socket_init()

void perftest::on_socket_init ( websocketpp::connection_hdl )
inline

Definition at line 91 of file debug_client.cpp.

91 {
92 m_socket_init = std::chrono::high_resolution_clock::now();
93 }
Here is the caller graph for this function:

◆ on_tls_init()

context_ptr perftest::on_tls_init ( websocketpp::connection_hdl )
inline

Definition at line 95 of file debug_client.cpp.

95 {
96 m_tls_init = std::chrono::high_resolution_clock::now();
97 context_ptr ctx = websocketpp::lib::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::tlsv1);
98
99 try {
100 ctx->set_options(boost::asio::ssl::context::default_workarounds |
101 boost::asio::ssl::context::no_sslv2 |
102 boost::asio::ssl::context::no_sslv3 |
103 boost::asio::ssl::context::single_dh_use);
104 } catch (std::exception& e) {
105 std::cout << e.what() << std::endl;
106 }
107 return ctx;
108 }
websocketpp::lib::shared_ptr< boost::asio::ssl::context > context_ptr

◆ start()

void perftest::start ( std::string uri)
inline

Definition at line 73 of file debug_client.cpp.

73 {
74 websocketpp::lib::error_code ec;
75 client::connection_ptr con = m_endpoint.get_connection(uri, ec);
76
77 if (ec) {
78 m_endpoint.get_alog().write(websocketpp::log::alevel::app,ec.message());
79 return;
80 }
81
82 //con->set_proxy("http://humupdates.uchicago.edu:8443");
83
84 m_endpoint.connect(con);
85
86 // Start the ASIO io_service run loop
87 m_start = std::chrono::high_resolution_clock::now();
88 m_endpoint.run();
89 }
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.
alog_type & get_alog()
Get reference to access logger.
Definition endpoint.hpp:261
static level const app
Special channel for application specific logs. Not used by the library.
Definition levels.hpp:143
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: