本文整理匯總了Java中com.javamex.classmexer.MemoryUtil類的典型用法代碼示例。如果您正苦於以下問題:Java MemoryUtil類的具體用法?Java MemoryUtil怎麽用?Java MemoryUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MemoryUtil類屬於com.javamex.classmexer包,在下文中一共展示了MemoryUtil類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRecordNum
import com.javamex.classmexer.MemoryUtil; //導入依賴的package包/類
private static int getRecordNum(int mb, List<Record> records) {
/**
* sum��ֵҪ����Ϊ1��������ó�0�Ļ��������ڼ������Ĵ�С��ʱ�� ���ܶ��DZȽ�С���ַ���������Instrumentation�ڼ����ַ����Ĵ�Сʱ�Ǵ�Լ��ֵ����ЩС���ַ�����������ܶ���0��
* �����������sum��ֵ����0�����sumҪ�ڳ�����λ�ã�Ϊ0�Ļ����ͻ���ֳ���0�������
*/
int sum = 1;
for (Record record : records) {
sum += MemoryUtil.deepMemoryUsageOf(record, VisibilityFilter.ALL);
}
if(records.size()==0){
return mb * 1024 * 1024 / (sum / 1);
}else{
return mb * 1024 * 1024 / (sum / records.size());
}
}
示例2: stage
import com.javamex.classmexer.MemoryUtil; //導入依賴的package包/類
/**
* The Main of the MFIBlocking Algorithm
* @param args
* The parameters are as follows:
1. Path to the lexicon file created in the previous stage (out parameter 6).
2. The dataset of item ids created in the previous stage (out parameter 2).
3. The set of min_th parameters you would like the algorithm to run on. This parameter is optional and 0 can be provided as the only parameter effectively eliminating the threshold.
4. Path to the generated match file (out parameter 3).
5. path to the debug file containing the items themselves (out parameter 7)
6. The set of min supports to use.
7. Must be set to MFI
8. The set of p parameters to use as the Neighberhood Growth constraints.
*/
public static void main(String[] args){
System.out.println("Entered Main");
String currDir = new File(".").getAbsolutePath();
System.out.println("Working dir: " + currDir);
String lexiconFile = args[0];
String recordsFile = args[1];
String minBlockingThresholds = args[2];
double[] dMinBlockingThresholds = getThresholds(minBlockingThresholds);
String matchFile = args[3];
String origRecordsFile = args[4];
int[] minSups = getInts(args[5]);
Alg alg = Alg.valueOf(args[6]);
double[] NGs = getDoubles(args[7]);
if(args.length > 8 && args[8] != null){
srcFile = args[8];
}
System.out.println("args.length : " + args.length);
System.out.println("Main srcFile : " + srcFile);
long start = System.currentTimeMillis();
//JS: Only first parameter is in use - recordsFile
Map<Integer,Record> records = Utilities.readRecords(recordsFile,origRecordsFile,srcFile);
int numOfrecords = Utilities.DB_SIZE;
System.out.println("After reading records numOfrecords=" + numOfrecords);
System.out.println("Time to read records " + (System.currentTimeMillis()-start)/1000.0 + " seconds");
System.out.println("DEBUG: Size of recods: " + MemoryUtil.deepMemoryUsageOfAll(records.values(), VisibilityFilter.ALL)/Math.pow(2,30) + " GB");
//GraphDatabaseService recordsDB = Utilities.readRecordsToDB(recordsFile,origRecordsFile,srcFile);
//int numOfrecords = records.size();
start = System.currentTimeMillis();
Utilities.parseLexiconFile(lexiconFile);
System.out.println("Time to read items (lexicon) " + (System.currentTimeMillis()-start)/1000.0 + " seconds");
System.out.println("DEBUG: Size of lexicon: " + MemoryUtil.deepMemoryUsageOfAll(Utilities.globalItemsMap.values(), VisibilityFilter.ALL)/Math.pow(2,30) + " GB");
start = System.currentTimeMillis();
mfiBlocksCore(records,matchFile,minSups,dMinBlockingThresholds,alg,NGs);
//iterativeFIsDB(records,trueClusters,minSups,dMinBlockingThresholds,alg,NGs);
System.out.println("Total time for algorithm " + (System.currentTimeMillis()-start)/1000.0 + " seconds");
}
示例3: memoryUsage
import com.javamex.classmexer.MemoryUtil; //導入依賴的package包/類
public double memoryUsage(){
return (MemoryUtil.deepMemoryUsageOfAll(allMatches.values(), VisibilityFilter.ALL)/Math.pow(2, 30));
}
示例4: mfiBlocksCore
import com.javamex.classmexer.MemoryUtil; //導入依賴的package包/類
/**
* Core of the MFIBlocks algorithm
* @param records
* @param matchFile
* @param minSups
* @param minBlockingThresholds
* @param alg
* @param NGs
*/
public static void mfiBlocksCore(Map<Integer,Record> records, String matchFile,int[] minSups,
double[] minBlockingThresholds, Alg alg, double[] NGs){
Arrays.sort(minSups);
System.out.println("order of minsups used: " + Arrays.toString(minSups));
List<BlockingRunResult> BlockingRunResults= new ArrayList<BlockingRunResult>();
for(double NG: NGs){
NG_LIMIT = NG;
for (double minBlockingThreshold : minBlockingThresholds) { // test for each minimum blocking threshold
coveredRecords = new BitSet(records.size()+1);
coveredRecords.set(0,true); // no such record
FP = 0;
numComparisons = 0;
//ResultMatrix.clearAll();
//clearTrueClusters(trueClusters);
System.out.println("running iterative " + alg.toString() + "s with minimum blocking threshold " + minBlockingThreshold +
" and NGLimit: " + NG_LIMIT);
long start = System.currentTimeMillis();
//BitMatrix resultMatrix = getClustersToUse(records,minSups,minBlockingThreshold);
CandidatePairs cps = getClustersToUse(records,minSups,minBlockingThreshold);
//getClustersToUseDB(records,minSups,minBlockingThreshold,trueClusters);
long startMaxRecall = System.currentTimeMillis();
TrueClusters trueClusters = new TrueClusters(Utilities.DB_SIZE, matchFile);
System.out.println("DEBUG: Size of trueClusters: " + MemoryUtil.deepMemoryUsageOf(trueClusters, VisibilityFilter.ALL)/Math.pow(2,30) + " GB");
//double[] results = calculateFinalResults(trueClusters.groundTruth(), resultMatrix, records.size());
double[] results = calculateFinalResults(trueClusters.groundTruthCandidatePairs(), cps, records.size());
//double[] results = calculateFinalResults(trueClusters,records,coveredRecords,records.size());
long totalMaxRecallCalculation = System.currentTimeMillis()-startMaxRecall;
BlockingRunResult blockingRR = (new BottomUp()).new BlockingRunResult(results[0],results[1],results[2],results[3],
minBlockingThreshold,lastUsedBlockingThreshold,NG_LIMIT,(double)(System.currentTimeMillis()-start-totalMaxRecallCalculation)/1000.0);
BlockingRunResults.add(blockingRR);
System.out.println("");
System.out.println("");
}
}
if(BlockingRunResults != null && BlockingRunResults.size() > 0){
String resultsString = writeBlockingRR(BlockingRunResults);
System.out.println();
System.out.println(resultsString);
}
else{
System.out.println("Under current configuration, no clustering were achienved!!");
}
}