]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/thread-private.h
(no commit message)
[imagemagick] / MagickCore / thread-private.h
index ab2578c1f97ee42b5f5988918cfec553ef8eea6e..a1310daa6a21d06ff828016ac60a8fe7eae0743e 100644 (file)
 extern "C" {
 #endif
 
+#include <MagickCore/cache.h>
+#include <MagickCore/resource_.h>
 #include <MagickCore/thread_.h>
 
-#define IsConcurrentUno(colors,threshold) \
-  if ((colors) > threshold) \
-    num_threads(GetMagickResourceLimit(ThreadResource))
-#define IsConcurrentDos(columns,rows,threshold) \
-  if (((((columns) > threshold) || ((rows) > threshold))) && \
-      ((MagickSizeType) (columns*rows) > (threshold*threshold))) \
-    num_threads(GetMagickResourceLimit(ThreadResource))
-#define IsConcurrentTres(columns,rows,expression,threshold) \
-  if (((((columns) > threshold) || ((rows) > threshold))) && \
-      ((MagickSizeType) (columns*rows) > (threshold*threshold)) && (expression)) \
+/*
+  Single threaded unless workload justifies the threading overhead.
+*/
+#define WorkloadThreshold()  (16*GetMagickResourceLimit(ThreadResource))
+#define dynamic_number_threads(image,columns,rows,expression) \
+  if (((((columns) > WorkloadThreshold()) || \
+      ((rows) > WorkloadThreshold()))) && ((MagickSizeType) \
+      ((columns)*(rows)) > (WorkloadThreshold()*WorkloadThreshold())) && \
+      (GetImagePixelCacheType(image) != DiskCache) && (expression)) \
     num_threads(GetMagickResourceLimit(ThreadResource))
 
-#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR > 10))
+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 10))
 #define MagickCachePrefetch(address,mode,locality) \
   __builtin_prefetch(address,mode,locality)
 #else