From 974ebc3142f12f89fdccac0830a8eefd22879eb4 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 11 Feb 2010 14:57:26 +0000 Subject: [PATCH] Add a wrapper for NYTP_write_sub_callers and use it from nytprofmerge. --- FileHandle.xs | 29 +++++++++++++++++++++++++++++ bin/nytprofmerge | 10 +++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/FileHandle.xs b/FileHandle.xs index dd31a3b..2aeae91 100644 --- a/FileHandle.xs +++ b/FileHandle.xs @@ -1116,3 +1116,32 @@ unsigned int last_line first_line, last_line); OUTPUT: RETVAL + +size_t +NYTP_write_sub_callers(handle, fid, line, caller, count, incl_rtime, excl_rtime, incl_utime, incl_stime, reci_rtime, depth, called_sub) +NYTP_file handle +unsigned int fid +unsigned int line +SV *caller +unsigned int count +NV incl_rtime +NV excl_rtime +NV incl_utime +NV incl_stime +NV reci_rtime +unsigned int depth +SV *called_sub + PREINIT: + STRLEN caller_len; + const char *const caller_p = SvPV(caller, caller_len); + STRLEN called_len; + const char *const called_p = SvPV(called_sub, called_len); + CODE: + RETVAL = NYTP_write_sub_callers(handle, fid, line, caller_p, + SvUTF8(caller) ? -(I32)caller_len : (I32)caller_len, + count, incl_rtime, excl_rtime, + incl_utime, incl_stime, reci_rtime, + depth, called_p, + SvUTF8(called_sub) ? -(I32)called_len : (I32)called_len); + OUTPUT: + RETVAL diff --git a/bin/nytprofmerge b/bin/nytprofmerge index 1514c8f..827a389 100755 --- a/bin/nytprofmerge +++ b/bin/nytprofmerge @@ -306,13 +306,9 @@ foreach my $fid_line (sort keys %callers) { foreach my $called (sort keys %{$callers{$fid_line}}) { foreach my $caller (sort keys %{$callers{$fid_line}{$called}}) { my $sum = $callers{$fid_line}{$called}{$caller}; - $out->write('c'); - $out->output_int($fid, $line); - $out->output_str($caller); - $out->output_int($sum->{count}); - $out->output_nv(@{$sum}{qw(incl excl ucpu scpu reci)}); - $out->output_int($sum->{depth}); - $out->output_str($called); + $out->write_sub_callers($fid, $line, $caller, $sum->{count}, + @{$sum}{qw(incl excl ucpu scpu reci)}, + $sum->{depth}, $called); } } } -- 1.6.0