aboutsummaryrefslogtreecommitdiff
path: root/tests/memanalyze.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-10-10 16:56:35 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-10-14 17:40:12 +0200
commitad164eceb3ce6721d34a3418e0dacabd4f4ff904 (patch)
tree7ae3bdc1411b57b96b68a9a0ccef16904ec22c98 /tests/memanalyze.pl
parent4af3c777a9996f32c5a23db0ecf29996197dfdbc (diff)
memdebug: trace send, recv and socket
... to allow them to be included in torture tests too. closes #1980
Diffstat (limited to 'tests/memanalyze.pl')
-rwxr-xr-xtests/memanalyze.pl30
1 files changed, 23 insertions, 7 deletions
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, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, 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(<FILE>) {
$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(<FILE>) {
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";
}