Skip to content
Snippets Groups Projects
Commit 23ef8710 authored by Covertness's avatar Covertness
Browse files

bench client request

parent 689aefab
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ addons: ...@@ -9,6 +9,7 @@ addons:
# run builds for both all the trains # run builds for both all the trains
rust: rust:
- nightly
- beta - beta
- stable - stable
...@@ -23,7 +24,7 @@ script: ...@@ -23,7 +24,7 @@ script:
- | - |
travis-cargo build && travis-cargo build &&
travis-cargo test && travis-cargo test &&
travis-cargo bench && travis-cargo --only nightly bench &&
travis-cargo --only stable doc travis-cargo --only stable doc
after_success: after_success:
# upload the documentation from the build with beta (automatically only actually # upload the documentation from the build with beta (automatically only actually
......
#![feature(test)]
extern crate test;
extern crate coap;
use test::Bencher;
use coap::packet::*;
use coap::CoAPClient;
#[bench]
fn bench_client_request(b: &mut Bencher) {
let addr = "127.0.0.1:5683";
let request = "test";
let mut packet = Packet::new();
packet.header.set_version(1);
packet.header.set_type(PacketType::Confirmable);
packet.header.set_code("0.01");
packet.header.set_message_id(1);
packet.set_token(vec!(0x51, 0x55, 0x77, 0xE8));
packet.add_option(OptionType::UriPath, request.to_string().into_bytes());
b.iter(|| {
let client = CoAPClient::new(addr).unwrap();
client.send(&packet).unwrap();
});
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment