6 #include <boost/timer/timer.hpp> 71 con_msg_man_type::ptr manager = websocketpp::lib::make_shared<con_msg_man_type>();
79 std::random_device dev;
85 double m = 18094238402394.0824923;
97 std::cout << m << std::endl;
99 std::cout <<
"Random Gen" << std::endl;
101 boost::timer::auto_cpu_timer t;
103 input->get_raw_payload().replace(0,foo,foo,
'\0');
104 output->get_raw_payload().replace(0,foo,foo,
'\0');
107 std::cout <<
"Out of place accelerated" << std::endl;
109 boost::timer::auto_cpu_timer t;
111 websocketpp::frame::word_mask_exact(reinterpret_cast<uint8_t*>(const_cast<char*>(input->get_raw_payload().data())),
reinterpret_cast<uint8_t*
>(
const_cast<char*
>(output->get_raw_payload().data())), foo, key);
117 input->get_raw_payload().replace(0,foo,foo,
'\0');
118 output->get_raw_payload().replace(0,foo,foo,
'\0');
120 std::cout <<
"In place accelerated" << std::endl;
122 boost::timer::auto_cpu_timer t;
124 websocketpp::frame::word_mask_exact(reinterpret_cast<uint8_t*>(const_cast<char*>(input->get_raw_payload().data())),
reinterpret_cast<uint8_t*
>(
const_cast<char*
>(input->get_raw_payload().data())), foo, key);
130 input->get_raw_payload().replace(0,foo,foo,
'\0');
131 output->get_raw_payload().replace(0,foo,foo,
'\0');
132 std::cout <<
"Out of place byte by byte" << std::endl;
134 boost::timer::auto_cpu_timer t;
142 input->get_raw_payload().replace(0,foo,foo,
'\0');
143 output->get_raw_payload().replace(0,foo,foo,
'\0');
144 std::cout <<
"In place byte by byte" << std::endl;
146 boost::timer::auto_cpu_timer t;
154 input->get_raw_payload().replace(0,foo,foo,
'a');
155 output->get_raw_payload().replace(0,foo,foo,
'b');
156 std::cout <<
"Copy" << std::endl;
158 boost::timer::auto_cpu_timer t;
160 std::copy(input->get_raw_payload().begin(), input->get_raw_payload().end(), output->get_raw_payload().begin());
websocketpp::server< websocketpp::config::core > server
int main(int argc, char **argv)
std::string to_hex(std::string const &input)
Convert std::string to ascii printed string of hex digits.
Four byte conversion union.
void byte_mask(input_iter b, input_iter e, output_iter o, masking_key_type const &key, size_t key_offset=0)
Byte by byte mask/unmask.
message_ptr get_message()
Get an empty message buffer.
void word_mask_exact(uint8_t *input, uint8_t *output, size_t length, masking_key_type const &key)
Exact word aligned mask/unmask.
Server endpoint role based on the given config.
Represents a buffer for a single WebSocket message.
A connection message manager that allocates a new message for each request.