当前位置: 首页>>代码示例>>Java>>正文


Java ProgressLogger.start方法代码示例

本文整理汇总了Java中it.unimi.dsi.logging.ProgressLogger.start方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressLogger.start方法的具体用法?Java ProgressLogger.start怎么用?Java ProgressLogger.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.logging.ProgressLogger的用法示例。


在下文中一共展示了ProgressLogger.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
@Override
public Void call() throws Exception {
	final ProgressLogger pl = new ProgressLogger(LOGGER, 1, TimeUnit.MINUTES, "records");

	pl.itemsName = "records";
	pl.displayFreeMemory = true;
	pl.displayLocalSpeed = true;
	pl.start("Scanning...");

	try {
		for(;;) {
			final Result<?>[] result = queue.take();
			if (result == Result.END_OF_RESULTS) {
				pl.done();
				return null;
			}
			for (final Result<?> r : result) if (r != null) r.write();
			pl.lightUpdate();
		}
	}
	catch(final Exception e) {
		LOGGER.error("Exception in flushing thread", e);
		throw e;
	}
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:26,代码来源:ParallelFilteredProcessorRunner.java

示例2: main

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public static void main(String[] arg) throws IOException, JSAPException {
	final SimpleJSAP jsap = new SimpleJSAP(GZIPIndexer.class.getName(), "Computes and stores a quasi-succinct index for a compressed archive.",
			new Parameter[] {
				new UnflaggedOption("archive", JSAP.STRING_PARSER, JSAP.REQUIRED, "The name a GZIP's archive."),
				new UnflaggedOption("index", JSAP.STRING_PARSER, JSAP.REQUIRED, "The output (a serialized LongBigList of pointers to the records in the archive) filename."),
			}
	);

	final JSAPResult jsapResult = jsap.parse(arg);
	if (jsap.messagePrinted()) return;

	final FastBufferedInputStream input = new FastBufferedInputStream(new FileInputStream(jsapResult.getString("archive")));
	ProgressLogger pl = new ProgressLogger(LOGGER, 1, TimeUnit.MINUTES, "records");
	pl.start("Scanning...");
	final EliasFanoMonotoneLongBigList list = new EliasFanoMonotoneLongBigList(index(input, pl));
	pl.done();
	BinIO.storeObject(list, jsapResult.getString("index"));
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:19,代码来源:GZIPIndexer.java

示例3: invert

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Map invert(Map inputMap) throws InstantiationException,
		IllegalAccessException, InvocationTargetException,
		NoSuchMethodException, ClassNotFoundException {
	LOGGER.info("Inverting map...");
	Map outputMap = (Map) invertMapType(inputMap.getClass()).getConstructor(new Class[] {}).newInstance(new Object[] {});
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "entries");
	pl.expectedUpdates = inputMap.size();
	pl.start();
	
	for (Object entryObj : inputMap.entrySet()) {
		Map.Entry entry = (Map.Entry) entryObj;
		Object oldValue = outputMap.put(entry.getValue(), entry.getKey());
		if (oldValue != null)
			throw new IllegalArgumentException(
					"The value " + entry.getValue() + " is associated to both '" +
					oldValue + "' and '" + entry.getKey() + "'. The map is not" +
					"bijective"
			);
		pl.lightUpdate();
	}
	pl.done();
	return outputMap;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:26,代码来源:MapUtils.java

示例4: computeNExperiments

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public ClassifierResults[] computeNExperiments(final int nExperiments, final int nSamples) {
	final ClassifierResults[] allResults = new ClassifierResults[nExperiments];
	ProgressLogger pl = new ProgressLogger(LOGGER, "experiments");
	pl.expectedUpdates = nExperiments;
	pl.start("Beginning experiments...");
	
	for (int iExperiment = 0; iExperiment < nExperiments; iExperiment++) {
		if (verbose) LOGGER.info("Starting experiment #" + (iExperiment+1) + "...");
		ClassifierResults experimentResult = computeOneExperiment(createTestingSet(nSamples));
		if (verbose) LOGGER.info("Results for experiment #" + (iExperiment+1) + ":\n\n" + experimentResult + "\n");
		allResults[iExperiment] = experimentResult;
		
		pl.update();
	}
	pl.done();
	
	return allResults;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:19,代码来源:TestMatrix.java

示例5: computeStatistics

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public static SummaryStatistics computeStatistics(UnexpectednessScorer scorer) {
	int numNodes = scorer.graph.numNodes();
	SummaryStatistics stats = new SummaryStatistics();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "docs");
	pl.expectedUpdates = numNodes;
	pl.start("Finding statistics for values of " + scorer + "...");

	for (int i = 0; i < numNodes; i++) {
		for (double x : scorer.scores(i).values()) {
			stats.addValue(x);
			if (Double.isInfinite(x) || Double.isNaN(x))
				throw new ArithmeticException(
						"Scorer " + scorer + " has returned value "
						+ x + " for a result of document " + i);
		}
		pl.lightUpdate();
	}
	pl.done();
	
	return stats;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:23,代码来源:ScorerStatisticsSummarizer.java

示例6: computeApproxStatistics

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public static SummaryStatistics computeApproxStatistics(UnexpectednessScorer scorer) {
	int numNodes = scorer.graph.numNodes();
	int sampleSize = 10000;
	if (sampleSize > numNodes) sampleSize = numNodes;

	SummaryStatistics stats = new SummaryStatistics();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "docs");
	pl.expectedUpdates = sampleSize;
	pl.start("Finding statistics for values of " + scorer + " (sample of "+sampleSize+")...");

	for (int i: RandomSingleton.get().ints(sampleSize, 0, numNodes).toArray()) {
		for (double x : scorer.scores(i).values()) {
			stats.addValue(x);
			if (Double.isInfinite(x) || Double.isNaN(x))
				throw new ArithmeticException(
						"Scorer " + scorer + " has returned value "
						+ x + " for a results of document " + i);
		}
		pl.lightUpdate();
	}
	pl.done();
	
	LOGGER.info(scorer + " -- sample of " + numNodes + " -- " +  stats.toString());
	return stats;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:27,代码来源:ScorerStatisticsSummarizer.java

示例7: run

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public static void run( final FastBufferedReader fbr, final DataOutputStream dos, ProgressLogger pl ) throws IOException {
	final MutableString s = new MutableString();
	Object2IntOpenHashMap<MutableString> map = new Object2IntOpenHashMap<MutableString>();
	map.defaultReturnValue( -1 );
	int slash, hostIndex = -1;

	if ( pl != null ) pl.start( "Reading URLS..." );
	while( fbr.readLine( s ) != null ) {
		slash = s.indexOf( '/', 8 );
		// Fix for non-BURL URLs
		if ( slash != -1 ) s.length( slash );
		if ( ( hostIndex = map.getInt( s ) ) == -1 ) map.put( s.copy(), hostIndex = map.size() );
		dos.writeInt( hostIndex );
		if ( pl != null ) pl.lightUpdate();
	}
	
	if ( pl != null ) pl.done();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:19,代码来源:BuildHostMap.java

示例8: load

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
/** Creates a new immutable subgraph by loading the supergraph, delegating the 
 *  actual loading to the class specified in the <samp>supergraphclass</samp> property within the property
 *  file (named <samp><var>basename</var>.properties</samp>), and loading the subgraph array in memory.
 *  The exact load method to be used depends on the <code>method</code> argument.
 * 
 * @param method the method to be used to load the supergraph.
 * @param basename the basename of the graph.
 * @param pl the progress logger; it can be <code>null</code>.
 * @return an immutable subgraph containing the specified graph.
 */

protected static ImmutableGraph load( final LoadMethod method, final CharSequence basename, final ProgressLogger pl ) throws IOException {
	final FileInputStream propertyFile = new FileInputStream( basename + PROPERTIES_EXTENSION );
	final Properties properties = new Properties();
	properties.load( propertyFile );
	propertyFile.close();

	final String graphClassName = properties.getProperty( ImmutableGraph.GRAPHCLASS_PROPERTY_KEY );
	if ( ! graphClassName.equals( ImmutableSubgraph.class.getName() ) ) throw new IOException( "This class (" + ImmutableSubgraph.class.getName() + ") cannot load a graph stored using " + graphClassName );
	
	final String supergraphBasename = properties.getProperty( SUPERGRAPHBASENAME_PROPERTY_KEY );
	if ( supergraphBasename == null ) throw new IOException( "This property file does not specify the required property supergraphbasename" );
	
	final ImmutableGraph supergraph = ImmutableGraph.load( method, supergraphBasename, null, pl );
	
	if ( pl != null ) pl.start( "Reading nodes..." );
	final String nodes = properties.getProperty( SUBGRAPHNODES_PROPERTY_KEY );
	final ImmutableSubgraph isg = new ImmutableSubgraph( supergraph, BinIO.loadInts( nodes != null ? nodes : basename + ".nodes" ) );
	if ( pl != null ) {
		pl.count = isg.numNodes();
		pl.done();
	}
	isg.basename = new MutableString( basename );
	return isg;
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:36,代码来源:ImmutableSubgraph.java

示例9: save

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
/** Saves this immutable subgraph with a given basename. 
 * 
 * <P>Note that this method will <strong>not</strong> save the
 * supergraph, but only the subgraph files, that is, the subgraph property file
 * (with extension <samp>.properties</samp>) and the file containing
 * the subgraph nodes (with extension <samp>.nodes</samp>). A reference
 * to the supergraph basename will be stored in the property file.
 * 
 * @param basename the basename to be used to save the subgraph.
 * @param pl a progress logger, or <code>null</code>.
 */
public void save( final CharSequence basename, final ProgressLogger pl ) throws IOException {

	final Properties properties = new Properties();
	properties.setProperty( ImmutableGraph.GRAPHCLASS_PROPERTY_KEY, ImmutableSubgraph.class.getName() );
	properties.setProperty( SUPERGRAPHBASENAME_PROPERTY_KEY, supergraph.basename().toString() );

	final FileOutputStream propertyFile = new FileOutputStream( basename + PROPERTIES_EXTENSION );
	properties.store( propertyFile, null );
	propertyFile.close();
	
	// Save the subgraph nodes
	if ( pl != null ) pl.start( "Saving nodes..." );
	BinIO.storeInts( subgraphNode, 0, subgraphNode.length, basename + ".nodes" );
	
	if ( pl != null ) {
		pl.count = subgraphNode.length;
		pl.done();
	}
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:31,代码来源:ImmutableSubgraph.java

示例10: main

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException, IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
	SimpleJSAP jsap = new SimpleJSAP( ExactNeighbourhoodFunction.class.getName(), "Prints the neighbourhood function.",
		new Parameter[] {
			new Switch( "spec", 's', "spec", "The source is not a basename but rather a specification of the form <ImmutableGraphImplementation>(arg,arg,...)." ),
			new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
		}		
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	final boolean spec = jsapResult.getBoolean( "spec" );
	final String basename = jsapResult.getString( "basename" );
	final ProgressLogger pl = new ProgressLogger( LOGGER );
	
	final ImmutableGraph graph = spec ? ObjectParser.fromSpec( basename, ImmutableGraph.class, GraphClassParser.PACKAGE ) : ImmutableGraph.loadOffline( basename );
	
	final ExactNeighbourhoodFunction neighbourhoodFunction = new ExactNeighbourhoodFunction( graph, pl );
	pl.start( "Computing..." );
	TextIO.storeDoubles( neighbourhoodFunction.neighbourhoodFunction(), System.out );
	pl.done();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:23,代码来源:ExactNeighbourhoodFunction.java

示例11: main

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public static void main(String[] arg) throws IOException {
	if (arg.length == 0) {
		System.err.println("Usage: " + BuildRepetitionSet.class.getSimpleName() + " REPETITIONSET");
		System.exit(1);
	}

	final FastBufferedReader fastBufferedReader = new FastBufferedReader(new InputStreamReader(System.in, Charsets.US_ASCII));
	final MutableString s = new MutableString();
	final LongOpenHashSet repeatedSet = new LongOpenHashSet();
	final String outputFilename = arg[0];
	final ProgressLogger pl = new ProgressLogger();

	MutableString lastUrl = new MutableString();
	pl.itemsName = "lines";
	pl.start("Reading... ");
	while(fastBufferedReader.readLine(s) != null) {
		final int firstTab = s.indexOf('\t');
		final int secondTab = s.indexOf('\t', firstTab + 1);
		MutableString url = s.substring(secondTab + 1);
		if (url.equals(lastUrl)) {
			final int storeIndex = Integer.parseInt(new String(s.array(), 0, firstTab));
			final long storePosition = Long.parseLong(new String(s.array(), firstTab + 1, secondTab - firstTab - 1));
			repeatedSet.add((long)storeIndex << 48 | storePosition);
			System.out.print(storeIndex);
			System.out.print('\t');
			System.out.print(storePosition);
			System.out.print('\t');
			System.out.println(url);
		}

		lastUrl = url;
		pl.lightUpdate();
	}

	pl.done();

	fastBufferedReader.close();
	BinIO.storeObject(repeatedSet, outputFilename);
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:40,代码来源:BuildRepetitionSet.java

示例12: writeRecords

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
@SuppressWarnings("resource")
public static int[] writeRecords(final String path, final int numRecords, final WarcRecord[] randomRecords, final int parallel) throws IOException, InterruptedException {
	final ProgressLogger pl = new ProgressLogger(LOGGER, "records");
	if (parallel <= 1) pl.expectedUpdates = numRecords;
	final ProgressLogger plb = new ProgressLogger(LOGGER, "KB");
	final CountingOutputStream cos = new CountingOutputStream(new FastBufferedOutputStream(new FileOutputStream (path)));
	final WarcWriter ww;
	if (parallel == 0) {
		ww = new UncompressedWarcWriter(cos);
		pl.start("Writing records…");
	} else if (parallel == 1) {
		ww = new CompressedWarcWriter(cos);
		pl.start("Writing records (compressed)…");
	} else {
		ww = null;
		pl.start("SHOULD NOT HAPPEN");
		throw new IllegalStateException();
	}
	plb.start();
	long written = 0;
	final int[] position = new int[numRecords];
	for (int i = 0; i < numRecords; i++) {
		final int pos = RandomTestMocks.RNG.nextInt(randomRecords.length);
		position[i] = pos;
		ww.write(randomRecords[pos]);
		if (parallel <= 0) {
			pl.lightUpdate();
			plb.update((cos.getCount() - written) / 1024);
		}
		written = cos.getCount();
	}
	ww.close();
	pl.done(numRecords);
	plb.done(cos.getCount());
	return position;
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:37,代码来源:RandomReadWritesTest.java

示例13: toMatrixMarketFormat

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public void toMatrixMarketFormat(Writer writer) throws IOException {
	writer.write("%%MatrixMarket matrix coordinate real general\n");
	
	int entriesToWrite = numberOfNonZeroEntries();
	
	if (entriesToWrite == 0)
		throw new RuntimeException("Empty matrix. Aborting Matrix Market export.");
	
	int size = computeSize();
	
	writer.write(size + " " + size + " " + entriesToWrite + "\n");
	
	ObjectIterator<Element> elements = entries();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "elements");
	pl.expectedUpdates = entriesToWrite;
	pl.start("Exporting matrix to Matrix Market format...");
	
	while (elements.hasNext()) {
			Element e = elements.next();
			if (e.value != 0) {
				writer.write((e.i+1) + " " + (e.j+1) + " " + e.value + "\n");
				entriesToWrite--;
				pl.lightUpdate();
			}
		}
	
	pl.done();
		
	if (entriesToWrite != 0)
		throw new IllegalStateException();
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:33,代码来源:Matrix.java

示例14: computeAll

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public SummaryStatistics[] computeAll() {
	SummaryStatistics[] results = new SummaryStatistics[retrievers.length];
	for (int i = 0; i < retrievers.length; i++)
		results[i] = new SummaryStatistics();
	
	IntSet queries = groundtruth.queriesWithRelevantDocs();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "query retrievals");
	pl.expectedUpdates = queries.size() * retrievers.length;
	pl.start("Computing results for each of the " + queries.size() + 
			" queries and "+retrievers.length+ " retrieving algorithms..."  );
	
	for (int query : queries) {
		for (int i = 0; i < retrievers.length; i++) {
			double value = computeForQuery(query, retrievers[i]);
			if (Double.isNaN(value))
				continue;
			results[i].addValue(value);
			pl.update();
		}
	}
	
	pl.done();
	
	long nItems = results[0].getN();
	for (SummaryStatistics s : results)
		if (s.getN() != nItems)
			throw new IllegalStateException("The measure returned NaN differently for different algorithms.");
	
	print(retrievers, results);
	
	return results;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:34,代码来源:AbstractMeasure.java

示例15: checkAll

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public void checkAll() {
	ProgressLogger pl = new ProgressLogger(LOGGER, "queries");
	pl.expectedUpdates = evaluations.queries().size();
	pl.start("Checking every query in dataset...");
	
	for (int node : evaluations.queries()) {
		check(node);
		pl.update();
	}
	pl.done();
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:12,代码来源:PooledDatasetChecker.java


注:本文中的it.unimi.dsi.logging.ProgressLogger.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。