Search in sources :

Example 11 with Timer

use of org.apache.jena.atlas.lib.Timer in project jena by apache.

the class TDBLoader method loadModel.

/**
 * Load the contents of a list of URLs into a model - may not be as efficient as bulk loading into a TDB graph
 */
public static void loadModel(Model model, List<String> urls, boolean showProgress) {
    Timer timer = new Timer();
    timer.startTimer();
    for (String s : urls) {
        if (showProgress)
            System.out.printf("Load: %s\n", s);
        loadModel(model, s, showProgress);
    }
    long time = timer.endTimer();
    if (showProgress)
        System.out.printf("Time for load: %.2fs\n", time / 1000.0);
    model.close();
}
Also used : Timer(org.apache.jena.atlas.lib.Timer)

Example 12 with Timer

use of org.apache.jena.atlas.lib.Timer in project jena by apache.

the class BuilderSecondaryIndexesSequential method createSecondaryIndexes.

// Create each secondary indexes, doing one at a time.
@Override
public void createSecondaryIndexes(TupleIndex primaryIndex, TupleIndex[] secondaryIndexes) {
    Timer timer = new Timer();
    timer.startTimer();
    for (TupleIndex index : secondaryIndexes) {
        if (index != null) {
            long time1 = timer.readTimer();
            LoaderNodeTupleTable.copyIndex(primaryIndex.all(), new TupleIndex[] { index }, index.getMappingStr(), monitor);
            long time2 = timer.readTimer();
        // if ( printTiming )
        // printf("Time for %s indexing: %.2fs\n", index.getLabel(), (time2-time1)/1000.0) ;
        // if ( printTiming )
        // printer.println() ;
        }
    }
}
Also used : Timer(org.apache.jena.atlas.lib.Timer) TupleIndex(org.apache.jena.tdb.store.tupletable.TupleIndex)

Example 13 with Timer

use of org.apache.jena.atlas.lib.Timer in project jena by apache.

the class QueryIteratorTiming method start.

private void start() {
    if (timer == null) {
        timer = new Timer();
        timer.startTimer();
        milliseconds = NotFinished;
    }
}
Also used : Timer(org.apache.jena.atlas.lib.Timer)

Example 14 with Timer

use of org.apache.jena.atlas.lib.Timer in project jena by apache.

the class GraphLoadMonitor method resetTimer.

public void resetTimer() {
    if (timer != null)
        timer.endTimer();
    timer = new Timer();
    timer.startTimer();
}
Also used : Timer(org.apache.jena.atlas.lib.Timer)

Example 15 with Timer

use of org.apache.jena.atlas.lib.Timer in project jena by apache.

the class ProcBuildIndexX method exec.

// Sort and build.
// K1="-k 1,1"
// K2="-k 2,2"
// K3="-k 3,3"
// K4="-k 4,4"
// 
// generate_index "$K1 $K2 $K3" "$DATA_TRIPLES" SPO
// generate_index "$K2 $K3 $K1" "$DATA_TRIPLES" POS
// generate_index "$K3 $K1 $K2" "$DATA_TRIPLES" OSP
// generate_index "$K1 $K2 $K3 $K4" "$DATA_QUADS" GSPO
// generate_index "$K1 $K3 $K4 $K2" "$DATA_QUADS" GPOS
// generate_index "$K1 $K4 $K2 $K3" "$DATA_QUADS" GOSP
// generate_index "$K2 $K3 $K4 $K1" "$DATA_QUADS" SPOG
// generate_index "$K3 $K4 $K2 $K1" "$DATA_QUADS" POSG
// generate_index "$K4 $K2 $K3 $K1" "$DATA_QUADS" OSPG
public static void exec(String location, String indexName, int sortThreads, /*unused*/
String sortIndexArgs, XLoaderFiles loaderFiles) {
    Timer timer = new Timer();
    FmtLog.info(BulkLoaderX.LOG_Index, "Build index %s", indexName);
    timer.startTimer();
    long items = ProcBuildIndexX.exec2(location, indexName, sortThreads, sortIndexArgs, loaderFiles);
    long timeMillis = timer.endTimer();
    double xSec = timeMillis / 1000.0;
    double rate = items / xSec;
    String elapsedStr = BulkLoaderX.milliToHMS(timeMillis);
    String rateStr = BulkLoaderX.rateStr(items, timeMillis);
    FmtLog.info(BulkLoaderX.LOG_Index, "%s Index %s : %s seconds - %s at %s TPS", BulkLoaderX.StepMarker, indexName, Timer.timeStr(timeMillis), elapsedStr, rateStr);
}
Also used : Timer(org.apache.jena.atlas.lib.Timer)

Aggregations

Timer (org.apache.jena.atlas.lib.Timer)15 TupleIndex (org.apache.jena.tdb.store.tupletable.TupleIndex)2 InputStream (java.io.InputStream)1 Semaphore (java.util.concurrent.Semaphore)1 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)1 Location (org.apache.jena.dboe.base.file.Location)1 Token (org.apache.jena.riot.tokens.Token)1 Tokenizer (org.apache.jena.riot.tokens.Tokenizer)1 ProgressMonitor (org.apache.jena.system.progress.ProgressMonitor)1 Location (org.apache.jena.tdb.base.file.Location)1 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)1 NodeId (org.apache.jena.tdb.store.NodeId)1 DatasetGraphTDB (org.apache.jena.tdb2.store.DatasetGraphTDB)1