Revision: 1113
Author: [email protected]
Date: Mon Mar  8 01:47:23 2010
Log: Abstract writing sub caller info into NYTP_write_sub_callers().
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1113

Modified:
 /trunk/FileHandle.h
 /trunk/FileHandle.xs
 /trunk/NYTProf.xs

=======================================
--- /trunk/FileHandle.h Mon Mar  8 01:47:05 2010
+++ /trunk/FileHandle.h Mon Mar  8 01:47:23 2010
@@ -85,3 +85,10 @@
 size_t NYTP_write_sub_info(NYTP_file ofile, unsigned int fid,
                            const char *name, I32 len,
unsigned int first_line, unsigned int last_line);
+size_t NYTP_write_sub_callers(NYTP_file ofile, unsigned int fid,
+                              unsigned int line,
+                              const char *caller_name, I32 caller_name_len,
+ unsigned int count, NV incl_rtime, NV excl_rtime,
+                              NV incl_utime, NV incl_stime, NV reci_rtime,
+                              unsigned int depth,
+ const char *called_name, I32 called_name_len);
=======================================
--- /trunk/FileHandle.xs        Mon Mar  8 01:47:05 2010
+++ /trunk/FileHandle.xs        Mon Mar  8 01:47:23 2010
@@ -873,6 +873,64 @@

     return total;
 }
+
+size_t
+NYTP_write_sub_callers(NYTP_file ofile, unsigned int fid, unsigned int line,
+                       const char *caller_name, I32 caller_name_len,
+                       unsigned int count, NV incl_rtime, NV excl_rtime,
+                       NV incl_utime, NV incl_stime, NV reci_rtime,
+                       unsigned int depth,
+                       const char *called_name, I32 called_name_len)
+{
+    size_t total;
+    size_t retval;
+
+    total = retval = output_tag_int(ofile, NYTP_TAG_SUB_CALLERS, fid);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_int(ofile, line);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_str(ofile, caller_name, caller_name_len);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_int(ofile, count);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_nv(ofile, incl_rtime);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_nv(ofile, excl_rtime);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_nv(ofile, incl_utime);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_nv(ofile, incl_stime);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_nv(ofile, reci_rtime);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_int(ofile, depth);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_str(ofile, called_name, called_name_len);
+    if (retval < 1)
+        return retval;
+
+    return total;
+}

MODULE = Devel::NYTProf::FileHandle PACKAGE = Devel::NYTProf::FileHandle PREFIX = NYTP_

=======================================
--- /trunk/NYTProf.xs   Mon Mar  8 01:47:15 2010
+++ /trunk/NYTProf.xs   Mon Mar  8 01:47:23 2010
@@ -3280,17 +3280,16 @@
             depth = uv_from_av(aTHX_ av, NYTP_SCi_REC_DEPTH , 0);
             sc[NYTP_SCi_REC_DEPTH]  = depth * 1.0;

-            output_tag_int(out, NYTP_TAG_SUB_CALLERS, fid);
-            output_int(out, line);
-            output_str(out, caller_subname, caller_subname_len);
-            output_int(out, count);
-            output_nv(out, sc[NYTP_SCi_INCL_RTIME]);
-            output_nv(out, sc[NYTP_SCi_EXCL_RTIME]);
-            output_nv(out, 0.0); /* NYTP_SCi_spare_3 */
-            output_nv(out, 0.0); /* NYTP_SCi_spare_4 */
-            output_nv(out, sc[NYTP_SCi_RECI_RTIME]);
-            output_int(out, depth);
-            output_str(out, called_subname, called_subname_len);
+            NYTP_write_sub_callers(out, fid, line,
+                                   caller_subname, caller_subname_len,
+                                   count,
+                                   sc[NYTP_SCi_INCL_RTIME],
+                                   sc[NYTP_SCi_EXCL_RTIME],
+                                   0.0, /* NYTP_SCi_spare_3 */
+                                   0.0, /* NYTP_SCi_spare_4 */
+                                   sc[NYTP_SCi_RECI_RTIME],
+                                   depth,
+                                   called_subname, called_subname_len);

             /* sanity check - early warning */
if (sc[NYTP_SCi_INCL_RTIME] < 0.0 || sc[NYTP_SCi_EXCL_RTIME] < 0.0) {

--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to