From 5176a570793bf021d1b5ca46408eec0f30a9a479 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Wed, 30 May 2012 16:19:07 +0000 Subject: [PATCH] Print time offset from last packet in call map. --- lib/admin/Utils.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/admin/Utils.pm b/lib/admin/Utils.pm index c94dfc3..cd1d7e9 100644 --- a/lib/admin/Utils.pm +++ b/lib/admin/Utils.pm @@ -733,16 +733,19 @@ sub process_callmap { } ### draw arrows + my $last_timestamp = undef; my $y_offset = $canvas_margin + $canvas_pkg_distance; $i = 1; foreach my $packet(@{$packets}) { + my $time_offset = defined $last_timestamp ? ($packet->{timestamp} - $last_timestamp) : 0; + $last_timestamp = $packet->{timestamp}; my $from_x = $uas_pos_x{$packet->{src_ip}.':'.$packet->{src_port}}; my $to_x = $uas_pos_x{$packet->{dst_ip}.':'.$packet->{dst_port}}; #print "arrow from ".$packet->{src_ip}.':'.$packet->{src_port}." to ".$packet->{dst_ip}.':'.$packet->{dst_port}.": $from_x - $to_x\n"; draw_arrow($canvas, $from_x, $y_offset, $to_x, $y_offset, $canvas_pkg_line_width, $canvas_pkg_line_color); $packet->{payload} =~ /\ncseq:\s*(\d+)\s+[a-zA-Z]+/i; my $cseq = $1 ? $1 : '?'; - my $txt = $i.'. '.$packet->{method}.' ('.$cseq.')' ; + my $txt = sprintf($i.'. '.$packet->{method}.' ('.$cseq.', +%0.3fs)', $time_offset); my @bounds = $canvas->stringBounds($txt); # get bounds for text centering if($from_x < $to_x) { $from_x = $from_x+int($canvas_elem_distance/2)-int($bounds[0]/2);