当前位置 : 主页 > 编程语言 > c++ >

java做一个简单的内存检测工具,面对无ECC功能的内存进行测试

来源:互联网 收集:自由互联 发布时间:2021-06-30
Java_test.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package MEM_ECC;//syslibimport java.util.*;//
Java_test.java
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package MEM_ECC;
//syslib
import java.util.*;

//mylib

/**
 *
 * @author avatu
 */


public class Java_test {

    public static void main(String[] args) {
	// write your code here
       final long initSeed=1L;
       final long initGap=3L;
       final int initVol=1024*1024*100;//不要设的太小避免MAXLEN超过int.maxVal
      
       final long MB=1048576L;
       
       final long dataUnitSize=((long)initVol)*8L;
       System.out.println("DataUnitSize:"+dataUnitSize+"Bytes");
       final long freeMem=getFreeMem();
       System.out.println("FreeVMsize:"+freeMem+"Bytes");
       int MAXLEN=(int)(freeMem/dataUnitSize);
       System.out.println("Total Dataunit count:"+MAXLEN);
       
       MAXLEN=MAXLEN-3;
       System.out.println("final Data unit count:"+MAXLEN);
       
        long[] initData=dataItemBuilder_long(initSeed,initGap,initVol);
//init Test object:


/*
        Hashtable testObj=new Hashtable();
        for(long i=0;i
 

  
   Java_test2.java
  

  
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package MEM_ECC;
//syslib
import java.util.*;

//mylib

/**
 *
 * @author avatu
 */


public class Java_test {

    public static void main(String[] args) {
	// write your code here
       final long initSeed=1L;
       final long initGap=3L;
       final int initVol=1024*1024*100;//不要设的太小避免MAXLEN超过int.maxVal
      
       final long MB=1048576L;
       
       final long dataUnitSize=((long)initVol)*8L;
       System.out.println("DataUnitSize:"+dataUnitSize+"Bytes");
       final long freeMem=getFreeMem();
       System.out.println("FreeVMsize:"+freeMem+"Bytes");
       int MAXLEN=(int)(freeMem/dataUnitSize);
       System.out.println("Total Dataunit count:"+MAXLEN);
       
       MAXLEN=MAXLEN-3;
       System.out.println("final Data unit count:"+MAXLEN);
       
        long[] initData=dataItemBuilder_long(initSeed,initGap,initVol);
//init Test object:


/*
        Hashtable testObj=new Hashtable();
        for(long i=0;i
网友评论