[babl] babl: reduce amount of instrumentation



commit 49275e3e2ac402daa19a22a779c0556032b4a778
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Jan 15 14:21:59 2018 +0100

    babl: reduce amount of instrumentation
    
    The integer counter for number of processings overflows in some scenarios, thus
    cannot be relied on for more than being informative.
    
    We might ultimately want to also drop the instrumentation.

 babl/babl-cache.c          |   12 ++----------
 babl/babl-conversion.c     |    5 -----
 babl/babl-conversion.h     |    1 -
 babl/babl-fish-path.c      |    3 ---
 babl/babl-fish-reference.c |    1 -
 babl/babl-fish-simple.c    |    1 -
 babl/babl-fish.h           |   10 +++-------
 babl/babl-format.c         |    2 --
 babl/babl-internal.h       |    1 -
 babl/babl-introspect.c     |    6 ++----
 babl/babl-model.c          |    2 --
 babl/babl-type.c           |    2 --
 12 files changed, 7 insertions(+), 39 deletions(-)
---
diff --git a/babl/babl-cache.c b/babl/babl-cache.c
index dcc76f4..75780b5 100644
--- a/babl/babl-cache.c
+++ b/babl/babl-cache.c
@@ -119,9 +119,6 @@ babl_fish_serialize (Babl *fish, char *dest, int n)
   snprintf (d, n, "\tpixels=%li", fish->fish.pixels);
   n -= strlen (d);d += strlen (d);
 
-  snprintf (d, n, " processings=%i", fish->fish.processings);
-  n -= strlen (d);d += strlen (d);
-
   snprintf (d, n, " cost=%d", (int)fish->fish_path.cost);
   n -= strlen (d);d += strlen (d);
 
@@ -145,8 +142,7 @@ static int compare_fish_pixels (const void *a, const void *b)
 {
   const Babl **fa = (void*)a;
   const Babl **fb = (void*)b;
-  return ((*fb)->fish.pixels - (*fa)->fish.pixels) +
-         ((*fb)->fish.processings - (*fa)->fish.processings);
+  return ((*fb)->fish.pixels - (*fa)->fish.pixels);
 }
 
 static const char *cache_header (void)
