Revision: 1060
Author: [email protected]
Date: Wed Feb 17 08:35:56 2010
Log: In load_profile_data_from_stream(), avoid calling sprintf() if we don't need
the result because we're taking the callback code path.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1060

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Wed Feb 17 08:35:51 2010
+++ /trunk/NYTProf.xs   Wed Feb 17 08:35:56 2010
@@ -4152,7 +4152,7 @@
                 char text[MAXPATHLEN*2];
                 unsigned int pid  = read_int();
                 unsigned int ppid = read_int();
-                int len = sprintf(text, "%d", pid);
+                int len;
                 profiler_start_time = read_nv();

                 if (cb) {
@@ -4170,6 +4170,7 @@
                     break;
                 }

+                len = sprintf(text, "%d", pid);
                 (void)hv_store(live_pids_hv, text, len, newSVuv(ppid), 0);
                 if (trace_level)
logwarn("Start of profile data for pid %s (ppid %d, %"IVdf" pids live) at %"NVff"\n",
@@ -4184,7 +4185,7 @@
             {
                 char text[MAXPATHLEN*2];
                 unsigned int pid = read_int();
-                int len = sprintf(text, "%d", pid);
+                int len;
                 profiler_end_time = read_nv();

                 if (cb) {
@@ -4201,6 +4202,7 @@
                     break;
                 }

+                len = sprintf(text, "%d", pid);
                 if (!hv_delete(live_pids_hv, text, len, 0))
logwarn("Inconsistent pids in profile data (pid %d not introduced)\n",
                         pid);

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