Author: timbo
Date: Tue Jun 12 14:22:13 2007
New Revision: 9641

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs
   dbi/trunk/dbixs_rev.h

Log:
Don't profile DESTROY during global destruction


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Tue Jun 12 14:22:13 2007
@@ -53,12 +53,13 @@
   Added non-random (deterministic) mode to DBI_GOFER_RANDOM mechanism.
   Added DBIXS_REVISION macro that drivers can use.
 
+  DBI::Profile changes:
+    Don't profile DESTROY during global destruction.
   DBI::ProfileDumper changes:
     Don't write file if there's no profile data.
     Uses full natural precision when saving data (was using %.6f)
     Optimized flush_to_disk().
     Locks the data file while writing.
-    Added $profile->filename method.
     Enabled filename to be a code ref for dynamic names.
   DBI::ProfileDumper::Apache changes:
     Added Quiet=>1 to avoid write to STDERR in flush_to_disk().

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Tue Jun 12 14:22:13 2007
@@ -2313,6 +2313,7 @@
     HV *dbh_outer_hv = NULL;
     HV *dbh_inner_hv = NULL;
     char *statement_pv;
+    char *method_pv;
     SV *profile;
     SV *tmp;
     SV *dest_node;
@@ -2328,6 +2329,14 @@
     if (!DBIc_has(imp_xxh, DBIcf_Profile))
        return;
 
+    method_pv = (SvTYPE(method)==SVt_PVCV)
+        ? GvNAME(CvGV(method))
+        : (isGV(method) ? GvNAME(method) : SvPV_nolen(method));
+
+    /* we don't profile DESTROY during global destruction */
+    if (dirty && instr(method_pv, "DESTROY"))
+        return;
+
     h_hv = (HV*)SvRV(dbih_inner(aTHX_ h, "dbi_profile"));
 
     profile = *hv_fetch(h_hv, "Profile", 7, 1);
@@ -2349,9 +2358,8 @@
     statement_pv = SvPV_nolen(statement_sv);
 
     if (DBIc_DBISTATE(imp_xxh)->debug >= 4)
-       PerlIO_printf(DBIc_LOGPIO(imp_xxh), "       dbi_profile %s %fs %s\n",
-            neatsvpv((SvTYPE(method)==SVt_PVCV) ? (SV*)CvGV(method) : method, 
0),
-            ti, neatsvpv(statement_sv,0));
+       PerlIO_printf(DBIc_LOGPIO(imp_xxh), "       dbi_profile +%fs %s %s\n",
+            ti, method_pv, neatsvpv(statement_sv,0));
 
     dest_node = _profile_next_node(profile, "Data");
 
@@ -2372,9 +2380,6 @@
                 SV *code_sv = SvRV(pathsv);
                 I32 items;
                 I32 item_idx;
-                char *method_pv = (SvTYPE(method)==SVt_PVCV)
-                    ? GvNAME(CvGV(method))
-                    : (isGV(method) ? GvNAME(method) : SvPV_nolen(method));
                 EXTEND(SP, 4);
                 PUSHMARK(SP);
                 PUSHs(h);   /* push inner handle, then others params */
@@ -2414,10 +2419,7 @@
                         dest_node = _profile_next_node(dest_node, 
statement_pv);
                     }
                     else if (p[1] == 'M' && strEQ(p, "!MethodName")) {
-                        p = (SvTYPE(method)==SVt_PVCV)
-                           ? GvNAME(CvGV(method))
-                           : (isGV(method) ? GvNAME(method) : 
SvPV_nolen(method));
-                        dest_node = _profile_next_node(dest_node, p);
+                        dest_node = _profile_next_node(dest_node, method_pv);
                     }
                     else if (p[1] == 'M' && strEQ(p, "!MethodClass")) {
                         if (SvTYPE(method) == SVt_PVCV) {
@@ -2436,7 +2438,7 @@
                             if (*p == '*') ++p; /* skip past leading '*' glob 
sigil */
                         }
                         else {
-                            p = SvPV_nolen(method);
+                            p = method_pv;
                         }
                         dest_node = _profile_next_node(dest_node, p);
                     }

Modified: dbi/trunk/dbixs_rev.h
==============================================================================
--- dbi/trunk/dbixs_rev.h       (original)
+++ dbi/trunk/dbixs_rev.h       Tue Jun 12 14:22:13 2007
@@ -1,2 +1,2 @@
-/* Code modified since last checkin */
+/* Mixed revision working copy */
 #define DBIXS_REVISION 9632

Reply via email to