put jbigi info on logs.jsp

This commit is contained in:
zzz
2009-04-30 14:56:25 +00:00
parent 9ae4fce0db
commit c3bafcab05
2 changed files with 23 additions and 0 deletions

View File

@ -17,6 +17,8 @@
I2P <jsp:getProperty name="helper" property="version" /><br /> I2P <jsp:getProperty name="helper" property="version" /><br />
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br /> <%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br />
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.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> </p>
<hr /> <hr />
<jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" /> <jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />

View File

@ -88,6 +88,8 @@ import net.i2p.util.Log;
public class NativeBigInteger extends BigInteger { public class NativeBigInteger extends BigInteger {
/** did we load the native lib correctly? */ /** did we load the native lib correctly? */
private static boolean _nativeOk = false; 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 * do we want to dump some basic success/failure info to stderr during
* initialization? this would otherwise use the Log component, but this makes * initialization? this would otherwise use the Log component, but this makes
@ -140,6 +142,9 @@ public class NativeBigInteger extends BigInteger {
try { try {
CPUInfo c = CPUID.getInfo(); CPUInfo c = CPUID.getInfo();
try {
_cpuModel = c.getCPUModelString();
} catch (UnknownCPUException e) {}
if (c.IsC3Compatible()) if (c.IsC3Compatible())
return JBIGI_OPTIMIZATION_VIAC3; return JBIGI_OPTIMIZATION_VIAC3;
if (c instanceof AMDCPUInfo) { if (c instanceof AMDCPUInfo) {
@ -256,6 +261,20 @@ public class NativeBigInteger extends BigInteger {
return _nativeOk; 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 * <p>Compare the BigInteger.modPow/doubleValue vs the NativeBigInteger.modPow/doubleValue of some
* really big (2Kbit) numbers 100 different times and benchmark the * really big (2Kbit) numbers 100 different times and benchmark the
@ -455,12 +474,14 @@ public class NativeBigInteger extends BigInteger {
if(_doLog) if(_doLog)
System.err.println("INFO: " + s); System.err.println("INFO: " + s);
I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).info(s); I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).info(s);
_loadStatus = s;
} }
private static void warn(String s) { private static void warn(String s) {
if(_doLog) if(_doLog)
System.err.println("WARNING: " + s); System.err.println("WARNING: " + s);
I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).warn(s); I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).warn(s);
_loadStatus = s;
} }
/** /**