Skip to content

Commit d126a8b

Browse files
alexlaparainliu
authored andcommitted
bench corrections
1 parent ce7f1d6 commit d126a8b

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

srtp/benches/srtp_bench.rs

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@ use util::Marshal;
44
use webrtc_srtp::{context::Context, protection_profile::ProtectionProfile};
55

66
fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
7-
let mut setup_ctx = Context::new(
8-
&vec![
9-
96, 180, 31, 4, 119, 137, 128, 252, 75, 194, 252, 44, 63, 56, 61, 55,
10-
],
11-
&vec![247, 26, 49, 94, 99, 29, 79, 94, 5, 111, 252, 216, 62, 195],
12-
ProtectionProfile::Aes128CmHmacSha1_80,
13-
None,
14-
None,
15-
)
16-
.unwrap();
17-
187
let mut ctx = Context::new(
198
&vec![
209
96, 180, 31, 4, 119, 137, 128, 252, 75, 194, 252, 44, 63, 56, 61, 55,
@@ -57,6 +46,35 @@ fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
5746
criterion::BatchSize::LargeInput,
5847
);
5948
});
49+
}
50+
51+
fn benchmark_decrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
52+
let mut setup_ctx = Context::new(
53+
&vec![
54+
96, 180, 31, 4, 119, 137, 128, 252, 75, 194, 252, 44, 63, 56, 61, 55,
55+
],
56+
&vec![247, 26, 49, 94, 99, 29, 79, 94, 5, 111, 252, 216, 62, 195],
57+
ProtectionProfile::Aes128CmHmacSha1_80,
58+
None,
59+
None,
60+
)
61+
.unwrap();
62+
63+
let mut ctx = Context::new(
64+
&vec![
65+
96, 180, 31, 4, 119, 137, 128, 252, 75, 194, 252, 44, 63, 56, 61, 55,
66+
],
67+
&vec![247, 26, 49, 94, 99, 29, 79, 94, 5, 111, 252, 216, 62, 195],
68+
ProtectionProfile::Aes128CmHmacSha1_80,
69+
None,
70+
None,
71+
)
72+
.unwrap();
73+
74+
let mut pld = BytesMut::new();
75+
for i in 0..1200 {
76+
pld.extend_from_slice(&[i as u8]);
77+
}
6078

6179
c.bench_function("Benchmark decrypt", |b| {
6280
let mut seq = 1;
@@ -86,5 +104,7 @@ fn benchmark_encrypt_rtp_aes_128_cm_hmac_sha1(c: &mut Criterion) {
86104
});
87105
}
88106

89-
criterion_group!(benches, benchmark_encrypt_rtp_aes_128_cm_hmac_sha1);
107+
108+
109+
criterion_group!(benches, benchmark_encrypt_rtp_aes_128_cm_hmac_sha1, benchmark_decrypt_rtp_aes_128_cm_hmac_sha1);
90110
criterion_main!(benches);

0 commit comments

Comments
 (0)