Skip to content

Commit

Permalink
adding pcap gnuplot examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Feb 1, 2024
1 parent 251fe2b commit 8ede5be
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 1 deletion.
2 changes: 2 additions & 0 deletions jbuf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sipp
*.dat
2 changes: 1 addition & 1 deletion sipp/README.md → jbuf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cmake --build build -j
## Usage

```bash
sudo build/sipp -sf scenarios/uac_pcap.xml 127.0.0.1 -m 1
sudo sipp/build/sipp -sf scenarios/uac_pcap_opus.xml 127.0.0.1 -m 1 -key pcap pcap/opus_audio_500hz_linux_qdisc_delay_50ms.pcap
```

## PCAP's
Expand Down
49 changes: 49 additions & 0 deletions jbuf/jbuf.plot
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/gnuplot
#
# How to generate a plot
# ======================
# This gnuplot script plots DEBUG_LEVEL 6 output of jbuf.c. You have to
# increment the DEBUG_LEVEL in ajb.c if you want to get the table for
# jbuf.dat. Then call baresip like this:
#
# ./baresip 2>&1 | grep -Eo "jbuf.*" > jbuf.dat
#
# Call this script. Then compare the plot legend with the variables in jbuf.c!
#
#
# Description of the plot
# =======================
# The plot is a time based diagram.
#
# Events:
# - overflow
# - underflow
# - packet too late
# - out of sequence
# - lost packet
# Copyright (C) 2023 commend.com - Christian Spielberger


# Choose your preferred gnuplot terminal or use e.g. evince to view the
# jbuf.eps!

set terminal wxt persist
#set terminal qt persist
#set terminal postscript eps size 30,20 enhanced color
#set output 'jbuf.eps'
#set terminal png size 1280,480
#set output 'jbuf.png'
set datafile separator ","
set key outside
set xlabel "time/ms"
set ylabel "delay (ms)"

stats "jbuf_recv_delay.dat" using ($2) name "N"
stats "jbuf_late_loss.dat" using ($2) name "L" nooutput

plot 'jbuf_recv_delay.dat' using ($1/1000):2 title 'receive' with linespoints, \
'jbuf_play_delay.dat' using ($1/1000):2 title 'playout' with points, \
'jbuf_jitter_adapt.dat' using ($1/1000):2 title 'adapt' with points, \
'jbuf_playout_diff.dat' using ($1/1000):2 title 'playout_diff' with linespoints, \
'jbuf_late_play.dat' using ($1/1000):2 title sprintf("Late: %d", L_records) with points

23 changes: 23 additions & 0 deletions jbuf/jbuf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

trace_file="../../re_trace.json"

function gen_datfile() {
ph=$1
filename=$2

jqc=".traceEvents[] | select (.id == \"audio\" and .cat == \"jbuf\" and .name == \"${ph}\") | \"\(.ts),\(.args.${ph})\""
jq -c "${jqc}" ${trace_file} | sed 's/"//g' > "${filename}"
}

gen_datfile recv_delay jbuf_recv_delay.dat
gen_datfile play_delay jbuf_play_delay.dat
gen_datfile jitter_adjust jbuf_jitter_adapt.dat
gen_datfile playout_diff jbuf_playout_diff.dat
gen_datfile clock_skew jbuf_clock_skew.dat
gen_datfile get jbuf_get.dat
gen_datfile late_play jbuf_late_play.dat
gen_datfile jitter jbuf_jitter.dat

./jbuf.plot
./jbuf_clocks.plot
42 changes: 42 additions & 0 deletions jbuf/jbuf_clocks.plot
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/gnuplot
#
# How to generate a plot
# ======================
# This gnuplot script plots DEBUG_LEVEL 6 output of jbuf.c. You have to
# increment the DEBUG_LEVEL in ajb.c if you want to get the table for
# jbuf.dat. Then call baresip like this:
#
# ./baresip 2>&1 | grep -Eo "jbuf.*" > jbuf.dat
#
# Call this script. Then compare the plot legend with the variables in jbuf.c!
#
#
# Description of the plot
# =======================
# The plot is a time based diagram.
#
# Events:
# - overflow
# - underflow
# - packet too late
# - out of sequence
# - lost packet
# Copyright (C) 2023 commend.com - Christian Spielberger


# Choose your preferred gnuplot terminal or use e.g. evince to view the
# jbuf.eps!

set terminal wxt persist
#set terminal postscript eps size 30,20 enhanced color
#set output 'jbuf.eps'
#set terminal png size 1280,480
#set output 'jbuf.png'
set datafile separator ","
set key outside
set xlabel "time/ms"
set ylabel "delay (ms)"

plot 'jbuf_clock_skew.dat' using ($1/1000):2 title 'clock_skew' with linespoints, \
'jbuf_jitter.dat' using ($1/1000):2 title 'jitter' with linespoints

File renamed without changes.
Binary file added jbuf/scenarios/pcap/modified.pcap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added jbuf/scenarios/pcap/opus_audio_500hz_normal.pcap
Binary file not shown.
108 changes: 108 additions & 0 deletions jbuf/scenarios/uac_pcap_opus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Sipp 'uac' scenario with pcap (rtp) play -->
<!-- -->

<scenario name="UAC with media">
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send retrans="500">
<![CDATA[
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
To: [service] <sip:[service]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[local_ip_type] [local_ip]
t=0 0
m=audio [media_port] RTP/AVP 96
a=rtpmap:96 opus/48000/2
]]>
</send>

<recv response="100" optional="true">
</recv>

<recv response="180" optional="true">
</recv>

<recv response="200" rtd="true" crlf="true">
</recv>

<send>
<![CDATA[
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
]]>
</send>

<!-- Play a pre-recorded PCAP file (RTP stream) -->
<nop>
<action>
<exec play_pcap_audio="[pcap]"/>
</action>
</nop>

<!-- Pause 30 seconds, which is approximately the duration of the -->
<!-- PCAP file -->
<pause milliseconds="30000"/>

<!-- The 'crlf' option inserts a blank line in the statistics report. -->
<send retrans="500">
<![CDATA[
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag09[call_number]
To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 2 BYE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
]]>
</send>

<recv response="200" crlf="true">
</recv>
</scenario>

0 comments on commit 8ede5be

Please sign in to comment.