Revision: 1117
Author: [email protected]
Date: Mon Mar  8 01:47:52 2010
Log: Abstract writing a discount marker into NYTP_write_discount(), add a wrapper,
and use it from nytprofmerge.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1117

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

=======================================
--- /trunk/FileHandle.h Mon Mar  8 01:47:43 2010
+++ /trunk/FileHandle.h Mon Mar  8 01:47:52 2010
@@ -95,3 +95,4 @@
const char *called_name, I32 called_name_len);
 size_t NYTP_write_src_line(NYTP_file ofile, unsigned int fid,
unsigned int line, const char *text, I32 text_len);
+size_t NYTP_write_discount(NYTP_file ofile);
=======================================
--- /trunk/FileHandle.xs        Mon Mar  8 01:47:43 2010
+++ /trunk/FileHandle.xs        Mon Mar  8 01:47:52 2010
@@ -1035,6 +1035,13 @@
     return total;
 }

+size_t
+NYTP_write_discount(NYTP_file ofile)
+{
+    const unsigned char tag = NYTP_TAG_DISCOUNT;
+    return NYTP_write(ofile, &tag, sizeof(tag));
+}
+

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

@@ -1264,3 +1271,7 @@
p, SvUTF8(text) ? -(I32)len : (I32)len);
     OUTPUT:
         RETVAL
+
+size_t
+NYTP_write_discount(handle)
+NYTP_file handle
=======================================
--- /trunk/NYTProf.xs   Mon Mar  8 01:47:43 2010
+++ /trunk/NYTProf.xs   Mon Mar  8 01:47:52 2010
@@ -1381,7 +1381,6 @@
     int saved_errno = errno;
     unsigned int prev_last_executed_fid  = last_executed_fid;
     unsigned int prev_last_executed_line = last_executed_line;
-    const unsigned char tag = NYTP_TAG_DISCOUNT;

     /* Called _after_ ops that indicate we've completed a statement
      * and are returning into the middle of some outer statement.
@@ -1408,7 +1407,7 @@
* increment the count (because the time is not for a new statement but simply
      * a continuation of a previously counted statement).
      */
-    NYTP_write(out, &tag, sizeof(tag));
+    NYTP_write_discount(out);

     /* special cases */
     if (last_executed_line == prev_last_executed_line
=======================================
--- /trunk/bin/nytprofmerge     Mon Mar  8 01:47:36 2010
+++ /trunk/bin/nytprofmerge     Mon Mar  8 01:47:52 2010
@@ -154,7 +154,7 @@
      TIME_LINE => \&_time_block_or_line,

      DISCOUNT => sub {
-        $out->write('-');
+        $out->write_discount();
      },
      SUB_INFO => sub {
         my (undef, $fid, $first_line, $last_line, $name) = @_;

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