From 3a5347f88f0cc17d8b9f9847f6ddf64ab725d4f1 Mon Sep 17 00:00:00 2001
From: dev <dev@robertfoss.se>
Date: Wed, 8 Jun 2011 08:25:09 +0000
Subject: [PATCH] Remove doCPUID caching, to due to having to much overhead
 compared to acutally just doing the doCPUID every time.

---
 .../freenet/support/CPUInformation/CPUID.java | 46 ++++++++-----------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/core/java/src/freenet/support/CPUInformation/CPUID.java b/core/java/src/freenet/support/CPUInformation/CPUID.java
index 6c45786769..c4fc862adb 100644
--- a/core/java/src/freenet/support/CPUInformation/CPUID.java
+++ b/core/java/src/freenet/support/CPUInformation/CPUID.java
@@ -56,7 +56,6 @@ public class CPUID {
     private static final boolean isFreebsd = System.getProperty("os.name").toLowerCase().contains("freebsd");
     private static final boolean isSunos = System.getProperty("os.name").toLowerCase().contains("sunos");
     
-	private static final HashMap<Integer,CPUIDResult> cpuidCache = new HashMap<Integer,CPUIDResult>();	
 
     /**
      * This isn't always correct.
@@ -98,21 +97,10 @@ public class CPUID {
      */
     private static native CPUIDResult doCPUID(int iFunction);
 
-	private static CPUIDResult cachedCPUID(int iFunction)
-	{
-		CPUIDResult cachedCPUID = cpuidCache.get(iFunction);
-		if (cachedCPUID != null)
-			return cachedCPUID;
-		else {
-			CPUIDResult c = doCPUID(iFunction);
-			cpuidCache.put(iFunction,c);
-			return c;
-		}
-	}
 
     private static String getCPUVendorID()
     {
-        CPUIDResult c = cachedCPUID(0);
+        CPUIDResult c = doCPUID(0);
         StringBuilder sb= new StringBuilder(13);
         sb.append((char)( c.EBX        & 0xFF));
         sb.append((char)((c.EBX >> 8)  & 0xFF));
@@ -133,54 +121,58 @@ public class CPUID {
     }
     private static int getCPUFamily()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return (c.EAX >> 8) & 0xf;
     }
     private static int getCPUModel()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return (c.EAX >> 4) & 0xf;
     }
     private static int getCPUExtendedModel()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return (c.EAX >> 16) & 0xf;
     }
     private static int getCPUType()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return (c.EAX >> 12) & 0xf;
     }
     private static int getCPUExtendedFamily()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return (c.EAX >> 20) & 0xff;
     }
     private static int getCPUStepping()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return c.EAX & 0xf;
     }
     private static int getEDXCPUFlags()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return c.EDX;
     }
     private static int getECXCPUFlags()
     {
-        CPUIDResult c = cachedCPUID(1);
+        CPUIDResult c = doCPUID(1);
         return c.ECX;
     }
-    private static int getExtendedEDXCPUFlags()
-    {
-        CPUIDResult c = cachedCPUID(0x80000001);
-        return c.EDX;
-    }
+	private static int getExtendedEBXCPUFlags()
+{
+
+
     private static int getExtendedECXCPUFlags()
     {
-        CPUIDResult c = cachedCPUID(0x80000001);
+        CPUIDResult c = doCPUID(0x80000001);
         return c.ECX;
     }
+    private static int getExtendedEDXCPUFlags()
+    {
+        CPUIDResult c = doCPUID(0x80000001);
+        return c.EDX;
+    }
     
     //Returns a CPUInfo item for the current type of CPU
     //If I could I would declare this method in a interface named
-- 
GitLab