eina: make it possible to force the number of detected CPU as way to overcome local...
authorcedric <cedric>
Thu, 19 Apr 2012 09:25:54 +0000 (09:25 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 Apr 2012 09:25:54 +0000 (09:25 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@70328 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/eina_cpu.c
src/lib/eina_main.c
src/lib/eina_private.h

index d268b00..b1e1209 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * Add missing API eina_file_map_faulted() on Windows. Does nothing
        for now.
+
+2012-04-19  Cedric Bail
+
+       * Make it possible to force the number of detected CPU on a system.
diff --git a/NEWS b/NEWS
index dd89e35..530c022 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ Fixes:
     * forgotten initialization of eina list count during eina_list_split_list.
     * leak in Eina_File.
     * deadlock in Eina_File.
+    * make it possible to force the number of detected CPU on a system.
 
 Improvements:
 
index 5b190e4..d0e1b91 100644 (file)
@@ -130,7 +130,10 @@ EAPI Eina_Cpu_Features eina_cpu_features_get(void)
    return ecf;
 }
 
-EAPI int eina_cpu_count(void)
+static int _cpu_count = -1;
+
+static int
+_eina_cpu_count_internal(void)
 {
 #ifdef EFL_HAVE_THREADS
 
@@ -205,3 +208,16 @@ EAPI int eina_cpu_count(void)
    return 1;
 #endif
 }
+
+EAPI int eina_cpu_count(void)
+{
+   return _cpu_count;
+}
+
+void eina_cpu_count_internal(void)
+{
+   if (getenv("EINA_CPU_FAKE"))
+     _cpu_count = atoi(getenv("EINA_CPU_FAKE"));
+   else
+     _cpu_count = _eina_cpu_count_internal();
+}
index f890058..5cf77e7 100644 (file)
@@ -298,6 +298,8 @@ eina_init(void)
           }
      }
 
+   eina_cpu_count_internal();
+
    _eina_main_count = 1;
    return 1;
 }
index 49df565..255959b 100644 (file)
@@ -142,6 +142,8 @@ void eina_log_threads_init(void);
 void eina_log_threads_shutdown(void);
 #endif
 
+void eina_cpu_count_internal(void);
+
 void eina_file_mmap_faulty(void *addr, long page_size);
 
 #endif /* EINA_PRIVATE_H_ */