@@ -240,7 +236,7 @@ void babl_init_db (void)
         case '-': /* finalize */
           if (babl)
           {
-            if (((babl->fish.pixels + babl->fish.processings) % 100) == (tim % 100))
+            if ((babl->fish.pixels) == (tim % 100))
             {
               /* 1% chance of individual cached conversions being dropped -
                * making sure mis-measured conversions do not
@@ -309,10 +305,6 @@ void babl_init_db (void)
               {
                 babl->fish.pixels = strtol (token2 + 7, NULL, 10);
               }
-              else if (!strncmp (token2, "processings=", 12))
-              {
-                babl->fish.processings = strtol (token2 + 12, NULL, 10);
-              }
               token2 = strtok_r (NULL, seps2, &tokp2);
             }
           }
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 78a5f1f..8add99a 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -219,7 +219,6 @@ _conversion_new (const char    *name,
   babl->conversion.cost        = 69L;
 
   babl->conversion.pixels      = 0;
-  babl->conversion.processings = 0;
 
   babl->conversion.data = user_data;
 
@@ -511,10 +510,6 @@ babl_conversion_error (BablConversion *conversion)
                               ref_destination_rgba_double,
                               test_pixels * 4);
 
-  fish_rgba_to_source->fish.processings--;
-  fish_reference->fish.processings--;
-  fish_destination_to_rgba->fish.processings -= 2;
-
   fish_rgba_to_source->fish.pixels      -= test_pixels;
   fish_reference->fish.pixels           -= test_pixels;
   fish_destination_to_rgba->fish.pixels -= 2 * test_pixels;
diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h
index f373e38..023625a 100644
--- a/babl/babl-conversion.h
+++ b/babl/babl-conversion.h
@@ -54,7 +54,6 @@ _BablConversion {
       BablFuncPlane      plane;
       BablFuncPlanar     planar;
     } function;
-  int                    processings;
   long                   pixels;
 };
 
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index d384e1c..19d7f14 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -536,7 +536,6 @@ babl_fish_path2 (const Babl *source,
   strcpy (babl->instance.name, name);
   babl->fish.source               = source;
   babl->fish.destination          = destination;
-  babl->fish.processings          = 0;
   babl->fish.pixels               = 0;
   babl->fish.error                = BABL_MAX_COST_VALUE;
   babl->fish_path.cost            = BABL_MAX_COST_VALUE;
@@ -736,7 +735,6 @@ _babl_process (const Babl *cbabl,
                long        n)
 {
   Babl *babl = (void*)cbabl;
-  babl->fish.processings++;
   babl->fish.pixels += n;
   babl->fish.dispatch (babl, source, destination, n, *babl->fish.data);
   return n;
@@ -770,7 +768,6 @@ babl_process_rows (const Babl *fish,
   if (n <= 0)
     return 0;
 
-  babl->fish.processings++;
   babl->fish.pixels += n * rows;
   for (row = 0; row < rows; row++)
     {
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index 695c3ca..54ca110 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -134,7 +134,6 @@ babl_fish_reference (const Babl *source,
   babl->fish.source      = source;
   babl->fish.destination = destination;
 
-  babl->fish.processings = 0;
   babl->fish.pixels      = 0;
   babl->fish.error       = 0.0;  /* assuming the provided reference conversions for types
                                     and models are as exact as possible
diff --git a/babl/babl-fish-simple.c b/babl/babl-fish-simple.c
index 1fa3384..a6a3730 100644
--- a/babl/babl-fish-simple.c
+++ b/babl/babl-fish-simple.c
@@ -51,7 +51,6 @@ babl_fish_simple (BablConversion *conversion)
   babl->fish.source      = conversion->source;
   babl->fish.destination = conversion->destination;
 
-  babl->fish.processings       = 0;
   babl->fish.pixels            = 0;
   babl->fish_simple.conversion = conversion;
   babl->fish.error             = 0.0;/* babl fish simple should only be used by bablfish
diff --git a/babl/babl-fish.h b/babl/babl-fish.h
index a73a358..a26a032 100644
--- a/babl/babl-fish.h
+++ b/babl/babl-fish.h
@@ -33,19 +33,15 @@ typedef struct
   const Babl     *destination;
   void           (*dispatch) (const Babl *babl, const char *src, char *dst, long n, void *data);
   void          **data;      /* user data - only used for conversion redirect  */
+  long            pixels;      /* number of pixels translates */
   double          error;    /* the amount of noise introduced by the fish */
-
   /* instrumentation */
-  int             processings; /* number of times the fish has been used */
-  long            pixels;      /* number of pixels translates */
-  long            usecs;       /* usecs spent within this fish */
 } BablFish;
 
 /* BablFishSimple is the simplest type of fish, wrapping a single
  * conversion function, (note this might not be the optimal chosen
- * conversion even if it exists)
- *
- * TODO: exterminate
+ * conversion even if it exists), these fishes are used internally for
+ * instance in reference fishes.
  */
 typedef struct
 {
diff --git a/babl/babl-format.c b/babl/babl-format.c
index 45c62b2..1db5f02 100644
--- a/babl/babl-format.c
+++ b/babl/babl-format.c
@@ -643,8 +643,6 @@ babl_format_loss (const Babl *babl)
 
   loss = babl_rel_avg_error (clipped, test, test_pixels * 4);
 
-  fish_to->fish.processings   -= 2;
-  fish_from->fish.processings -= 2;
   fish_to->fish.pixels        -= test_pixels * 2;
   fish_from->fish.pixels      -= test_pixels * 2;
 
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 9d29b47..ff83795 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -491,7 +491,6 @@ babl_conversion_process (const Babl *babl,
                          long        n)
 {
   BablConversion *conversion = (BablConversion *) babl;
-  conversion->processings++;
   conversion->pixels += n;
   conversion->dispatch (babl, source, destination, n, conversion->data);
 }
diff --git a/babl/babl-introspect.c b/babl/babl-introspect.c
index 03cfef1..5d0cb9d 100644
--- a/babl/babl-introspect.c
+++ b/babl/babl-introspect.c
@@ -166,8 +166,7 @@ format_introspect (Babl *babl)
 static void
 conversion_introspect (Babl *babl)
 {
-  babl_log ("\t\tprocessings:%i pixels:%li",
-            babl->conversion.processings, babl->conversion.pixels);
+  babl_log ("\t\tpixels:%li", babl->conversion.pixels);
   if (BABL (babl->conversion.source)->class_type == BABL_FORMAT)
     {
       babl_log ("\t\terror: %f", babl_conversion_error (&babl->conversion));
@@ -177,8 +176,7 @@ conversion_introspect (Babl *babl)
 static void
 fish_introspect (Babl *babl)
 {
-  babl_log ("\t\tprocessings:%i pixels:%li",
-            babl->fish.processings, babl->fish.pixels);
+  babl_log ("\t\tpixels:%li", babl->fish.pixels);
 }
 
 static void
diff --git a/babl/babl-model.c b/babl/babl-model.c
index d553aca..2156059 100644
--- a/babl/babl-model.c
+++ b/babl/babl-model.c
@@ -315,8 +315,6 @@ babl_model_is_symmetric (const Babl *cbabl)
   babl_process (fish_to, clipped, destination, test_pixels);
   babl_process (fish_from, destination, transformed, test_pixels);
 
-  fish_to->fish.processings   -= 2;
-  fish_from->fish.processings -= 2;
   fish_to->fish.pixels        -= test_pixels * 2;
   fish_from->fish.pixels      -= test_pixels * 2;
 
diff --git a/babl/babl-type.c b/babl/babl-type.c
index f99c9d1..86b1a3f 100644
--- a/babl/babl-type.c
+++ b/babl/babl-type.c
@@ -209,8 +209,6 @@ babl_type_is_symmetric (const Babl *babl)
   babl_process (fish_to, clipped, destination, samples);
   babl_process (fish_from, destination, transformed, samples);
 
-  fish_from->fish.processings -= 2;
-  fish_to->fish.processings   -= 2;
   fish_from->fish.pixels      -= samples * 2;
   fish_to->fish.pixels        -= samples * 2;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]