From c3bafcab05e26a47ceb441df505c2f0877ffcae9 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 30 Apr 2009 14:56:25 +0000
Subject: [PATCH] put jbigi info on logs.jsp

---
 apps/routerconsole/jsp/logs.jsp               |  2 ++
 .../src/net/i2p/util/NativeBigInteger.java    | 21 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/apps/routerconsole/jsp/logs.jsp b/apps/routerconsole/jsp/logs.jsp
index a102912488..dbaca04033 100644
--- a/apps/routerconsole/jsp/logs.jsp
+++ b/apps/routerconsole/jsp/logs.jsp
@@ -17,6 +17,8 @@
 I2P <jsp:getProperty name="helper" property="version" /><br />
 <%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br />
 <%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%><br />
+CPU <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)<br />
+jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%><br />
  </p>
  <hr />
  <jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />
diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java
index 970de52c85..a6d7e97925 100644
--- a/core/java/src/net/i2p/util/NativeBigInteger.java
+++ b/core/java/src/net/i2p/util/NativeBigInteger.java
@@ -88,6 +88,8 @@ import net.i2p.util.Log;
 public class NativeBigInteger extends BigInteger {
     /** did we load the native lib correctly? */
     private static boolean _nativeOk = false;
+    private static String _loadStatus = "uninitialized";
+    private static String _cpuModel = "uninitialized";
     /** 
      * do we want to dump some basic success/failure info to stderr during 
      * initialization?  this would otherwise use the Log component, but this makes
@@ -140,6 +142,9 @@ public class NativeBigInteger extends BigInteger {
         
         try {
             CPUInfo c = CPUID.getInfo();
+            try {
+                _cpuModel = c.getCPUModelString();
+            } catch (UnknownCPUException e) {}
             if (c.IsC3Compatible())
                 return JBIGI_OPTIMIZATION_VIAC3;
             if (c instanceof AMDCPUInfo) {
@@ -256,6 +261,20 @@ public class NativeBigInteger extends BigInteger {
         return _nativeOk;
     }
  
+    public static String loadStatus() {
+        return _loadStatus;
+    }
+ 
+    public static String cpuType() {
+        if (sCPUType != null)
+            return sCPUType;
+        return "unrecognized";
+    }
+ 
+    public static String cpuModel() {
+        return _cpuModel;
+    }
+ 
     /**
      * <p>Compare the BigInteger.modPow/doubleValue vs the NativeBigInteger.modPow/doubleValue of some 
      * really big (2Kbit) numbers 100 different times and benchmark the 
@@ -455,12 +474,14 @@ public class NativeBigInteger extends BigInteger {
         if(_doLog)
             System.err.println("INFO: " + s);
         I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).info(s);
+        _loadStatus = s;
     }
 
     private static void warn(String s) {
         if(_doLog)
             System.err.println("WARNING: " + s);
         I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).warn(s);
+        _loadStatus = s;
     }
 
     /** 
-- 
GitLab