Revision: 1105
Author: [email protected]
Date: Mon Mar  8 01:46:31 2010
Log: Abstract writing process end into NYTP_write_process_end().

Add a wrapper for it and use it from nytprofmerge.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1105

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

=======================================
--- /trunk/FileHandle.h Mon Mar  8 01:46:15 2010
+++ /trunk/FileHandle.h Mon Mar  8 01:46:31 2010
@@ -70,3 +70,5 @@
                                      size_t key_len, unsigned long value);
 size_t NYTP_write_process_start(NYTP_file ofile, unsigned int pid,
                                 unsigned int ppid, NV time_of_day);
+size_t NYTP_write_process_end(NYTP_file ofile, unsigned int pid,
+                              NV time_of_day);
=======================================
--- /trunk/FileHandle.xs        Mon Mar  8 01:46:21 2010
+++ /trunk/FileHandle.xs        Mon Mar  8 01:46:31 2010
@@ -731,6 +731,23 @@
     return total;
 }

+size_t
+NYTP_write_process_end(NYTP_file ofile, unsigned int pid, NV time_of_day)
+{
+    size_t total;
+    size_t retval;
+
+    total = retval = output_tag_int(ofile, NYTP_TAG_PID_END, pid);
+    if (retval < 1)
+        return retval;
+
+    total += retval = output_nv(ofile, time_of_day);
+    if (retval < 1)
+        return retval;
+
+    return total;
+}
+

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

@@ -857,3 +874,9 @@
 unsigned int pid
 unsigned int ppid
 NV time_of_day
+
+size_t
+NYTP_write_process_end(handle, pid, time_of_day)
+NYTP_file handle
+unsigned int pid
+NV time_of_day
=======================================
--- /trunk/NYTProf.xs   Mon Mar  8 01:46:15 2010
+++ /trunk/NYTProf.xs   Mon Mar  8 01:46:31 2010
@@ -1645,8 +1645,7 @@
     /* mark end of profile data for last_pid pid
      * which is the pid that this file relates to
      */
-    output_tag_int(out, NYTP_TAG_PID_END, last_pid);
-    output_nv(out, gettimeofday_nv());
+    NYTP_write_process_end(out, last_pid, gettimeofday_nv());

     if ((result = NYTP_close(out, 0)))
         logwarn("Error closing profile data file: %s\n", strerror(result));
=======================================
--- /trunk/bin/nytprofmerge     Mon Mar  8 01:46:21 2010
+++ /trunk/bin/nytprofmerge     Mon Mar  8 01:46:31 2010
@@ -139,9 +139,7 @@
      },
      PID_END => sub {
         my (undef, $pid, $time) = @_;
-        $out->write('p');
-        $out->output_int($pid);
-        $out->output_nv($time);
+        $out->write_process_end($pid, $time);
      },

      NEW_FID => sub {

--
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