From ad164eceb3ce6721d34a3418e0dacabd4f4ff904 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 10 Oct 2017 16:56:35 +0200 Subject: memdebug: trace send, recv and socket ... to allow them to be included in torture tests too. closes #1980 --- tests/memanalyze.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'tests/memanalyze.pl') diff --git a/tests/memanalyze.pl b/tests/memanalyze.pl index 35d1c7ef7..8ba3f6dd5 100755 --- a/tests/memanalyze.pl +++ b/tests/memanalyze.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. +# Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -33,6 +33,9 @@ my $reallocs=0; my $strdups=0; my $wcsdups=0; my $showlimit; +my $sends=0; +my $recvs=0; +my $sockets=0; while(1) { if($ARGV[0] eq "-v") { @@ -258,6 +261,7 @@ while() { $filedes{$1}=1; $getfile{$1}="$source:$linenum"; $openfile++; + $sockets++; # number of socket() calls } elsif($function =~ /socketpair\(\) = (\d*) (\d*)/) { $filedes{$1}=1; @@ -314,6 +318,14 @@ while() { elsif($_ =~ /^GETNAME ([^ ]*):(\d*) (.*)/) { # not much to do } + # SEND url.c:1901 send(83) = 83 + elsif($_ =~ /^SEND ([^ ]*):(\d*) (.*)/) { + $sends++; + } + # RECV url.c:1901 recv(102400) = 256 + elsif($_ =~ /^RECV ([^ ]*):(\d*) (.*)/) { + $recvs++; + } # ADDR url.c:1282 getaddrinfo() = 0x5ddd elsif($_ =~ /^ADDR ([^ ]*):(\d*) (.*)/) { @@ -398,12 +410,16 @@ if($addrinfos) { if($verbose) { print "Mallocs: $mallocs\n", - "Reallocs: $reallocs\n", - "Callocs: $callocs\n", - "Strdups: $strdups\n", - "Wcsdups: $wcsdups\n", - "Frees: $frees\n", - "Allocations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups)."\n"; + "Reallocs: $reallocs\n", + "Callocs: $callocs\n", + "Strdups: $strdups\n", + "Wcsdups: $wcsdups\n", + "Frees: $frees\n", + "Sends: $sends\n", + "Recvs: $recvs\n", + "Sockets: $sockets\n", + "Allocations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups)."\n", + "Operations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups + $sends + $recvs + $sockets)."\n"; print "Maximum allocated: $maxmem\n"; } -- cgit v1.2.3