Compare commits
38 Commits
tx_end_tim
...
2.12.1
Author | SHA1 | Date | |
---|---|---|---|
4ee2e8bc68 | |||
bdcba613d5 | |||
049de0ddaf | |||
6be3f378d4 | |||
6d8aa33fc9 | |||
b37ba9f2f1 | |||
799f083a74 | |||
156abe63cd | |||
d38016a03f | |||
5604c3ee5e | |||
5adeae15a9 | |||
bca94ceb9d | |||
a42f086339 | |||
888edf32be | |||
ee5536f1b5 | |||
59859e5d90 | |||
5bae086712 | |||
16de83616a | |||
6530362b89 | |||
0372e03abb | |||
26e8ea8a51 | |||
efd042dd22 | |||
d06642d51f | |||
f27bcd7109 | |||
eaea5a4653 | |||
fa4bd0ddd5 | |||
3cbbdbee92 | |||
d674e155e1 | |||
cb3366a559 | |||
8de0e11226 | |||
b12232329b | |||
5e63972500 | |||
d53db967b3 | |||
12b08ca8c6 | |||
bb60f3a9c8 | |||
ba347a258d | |||
ac41feff6e | |||
d2cf13d64b |
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,4 +8,5 @@ SCViewer.xcf
|
||||
SCViewer_1.png
|
||||
copyrightLog.txt
|
||||
/workspace
|
||||
?*.launch
|
||||
?*.launch
|
||||
/.settings/
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
@ -1,4 +0,0 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="json-20180813.jar" sourcepath="json-20180813-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="leveldb-0.11-SNAPSHOT-uber.jar" sourcepath="leveldb-0.11-SNAPSHOT-sources.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -1,4 +0,0 @@
|
||||
/json-20180813-sources.jar
|
||||
/leveldb-0.11-SNAPSHOT-sources.jar
|
||||
/bin/
|
||||
/target/
|
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.minres.scviewer.database.leveldb</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,7 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -1,4 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.equinox=false
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
@ -1,5 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
enabled=true
|
||||
path=OSGI-INF
|
||||
validationErrorLevel=error
|
||||
validationErrorLevel.missingImplicitUnbindMethod=error
|
@ -1,16 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Leveldb
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.leveldb
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Import-Package: org.osgi.framework;version="1.3.0"
|
||||
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
||||
Service-Component: OSGI-INF/*.xml
|
||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: leveldb-0.11-SNAPSHOT-uber.jar,
|
||||
.,
|
||||
json-20180813.jar
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="LevelDbLoader">
|
||||
<implementation class="com.minres.scviewer.database.leveldb.LevelDBLoader"/>
|
||||
<service>
|
||||
<provide interface="com.minres.scviewer.database.IWaveformDbLoader"/>
|
||||
</service>
|
||||
</scr:component>
|
@ -1,7 +0,0 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
OSGI-INF/,\
|
||||
leveldb-0.11-SNAPSHOT-uber.jar,\
|
||||
json-20180813.jar
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,13 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.database.leveldb</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.iq80.leveldb.Options;
|
||||
import org.iq80.leveldb.impl.SeekingIterator;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
||||
public class LevelDBLoader implements IWaveformDbLoader {
|
||||
|
||||
static byte[] toByteArray(String value) {
|
||||
return value.getBytes(UTF_8);
|
||||
}
|
||||
|
||||
private TxDBWrapper levelDb;
|
||||
private IWaveformDb db;
|
||||
private Long maxTime=null;
|
||||
private List<RelationType> usedRelationsList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean load(IWaveformDb db, File inp) throws Exception {
|
||||
try {
|
||||
this.db=db;
|
||||
levelDb = new TxDBWrapper(new Options(), inp);
|
||||
JSONObject configVal = new JSONObject(levelDb.get("__config"));
|
||||
if(!configVal.isEmpty())
|
||||
levelDb.setTimeResolution(configVal.getLong("resolution"));
|
||||
} catch(Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getMaxTime() {
|
||||
if(maxTime==null) {
|
||||
SeekingIterator<String, String> it = levelDb.iterator();
|
||||
it.seek("st~");
|
||||
Entry<String, String> val = null;
|
||||
while(it.hasNext()) {
|
||||
Entry<String, String> v = it.next();
|
||||
if(!v.getKey().startsWith("st~")) continue;
|
||||
val=v;
|
||||
}
|
||||
if(val==null)
|
||||
maxTime = 0L;
|
||||
else {
|
||||
String[] token = val.getKey().split("~");
|
||||
maxTime = Long.parseLong(token[2], 16)*levelDb.getTimeResolution();
|
||||
}
|
||||
}
|
||||
return maxTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IWaveform> getAllWaves() {
|
||||
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||
SeekingIterator<String, String> it = levelDb.iterator();
|
||||
it.seek("s~");
|
||||
while(it.hasNext()) {
|
||||
Entry<String, String> val = it.next();
|
||||
if(!val.getKey().startsWith("s~")) break;
|
||||
TxStream stream = new TxStream(levelDb, db, new JSONObject(val.getValue()));
|
||||
stream.setRelationTypeList(usedRelationsList);
|
||||
streams.add(stream);
|
||||
}
|
||||
return streams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<RelationType> getAllRelationTypes() {
|
||||
// return Collections.emptyList();
|
||||
return usedRelationsList;
|
||||
}
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.iq80.leveldb.shaded.guava.collect.Maps.immutableEntry;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.iq80.leveldb.DBIterator;
|
||||
import org.iq80.leveldb.impl.SeekingIterator;
|
||||
|
||||
class StringDbIterator implements SeekingIterator<String, String> {
|
||||
private final DBIterator iterator;
|
||||
|
||||
StringDbIterator(DBIterator iterator) {
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seekToFirst() {
|
||||
iterator.seekToFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void seek(String targetKey) {
|
||||
iterator.seek(targetKey.getBytes(UTF_8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<String, String> peek() {
|
||||
return adapt(iterator.peekNext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<String, String> next() {
|
||||
return adapt(iterator.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private Entry<String, String> adapt(Entry<byte[], byte[]> next) {
|
||||
return immutableEntry(new String(next.getKey(), UTF_8), new String(next.getValue(), UTF_8));
|
||||
}
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.iq80.leveldb.impl.SeekingIterator;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxGenerator;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
|
||||
public class Tx implements ITx {
|
||||
|
||||
private TxDBWrapper levelDb;
|
||||
private TxStream trStream;
|
||||
private TxGenerator trGenerator;
|
||||
private long id;
|
||||
private long start_time=0;
|
||||
private long end_time=0;
|
||||
private int concurency_index;
|
||||
private boolean initialized=false;
|
||||
private List<ITxAttribute> attributes;
|
||||
private List<ITxRelation> incoming, outgoing;
|
||||
|
||||
public Tx(TxDBWrapper levelDb, TxStream trStream, TxGenerator trGenerator, long id) {
|
||||
this.levelDb=levelDb;
|
||||
this.trStream=trStream;
|
||||
this.trGenerator=trGenerator;
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITxStream<ITxEvent> getStream() {
|
||||
return trStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITxGenerator getGenerator() {
|
||||
return trGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConcurrencyIndex() {
|
||||
if(!initialized) loadFromDb();
|
||||
return concurency_index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getBeginTime() {
|
||||
if(!initialized) loadFromDb();
|
||||
return start_time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getEndTime() {
|
||||
loadFromDb();
|
||||
return end_time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITxAttribute> getAttributes() {
|
||||
if(attributes==null) {
|
||||
loadFromDb();
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITxRelation> getIncomingRelations() {
|
||||
if(incoming==null) {
|
||||
incoming = new ArrayList<ITxRelation>();
|
||||
SeekingIterator<String, String> it = levelDb.iterator();
|
||||
String key = "ri~"+String.format("%016x", id);
|
||||
it.seek(key);
|
||||
while(it.hasNext()) {
|
||||
String val = it.next().getKey();
|
||||
if(!val.startsWith(key)) break;;
|
||||
String[] token = val.split("~");
|
||||
long otherId = Long.parseLong(token[2], 16);
|
||||
incoming.add(createRelation(otherId, token[3], false));
|
||||
}
|
||||
|
||||
}
|
||||
return incoming;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITxRelation> getOutgoingRelations() {
|
||||
if(outgoing==null) {
|
||||
outgoing = new ArrayList<ITxRelation>();
|
||||
SeekingIterator<String, String> it = levelDb.iterator();
|
||||
String key="ro~"+String.format("%016x", id);
|
||||
it.seek(key);
|
||||
while(it.hasNext()) {
|
||||
String val = it.next().getKey();
|
||||
if(!val.startsWith(key)) break;
|
||||
String[] token = val.split("~");
|
||||
long otherId = Long.parseLong(token[2], 16);
|
||||
outgoing.add(createRelation(otherId, token[3], true));
|
||||
}
|
||||
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ITx o) {
|
||||
int res = this.getBeginTime().compareTo(o.getBeginTime());
|
||||
if(res!=0)
|
||||
return res;
|
||||
else
|
||||
return this.getId().compareTo(o.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]";
|
||||
}
|
||||
|
||||
private void loadFromDb() throws JSONException {
|
||||
JSONObject dbVal = new JSONObject(levelDb.get("x~"+ String.format("%016x", id)));
|
||||
start_time=dbVal.getLong("START_TIME") * levelDb.getTimeResolution();
|
||||
end_time=dbVal.getLong("END_TIME") * levelDb.getTimeResolution();
|
||||
concurency_index=dbVal.getInt("conc");
|
||||
attributes=new ArrayList<>();
|
||||
JSONArray arr = dbVal.getJSONArray("attr");
|
||||
arr.forEach(entry -> {
|
||||
TxAttribute attr = new TxAttribute(this, (JSONObject) entry);
|
||||
attributes.add(attr);
|
||||
});
|
||||
initialized=true;
|
||||
}
|
||||
|
||||
private ITxRelation createRelation(long otherId, String name, boolean outgoing) {
|
||||
try {
|
||||
JSONObject otherTxVal = new JSONObject(levelDb.get("x~"+ String.format("%016x", otherId)));
|
||||
if(otherTxVal.isEmpty()) return null;
|
||||
JSONObject otherStreamVal = new JSONObject(levelDb.get("s~"+ String.format("%016x", otherTxVal.getLong("s"))));
|
||||
if(otherStreamVal.isEmpty()) return null;
|
||||
TxStream tgtStream = (TxStream) trStream.getDb().getStreamByName(otherStreamVal.getString("name"));
|
||||
Tx that = (Tx) tgtStream.getTransactions().get(otherId);
|
||||
return outgoing?
|
||||
new TxRelation(trStream.getRelationType(name), this, that):
|
||||
new TxRelation(trStream.getRelationType(name), that, this);
|
||||
} catch (SecurityException | IllegalArgumentException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.minres.scviewer.database.AssociationType;
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
|
||||
public class TxAttribute implements ITxAttribute{
|
||||
|
||||
private String name;
|
||||
|
||||
private DataType dataType;
|
||||
|
||||
private AssociationType associationType;
|
||||
|
||||
private Object value;
|
||||
|
||||
public TxAttribute(Tx trTransaction, JSONObject attribute) {
|
||||
this.name=attribute.getString("name");
|
||||
this.dataType=DataType.values()[attribute.getInt("type")];
|
||||
this.associationType=AssociationType.values()[attribute.getInt("assoc")];
|
||||
this.value=attribute.get("value");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssociationType getType() {
|
||||
return associationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.iq80.leveldb.Options;
|
||||
import org.iq80.leveldb.Range;
|
||||
import org.iq80.leveldb.ReadOptions;
|
||||
import org.iq80.leveldb.Snapshot;
|
||||
import org.iq80.leveldb.impl.DbImpl;
|
||||
import org.iq80.leveldb.impl.SeekingIterator;
|
||||
|
||||
class TxDBWrapper {
|
||||
private final Options options;
|
||||
private final ReadOptions ro = new ReadOptions();
|
||||
private final File databaseDir;
|
||||
private DbImpl db;
|
||||
private long timeResolution=1L;;
|
||||
|
||||
TxDBWrapper(Options options, File databaseDir) throws IOException {
|
||||
this.options = options.verifyChecksums(true).createIfMissing(false).errorIfExists(false).cacheSize(64*1024*1024);
|
||||
this.databaseDir = databaseDir;
|
||||
this.db = new DbImpl(options, databaseDir);
|
||||
ro.snapshot(db.getSnapshot());
|
||||
}
|
||||
|
||||
public String get(String key) {
|
||||
byte[] slice = db.get(LevelDBLoader.toByteArray(key));
|
||||
if (slice == null) {
|
||||
return null;
|
||||
}
|
||||
return new String(slice, UTF_8);
|
||||
}
|
||||
|
||||
public String get(String key, Snapshot snapshot) {
|
||||
byte[] slice = db.get(LevelDBLoader.toByteArray(key), ro);
|
||||
return slice == null? null : new String(slice, UTF_8);
|
||||
}
|
||||
|
||||
public void put(String key, String value) {
|
||||
db.put(LevelDBLoader.toByteArray(key), LevelDBLoader.toByteArray(value));
|
||||
}
|
||||
|
||||
public void delete(String key) {
|
||||
db.delete(LevelDBLoader.toByteArray(key));
|
||||
}
|
||||
|
||||
public SeekingIterator<String, String> iterator() {
|
||||
return new StringDbIterator(db.iterator());
|
||||
}
|
||||
|
||||
public Snapshot getSnapshot() {
|
||||
return db.getSnapshot();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
ro.snapshot().close();
|
||||
db.close();
|
||||
} catch (IOException e) {} // ignore any error
|
||||
}
|
||||
|
||||
public long size(String start, String limit) {
|
||||
return db.getApproximateSizes(new Range(LevelDBLoader.toByteArray(start), LevelDBLoader.toByteArray(limit)));
|
||||
}
|
||||
|
||||
public long getMaxNextLevelOverlappingBytes() {
|
||||
return db.getMaxNextLevelOverlappingBytes();
|
||||
}
|
||||
|
||||
public void reopen() throws IOException {
|
||||
reopen(options);
|
||||
}
|
||||
|
||||
public void reopen(Options options) throws IOException {
|
||||
this.close();
|
||||
db = new DbImpl(options.verifyChecksums(true).createIfMissing(false).errorIfExists(false), databaseDir);
|
||||
ro.snapshot(db.getSnapshot());
|
||||
}
|
||||
|
||||
public long getTimeResolution() {
|
||||
return timeResolution;
|
||||
}
|
||||
|
||||
public void setTimeResolution(long resolution) {
|
||||
this.timeResolution = resolution;
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.IWaveformEvent;
|
||||
|
||||
public class TxEvent implements ITxEvent {
|
||||
|
||||
private final Type type;
|
||||
private ITx tx;
|
||||
|
||||
public TxEvent(Type type, ITx tx) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.tx = tx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getTime() {
|
||||
return type==Type.BEGIN?tx.getBeginTime():tx.getEndTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWaveformEvent duplicate() throws CloneNotSupportedException {
|
||||
return new TxEvent(type, tx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(IWaveformEvent o) {
|
||||
return getTime().compareTo(o.getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITx getTransaction() {
|
||||
return tx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxGenerator;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
|
||||
public class TxGenerator implements ITxGenerator {
|
||||
|
||||
private ITxStream<ITxEvent> stream;
|
||||
|
||||
private long id;
|
||||
|
||||
private String name;
|
||||
|
||||
public TxGenerator(ITxStream<ITxEvent> stream, JSONObject object) {
|
||||
this.stream=stream;
|
||||
this.id=object.getLong("id");
|
||||
this.name=object.getString("name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITxStream<ITxEvent> getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITx> getTransactions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
||||
public class TxRelation implements ITxRelation {
|
||||
|
||||
RelationType relationType;
|
||||
Tx source, target;
|
||||
|
||||
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.relationType = relationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelationType getRelationType() {
|
||||
return relationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITx getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITx getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
@ -1,178 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.leveldb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.iq80.leveldb.impl.SeekingIterator;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxGenerator;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
||||
public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||
|
||||
private TxDBWrapper levelDb;
|
||||
|
||||
private String fullName;
|
||||
|
||||
private String kind;
|
||||
|
||||
private IWaveformDb db;
|
||||
|
||||
private long id;
|
||||
|
||||
private TreeMap<Long, TxGenerator> generators;
|
||||
|
||||
private TreeMap<Long, ITx> transactions;
|
||||
|
||||
private Integer maxConcurrency;
|
||||
|
||||
private TreeMap<Long, List<ITxEvent>> events;
|
||||
|
||||
private List<RelationType> usedRelationsList;
|
||||
|
||||
public TxStream(TxDBWrapper database, IWaveformDb waveformDb, JSONObject object) {
|
||||
super(object.get("name").toString());
|
||||
this.levelDb=database;
|
||||
this.db=waveformDb;
|
||||
this.fullName=object.getString("name");
|
||||
this.kind=object.getString("kind");
|
||||
this.id = object.getLong("id");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWaveformDb getDb() {
|
||||
return db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ITxGenerator> getGenerators() {
|
||||
if(generators==null){
|
||||
generators=new TreeMap<Long, TxGenerator>();
|
||||
SeekingIterator<String, String> it = levelDb.iterator();
|
||||
String key="sg~"+String.format("%016x", id);
|
||||
it.seek(key);
|
||||
while(it.hasNext()) {
|
||||
Entry<String, String> val = it.next();
|
||||
if(!val.getKey().startsWith(key)) break;
|
||||
JSONObject jVal = new JSONObject(val.getValue());
|
||||
generators.put(jVal.getLong("id"), new TxGenerator(this, jVal));
|
||||
}
|
||||
}
|
||||
return new ArrayList<ITxGenerator>(generators.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxConcurrency() {
|
||||
if(maxConcurrency==null){
|
||||
getTransactions();
|
||||
}
|
||||
return maxConcurrency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NavigableMap<Long, List<ITxEvent>> getEvents(){
|
||||
if(events==null){
|
||||
events=new TreeMap<Long, List<ITxEvent>>();
|
||||
for(Entry<Long, ITx> entry:getTransactions().entrySet()){
|
||||
ITx tx = entry.getValue();
|
||||
putEvent(new TxEvent(TxEvent.Type.BEGIN, tx));
|
||||
putEvent(new TxEvent(TxEvent.Type.END, tx));
|
||||
}
|
||||
}
|
||||
return events;
|
||||
}
|
||||
|
||||
private void putEvent(TxEvent ev){
|
||||
Long time = ev.getTime();
|
||||
if(!events.containsKey(time)){
|
||||
Vector<ITxEvent> vector=new Vector<ITxEvent>();
|
||||
vector.add(ev);
|
||||
events.put(time, vector);
|
||||
} else {
|
||||
events.get(time).add(ev);
|
||||
}
|
||||
}
|
||||
|
||||
protected Map<Long, ITx> getTransactions() {
|
||||
if(transactions==null){
|
||||
if(generators==null) getGenerators();
|
||||
transactions = new TreeMap<Long, ITx>();
|
||||
maxConcurrency=0;
|
||||
SeekingIterator<String, String> it = levelDb.iterator();
|
||||
String key = "sgx~"+String.format("%016x", id);
|
||||
it.seek(key);
|
||||
while(it.hasNext()) {
|
||||
Entry<String, String> val = it.next();
|
||||
if(!val.getKey().startsWith(key)) break;
|
||||
String[] token = val.getKey().split("~");
|
||||
long gid = Long.parseLong(token[2], 16); // gen id
|
||||
long id = Long.parseLong(token[3], 16); // tx id
|
||||
ITx tx = new Tx(levelDb, this, generators.get(gid), id);
|
||||
transactions.put(id, tx);
|
||||
maxConcurrency= Math.max(maxConcurrency, tx.getConcurrencyIndex());
|
||||
}
|
||||
maxConcurrency++;
|
||||
}
|
||||
return transactions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITxEvent> getWaveformEventsAtTime(Long time) {
|
||||
return getEvents().get(time);
|
||||
}
|
||||
|
||||
public void setRelationTypeList(List<RelationType> usedRelationsList){
|
||||
this.usedRelationsList=usedRelationsList;
|
||||
}
|
||||
|
||||
public RelationType getRelationType(String name) {
|
||||
RelationType relType=RelationType.create(name);
|
||||
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
|
||||
return relType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean equals(IWaveform other) {
|
||||
return(other instanceof TxStream && this.getId()==other.getId());
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
|
||||
|
@ -1,8 +1,10 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -4,7 +4,7 @@ Bundle-Name: SQLite transaction database
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
||||
Bundle-Version: 1.1.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0"
|
||||
Bundle-ClassPath: .,sqlite-jdbc-3.8.7.jar
|
||||
Service-Component: OSGI-INF/component.xml
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
@ -39,14 +39,14 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
|
||||
private List<RelationType> usedRelationsList;
|
||||
|
||||
public AbstractTxStream(IDatabase database, String name, long streamId) {
|
||||
protected AbstractTxStream(IDatabase database, String name, long streamId) {
|
||||
super(name);
|
||||
this.database=database;
|
||||
this.streamId=streamId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
public int getRowCount() {
|
||||
if(maxConcurrency==null){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
|
||||
@ -126,4 +126,11 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate concurrency.
|
||||
*/
|
||||
public void calculateConcurrency() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||
if(!event.isEmpty())
|
||||
return event.get(0).getTime()*scvSimProps.getTime_resolution();
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0L;
|
||||
@ -73,7 +73,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||
streams.add(stream);
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
}
|
||||
return streams;
|
||||
}
|
||||
@ -99,7 +99,6 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||
|
||||
@Override
|
||||
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||
dispose();
|
||||
database=new SQLiteDatabase(file.getAbsolutePath(), db);
|
||||
database.setData("TIMERESOLUTION", 1L);
|
||||
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
|
||||
@ -110,7 +109,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||
}
|
||||
pcs.firePropertyChange(IWaveformDbLoader.LOADING_FINISHED, null, null);
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
throw new InputFormatException(e.toString());
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
|
||||
public class Tx implements ITx {
|
||||
@ -61,12 +60,11 @@ public class Tx implements ITx {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITxGenerator getGenerator() {
|
||||
public IWaveform getGenerator() {
|
||||
return trGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConcurrencyIndex() {
|
||||
int getConcurrencyIndex() {
|
||||
return scvTx.getConcurrencyLevel();
|
||||
}
|
||||
|
||||
@ -80,7 +78,7 @@ public class Tx implements ITx {
|
||||
begin= scvEvent.getTime()*(Long)database.getData("TIMERESOLUTION");
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
return begin;
|
||||
@ -96,7 +94,7 @@ public class Tx implements ITx {
|
||||
end = scvEvent.getTime()*(Long)database.getData("TIMERESOLUTION");
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
return end;
|
||||
@ -114,7 +112,7 @@ public class Tx implements ITx {
|
||||
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
return attributes;
|
||||
@ -131,7 +129,7 @@ public class Tx implements ITx {
|
||||
incoming.add(createRelation(scvRelation, false));
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
return incoming;
|
||||
@ -148,7 +146,7 @@ public class Tx implements ITx {
|
||||
outgoing.add(createRelation(scvRelation, true));
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
return outgoing;
|
||||
@ -171,7 +169,7 @@ public class Tx implements ITx {
|
||||
else
|
||||
return new TxRelation(trStream.getRelationType(rel.getName()), that, this);
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -56,4 +56,10 @@ public class TxEvent implements ITxEvent {
|
||||
public WaveformType getType() {
|
||||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowIndex() {
|
||||
return ((Tx)tx).getConcurrencyIndex();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
|
||||
public class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
public class TxGenerator extends AbstractTxStream {
|
||||
|
||||
private TxStream stream;
|
||||
|
||||
@ -44,11 +43,6 @@ public class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
return (long) scvGenerator.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWaveform getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return scvGenerator.getName();
|
||||
@ -75,7 +69,7 @@ public class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
transactions.put(scvTx.getId(), new Tx(database, (TxStream) stream, this, scvTx));
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvStream;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
|
||||
public class TxStream extends AbstractTxStream {
|
||||
|
||||
@ -54,7 +53,7 @@ public class TxStream extends AbstractTxStream {
|
||||
return (long) scvStream.getId();
|
||||
}
|
||||
|
||||
public List<ITxGenerator> getGenerators() {
|
||||
public List<IWaveform> getGenerators() {
|
||||
if(generators==null){
|
||||
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<>(
|
||||
ScvGenerator.class, database, "stream="+scvStream.getId());
|
||||
@ -64,7 +63,7 @@ public class TxStream extends AbstractTxStream {
|
||||
generators.put(scvGenerator.getId(), new TxGenerator(database, this, scvGenerator));
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -82,7 +81,7 @@ public class TxStream extends AbstractTxStream {
|
||||
transactions.put(scvTx.getId(), new Tx(database, this, generators.get(scvTx.getGenerator()), scvTx));
|
||||
}
|
||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||
| InvocationTargetException | SQLException | IntrospectionException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -75,10 +75,11 @@ public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @throws IllegalAccessException
|
||||
* @throws IntrospectionException
|
||||
* @throws InvocationTargetException
|
||||
* @throws NoSuchMethodException
|
||||
*/
|
||||
public synchronized List<T> selectObjects() throws SQLException,
|
||||
InstantiationException, IllegalAccessException,
|
||||
IntrospectionException, InvocationTargetException {
|
||||
IntrospectionException, InvocationTargetException, IllegalArgumentException, NoSuchMethodException, SecurityException {
|
||||
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
@ -113,17 +114,18 @@ public class SQLiteDatabaseSelectHandler<T> extends AbstractDatabaseHandler<T> {
|
||||
* @throws IllegalAccessException
|
||||
* @throws IntrospectionException
|
||||
* @throws InvocationTargetException
|
||||
* @throws NoSuchMethodException
|
||||
*/
|
||||
private List<T> createObjects(ResultSet resultSet)
|
||||
throws SQLException, InstantiationException,
|
||||
IllegalAccessException, IntrospectionException,
|
||||
InvocationTargetException {
|
||||
InvocationTargetException, IllegalArgumentException, NoSuchMethodException, SecurityException {
|
||||
|
||||
List<T> list = new ArrayList<>();
|
||||
|
||||
while (resultSet.next()) {
|
||||
|
||||
T instance = type.newInstance();
|
||||
T instance = type.getDeclaredConstructor().newInstance();
|
||||
|
||||
for (Field field : type.getDeclaredFields()) {
|
||||
|
||||
|
@ -1,10 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mapdb-3.0.7.jar" sourcepath="lib/mapdb-3.0.7-sources.jar">
|
||||
<attributes>
|
||||
|
@ -1,9 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -4,7 +4,7 @@ Bundle-Name: Textual transaction database
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
||||
Bundle-Version: 3.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Import-Package: org.osgi.framework;version="1.3.0"
|
||||
Require-Bundle: com.minres.scviewer.database,
|
||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||
|
@ -6,40 +6,9 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerId>groovy-eclipse-compiler</compilerId>
|
||||
<compilerArguments>
|
||||
<indy/><!-- optional; supported by batch 2.4.12-04+ -->
|
||||
</compilerArguments>
|
||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
||||
<!-- <verbose>true</verbose> -->
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-eclipse-compiler</artifactId>
|
||||
<version>${groovy-eclipse-compiler-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-eclipse-batch</artifactId>
|
||||
<version>${groovy-eclipse-batch-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -13,15 +13,16 @@ package com.minres.scviewer.database.text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.minres.scviewer.database.EventKind;
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
|
||||
/**
|
||||
@ -38,8 +39,8 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
/** The events. */
|
||||
TreeMap<Long, IEvent[]> events = new TreeMap<>();
|
||||
|
||||
/** The concurrency calculated. */
|
||||
boolean concurrencyCalculated = false;
|
||||
/** The max concurrency. */
|
||||
private int rowCount = -1;
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract tx stream.
|
||||
@ -48,7 +49,7 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
* @param id the id
|
||||
* @param name the name
|
||||
*/
|
||||
public AbstractTxStream(TextDbLoader loader, Long id, String name) {
|
||||
protected AbstractTxStream(TextDbLoader loader, Long id, String name) {
|
||||
super(name);
|
||||
this.loader = loader;
|
||||
this.id = id;
|
||||
@ -77,8 +78,6 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
*/
|
||||
@Override
|
||||
public NavigableMap<Long, IEvent[]> getEvents() {
|
||||
if (!concurrencyCalculated)
|
||||
calculateConcurrency();
|
||||
return events;
|
||||
}
|
||||
|
||||
@ -90,8 +89,6 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
*/
|
||||
@Override
|
||||
public IEvent[] getEventsAtTime(Long time) {
|
||||
if (!concurrencyCalculated)
|
||||
calculateConcurrency();
|
||||
return events.get(time);
|
||||
}
|
||||
|
||||
@ -103,8 +100,6 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
*/
|
||||
@Override
|
||||
public IEvent[] getEventsBeforeTime(Long time) {
|
||||
if (!concurrencyCalculated)
|
||||
calculateConcurrency();
|
||||
Entry<Long, IEvent[]> e = events.floorEntry(time);
|
||||
if (e == null)
|
||||
return new IEvent[] {};
|
||||
@ -132,28 +127,59 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
if (rowCount<0)
|
||||
calculateConcurrency();
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate concurrency.
|
||||
*/
|
||||
synchronized void calculateConcurrency() {
|
||||
if (concurrencyCalculated)
|
||||
void calculateConcurrency() {
|
||||
if (rowCount>=0)
|
||||
return;
|
||||
ArrayList<Long> rowendtime = new ArrayList<>();
|
||||
events.entrySet().stream().forEach(entry -> {
|
||||
IEvent[] values = entry.getValue();
|
||||
Arrays.asList(values).stream().filter(e -> e.getKind() == EventKind.BEGIN).forEach(evt -> {
|
||||
Tx tx = (Tx) ((TxEvent) evt).getTransaction();
|
||||
ArrayList<Long> rowEndTime = new ArrayList<>();
|
||||
HashMap<Long, Integer> rowByTxId = new HashMap<>();
|
||||
for(Entry<Long, IEvent[]> entry: events.entrySet()) {
|
||||
for(IEvent evt:entry.getValue()) {
|
||||
TxEvent txEvt = (TxEvent) evt;
|
||||
ITx tx = txEvt.getTransaction();
|
||||
int rowIdx = 0;
|
||||
for (; rowIdx < rowendtime.size() && rowendtime.get(rowIdx) > tx.getBeginTime(); rowIdx++)
|
||||
;
|
||||
if (rowendtime.size() <= rowIdx)
|
||||
rowendtime.add(tx.getEndTime());
|
||||
else
|
||||
rowendtime.set(rowIdx, tx.getEndTime());
|
||||
tx.setConcurrencyIndex(rowIdx);
|
||||
});
|
||||
});
|
||||
concurrencyCalculated = true;
|
||||
switch(evt.getKind()) {
|
||||
case END:
|
||||
Long txId = txEvt.getTransaction().getId();
|
||||
txEvt.setConcurrencyIndex(rowByTxId.get(txId));
|
||||
rowByTxId.remove(txId);
|
||||
break;
|
||||
case SINGLE:
|
||||
for (; rowIdx < rowEndTime.size() && rowEndTime.get(rowIdx)>tx.getBeginTime(); rowIdx++);
|
||||
if (rowEndTime.size() <= rowIdx)
|
||||
rowEndTime.add(tx.getEndTime());
|
||||
else
|
||||
rowEndTime.set(rowIdx, tx.getEndTime());
|
||||
((TxEvent) evt).setConcurrencyIndex(rowIdx);
|
||||
break;
|
||||
case BEGIN:
|
||||
for (; rowIdx < rowEndTime.size() && rowEndTime.get(rowIdx)>tx.getBeginTime(); rowIdx++);
|
||||
if (rowEndTime.size() <= rowIdx)
|
||||
rowEndTime.add(tx.getEndTime());
|
||||
else
|
||||
rowEndTime.set(rowIdx, tx.getEndTime());
|
||||
((TxEvent) evt).setConcurrencyIndex(rowIdx);
|
||||
rowByTxId.put(tx.getId(), rowIdx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rowCount=rowEndTime.size()>0?rowEndTime.size():1;
|
||||
getChildNodes().parallelStream().forEach(c -> ((TxGenerator)c).calculateConcurrency());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,14 +28,15 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import org.eclipse.collections.impl.map.mutable.UnifiedMap;
|
||||
import org.mapdb.DB;
|
||||
import org.mapdb.DB.TreeMapSink;
|
||||
import org.mapdb.DBMaker;
|
||||
import org.mapdb.HTreeMap;
|
||||
import org.mapdb.Serializer;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
@ -55,6 +56,13 @@ import com.minres.scviewer.database.tx.ITx;
|
||||
*/
|
||||
public class TextDbLoader implements IWaveformDbLoader {
|
||||
|
||||
/** the file size limit of a zipped txlog where the loader starts to use a file mapped database */
|
||||
private static final long MEMMAP_LIMIT=256l*1024l*1024l;
|
||||
|
||||
private static final long MAPDB_INITIAL_ALLOC = 512l*1024l*1024l;
|
||||
|
||||
private static final long MAPDB_INCREMENTAL_ALLOC = 128l*1024l*1024l;
|
||||
|
||||
/** The max time. */
|
||||
private Long maxTime = 0L;
|
||||
|
||||
@ -76,8 +84,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
/** The transactions. */
|
||||
Map<Long, ScvTx> transactions = null;
|
||||
|
||||
Map<Long, Long> id2index = new HashMap<>();
|
||||
|
||||
/** The attribute types. */
|
||||
final Map<String, TxAttributeType> attributeTypes = UnifiedMap.newMap();
|
||||
|
||||
@ -99,6 +105,26 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
/** The Constant x. */
|
||||
static final byte[] x = "scv_tr_stream".getBytes();
|
||||
|
||||
/**
|
||||
* Adds the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max time.
|
||||
*
|
||||
@ -109,8 +135,29 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
return maxTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transaction.
|
||||
*
|
||||
* @param txId the tx id
|
||||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction(long txId) {
|
||||
if (txCache.containsKey(txId))
|
||||
return txCache.get(txId);
|
||||
if(transactions.containsKey(txId)) {
|
||||
Tx tx = new Tx(this, transactions.get(txId));
|
||||
txCache.put(txId, tx);
|
||||
return tx;
|
||||
} else {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public ScvTx getScvTx(long id) {
|
||||
return transactions.get(id2index.get(id));
|
||||
if(transactions.containsKey(id))
|
||||
return transactions.get(id);
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,6 +170,15 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
return new ArrayList<>(txStreams.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all relation types.
|
||||
*
|
||||
* @return the all relation types
|
||||
*/
|
||||
public Collection<RelationType> getAllRelationTypes() {
|
||||
return relationTypes.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Can load.
|
||||
*
|
||||
@ -149,6 +205,22 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is gzipped.
|
||||
*
|
||||
* @param f the f
|
||||
* @return true, if is gzipped
|
||||
*/
|
||||
private static boolean isGzipped(File f) {
|
||||
try (InputStream is = new FileInputStream(f)) {
|
||||
byte[] signature = new byte[2];
|
||||
int nread = is.read(signature); // read the gzip signature
|
||||
return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
@ -162,10 +234,9 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||
dispose();
|
||||
boolean gzipped = isGzipped(file);
|
||||
if (file.length() < 75000000 * (gzipped ? 1 : 10)
|
||||
if (file.length() < MEMMAP_LIMIT * (gzipped ? 1 : 10)
|
||||
|| "memory".equals(System.getProperty("ScvBackingDB", "file")))
|
||||
mapDb = DBMaker.memoryDirectDB().allocateStartSize(512l * 1024l * 1024l)
|
||||
.allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
|
||||
mapDb = DBMaker.memoryDirectDB().make();
|
||||
else {
|
||||
File mapDbFile;
|
||||
try {
|
||||
@ -175,32 +246,21 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
throw new InputFormatException(e.toString());
|
||||
}
|
||||
mapDb = DBMaker.fileDB(mapDbFile).fileMmapEnable() // Always enable mmap
|
||||
.fileMmapEnableIfSupported().fileMmapPreclearDisable().allocateStartSize(512l * 1024l * 1024l)
|
||||
.allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
|
||||
.fileMmapPreclearDisable().allocateStartSize(MAPDB_INITIAL_ALLOC)
|
||||
.allocateIncrement(MAPDB_INCREMENTAL_ALLOC).cleanerHackEnable().make();
|
||||
mapDbFile.deleteOnExit();
|
||||
}
|
||||
TextDbParser parser = new TextDbParser(this);
|
||||
try {
|
||||
parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
|
||||
|
||||
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
|
||||
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
|
||||
transactions = parser.txSink.create();
|
||||
transactions = parser.txSink;
|
||||
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
|
||||
} catch (Exception e) {
|
||||
throw new InputFormatException(e.toString());
|
||||
}
|
||||
for (TxStream stream : txStreams.values()) {
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
stream.calculateConcurrency();
|
||||
} catch (Exception e) {
|
||||
/* don't let exceptions bubble up */ }
|
||||
}
|
||||
};
|
||||
threads.add(t);
|
||||
t.start();
|
||||
}
|
||||
txStreams.values().parallelStream().forEach(TxStream::calculateConcurrency);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,31 +282,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is gzipped.
|
||||
*
|
||||
* @param f the f
|
||||
* @return true, if is gzipped
|
||||
*/
|
||||
private static boolean isGzipped(File f) {
|
||||
try (InputStream is = new FileInputStream(f)) {
|
||||
byte[] signature = new byte[2];
|
||||
int nread = is.read(signature); // read the gzip signature
|
||||
return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all relation types.
|
||||
*
|
||||
* @return the all relation types
|
||||
*/
|
||||
public Collection<RelationType> getAllRelationTypes() {
|
||||
return relationTypes.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TextDbParser.
|
||||
*/
|
||||
@ -275,7 +310,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
HashMap<Long, ScvTx> transactionById = new HashMap<>();
|
||||
|
||||
/** The tx sink. */
|
||||
TreeMapSink<Long, ScvTx> txSink;
|
||||
HTreeMap<Long, ScvTx> txSink;
|
||||
|
||||
/** The reader. */
|
||||
BufferedReader reader = null;
|
||||
@ -286,7 +321,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
/** The attr value lut. */
|
||||
Map<String, Integer> attrValueLut = new HashMap<>();
|
||||
|
||||
long indexCount = 0;
|
||||
/**
|
||||
* Instantiates a new text db parser.
|
||||
*
|
||||
@ -313,6 +347,11 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
}
|
||||
if (curLine != null)
|
||||
parseLine(curLine, nextLine);
|
||||
for(Entry<Long, ScvTx> e: transactionById.entrySet()) {
|
||||
ScvTx scvTx = e.getValue();
|
||||
scvTx.endTime=loader.maxTime;
|
||||
txSink.put(e.getKey(), scvTx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -348,10 +387,9 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
String[] tokens = curLine.split("\\s+");
|
||||
if ("tx_record_attribute".equals(tokens[0])) {
|
||||
Long id = Long.parseLong(tokens[1]);
|
||||
String name = tokens[2].substring(1, tokens[2].length());
|
||||
String name = tokens[2].substring(1, tokens[2].length()-1);
|
||||
DataType type = DataType.valueOf(tokens[3]);
|
||||
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length))
|
||||
: "";
|
||||
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)) : "";
|
||||
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
|
||||
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
|
||||
} else if ("tx_begin".equals(tokens[0])) {
|
||||
@ -361,8 +399,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId,
|
||||
Long.parseLong(tokens[3]) * stringToScale(tokens[4]));
|
||||
loader.maxTime = loader.maxTime > scvTx.beginTime ? loader.maxTime : scvTx.beginTime;
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
stream.setConcurrency(stream.getConcurrency() + 1);
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
@ -384,18 +420,14 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
|
||||
TxStream stream = loader.txStreams.get(gen.stream.getId());
|
||||
if (scvTx.beginTime == scvTx.endTime) {
|
||||
TxEvent evt = new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime);
|
||||
stream.addEvent(evt);
|
||||
gen.addEvent(evt);
|
||||
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
|
||||
} else {
|
||||
TxEvent begEvt = new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime);
|
||||
stream.addEvent(begEvt);
|
||||
gen.addEvent(begEvt);
|
||||
TxEvent endEvt = new TxEvent(loader, EventKind.END, id, scvTx.endTime);
|
||||
stream.addEvent(endEvt);
|
||||
gen.addEvent(endEvt);
|
||||
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
|
||||
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
|
||||
}
|
||||
stream.setConcurrency(stream.getConcurrency() - 1);
|
||||
if (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
int idx = 0;
|
||||
while (nextLine != null && nextLine.charAt(0) == 'a') {
|
||||
@ -407,8 +439,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
nextLine = reader.readLine();
|
||||
}
|
||||
}
|
||||
txSink.put(indexCount, scvTx);
|
||||
loader.id2index.put(scvTx.getId(), indexCount++);
|
||||
txSink.put(scvTx.getId(), scvTx);
|
||||
transactionById.remove(id);
|
||||
} else if ("tx_relation".equals(tokens[0])) {
|
||||
Long tr2 = Long.parseLong(tokens[2]);
|
||||
@ -515,38 +546,4 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the transaction.
|
||||
*
|
||||
* @param txId the tx id
|
||||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction(long txId) {
|
||||
if (txCache.containsKey(txId))
|
||||
return txCache.get(txId);
|
||||
Tx tx = new Tx(this, txId);
|
||||
txCache.put(txId, tx);
|
||||
return tx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the property change listener.
|
||||
*
|
||||
* @param l the l
|
||||
*/
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
pcs.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import java.util.stream.Collectors;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
|
||||
/**
|
||||
@ -29,9 +28,15 @@ class Tx implements ITx {
|
||||
|
||||
/** The loader. */
|
||||
private final TextDbLoader loader;
|
||||
|
||||
private ScvTx scvTx =null;
|
||||
|
||||
/** The id. */
|
||||
private long id;
|
||||
private final long id;
|
||||
|
||||
private final long generatorId;
|
||||
|
||||
private final long streamId;
|
||||
|
||||
/** The begin time. */
|
||||
long beginTime = -1;
|
||||
@ -39,9 +44,6 @@ class Tx implements ITx {
|
||||
/** The end time. */
|
||||
long endTime = -1;
|
||||
|
||||
/** The concurrency index. */
|
||||
private int concurrencyIndex;
|
||||
|
||||
/**
|
||||
* Instantiates a new tx.
|
||||
*
|
||||
@ -51,6 +53,10 @@ class Tx implements ITx {
|
||||
public Tx(TextDbLoader loader, ScvTx scvTx) {
|
||||
this.loader = loader;
|
||||
id = scvTx.id;
|
||||
generatorId=scvTx.generatorId;
|
||||
streamId=scvTx.streamId;
|
||||
beginTime=scvTx.beginTime;
|
||||
endTime=scvTx.endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,9 +65,11 @@ class Tx implements ITx {
|
||||
* @param loader the loader
|
||||
* @param txId the tx id
|
||||
*/
|
||||
public Tx(TextDbLoader loader, long txId) {
|
||||
public Tx(TextDbLoader loader, long id, long generatorId, long streamId) {
|
||||
this.loader = loader;
|
||||
id = txId;
|
||||
this.id = id;
|
||||
this.generatorId=generatorId;
|
||||
this.streamId = streamId;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,7 +121,7 @@ class Tx implements ITx {
|
||||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
return this.loader.getScvTx(id).equals(((Tx) obj).loader.getScvTx(id));
|
||||
return this.getScvTx().equals(((Tx) obj).getScvTx());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +131,7 @@ class Tx implements ITx {
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return loader.getScvTx(id).hashCode();
|
||||
return getScvTx().hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +151,7 @@ class Tx implements ITx {
|
||||
*/
|
||||
@Override
|
||||
public Long getId() {
|
||||
return loader.getScvTx(id).id;
|
||||
return getScvTx().id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,7 +161,7 @@ class Tx implements ITx {
|
||||
*/
|
||||
@Override
|
||||
public IWaveform getStream() {
|
||||
return loader.txStreams.get(loader.getScvTx(id).streamId);
|
||||
return loader.txStreams.get(streamId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,8 +170,8 @@ class Tx implements ITx {
|
||||
* @return the generator
|
||||
*/
|
||||
@Override
|
||||
public ITxGenerator getGenerator() {
|
||||
return loader.txGenerators.get(loader.getScvTx(id).generatorId);
|
||||
public IWaveform getGenerator() {
|
||||
return loader.txGenerators.get(generatorId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,8 +181,11 @@ class Tx implements ITx {
|
||||
*/
|
||||
@Override
|
||||
public Long getBeginTime() {
|
||||
if (beginTime < 0)
|
||||
beginTime = loader.getScvTx(id).beginTime;
|
||||
if (beginTime < 0) {
|
||||
ScvTx tx = scvTx==null?loader.getScvTx(id):getScvTx();
|
||||
beginTime = tx.beginTime;
|
||||
endTime = tx.endTime;
|
||||
}
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
@ -185,8 +196,11 @@ class Tx implements ITx {
|
||||
*/
|
||||
@Override
|
||||
public Long getEndTime() {
|
||||
if (endTime < 0)
|
||||
endTime = loader.getScvTx(id).endTime;
|
||||
if (endTime < 0) {
|
||||
ScvTx tx = scvTx==null?loader.getScvTx(id):getScvTx();
|
||||
beginTime = tx.beginTime;
|
||||
endTime = tx.endTime;
|
||||
}
|
||||
return endTime;
|
||||
}
|
||||
|
||||
@ -196,26 +210,7 @@ class Tx implements ITx {
|
||||
* @param time the new end time
|
||||
*/
|
||||
void setEndTime(Long time) {
|
||||
loader.getScvTx(id).endTime = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the concurrency index.
|
||||
*
|
||||
* @return the concurrency index
|
||||
*/
|
||||
@Override
|
||||
public int getConcurrencyIndex() {
|
||||
return concurrencyIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the concurrency index.
|
||||
*
|
||||
* @param idx the new concurrency index
|
||||
*/
|
||||
void setConcurrencyIndex(int idx) {
|
||||
concurrencyIndex = idx;
|
||||
getScvTx().endTime = time;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -225,7 +220,12 @@ class Tx implements ITx {
|
||||
*/
|
||||
@Override
|
||||
public List<ITxAttribute> getAttributes() {
|
||||
return loader.getScvTx(id).attributes;
|
||||
return getScvTx().attributes;
|
||||
}
|
||||
|
||||
private ScvTx getScvTx() {
|
||||
if(scvTx==null)
|
||||
scvTx=loader.getScvTx(id);
|
||||
return scvTx;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ class TxEvent implements ITxEvent {
|
||||
/** The time. */
|
||||
final long time;
|
||||
|
||||
private int concurrencyIdx=-1;
|
||||
/**
|
||||
* Instantiates a new tx event.
|
||||
*
|
||||
@ -107,4 +108,13 @@ class TxEvent implements ITxEvent {
|
||||
public ITx getTransaction() {
|
||||
return loader.getTransaction(transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowIndex() {
|
||||
return concurrencyIdx;
|
||||
}
|
||||
|
||||
public void setConcurrencyIndex(int idx) {
|
||||
concurrencyIdx=idx;
|
||||
}
|
||||
}
|
||||
|
@ -15,12 +15,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
|
||||
/**
|
||||
* The Class TxGenerator.
|
||||
*/
|
||||
class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
class TxGenerator extends AbstractTxStream {
|
||||
|
||||
/** The stream. */
|
||||
TxStream stream;
|
||||
@ -45,16 +44,6 @@ class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
stream.addChild(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the stream.
|
||||
*
|
||||
* @return the stream
|
||||
*/
|
||||
@Override
|
||||
public IWaveform getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is same.
|
||||
*
|
||||
@ -94,13 +83,4 @@ class TxGenerator extends AbstractTxStream implements ITxGenerator {
|
||||
return stream.getKind();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return stream.getWidth();
|
||||
}
|
||||
}
|
||||
|
@ -55,40 +55,4 @@ class TxStream extends AbstractTxStream {
|
||||
return kind;
|
||||
}
|
||||
|
||||
/** The max concurrency. */
|
||||
private int maxConcurrency = 0;
|
||||
|
||||
/** The concurrency. */
|
||||
private int concurrency = 0;
|
||||
|
||||
/**
|
||||
* Sets the concurrency.
|
||||
*
|
||||
* @param concurrency the new concurrency
|
||||
*/
|
||||
void setConcurrency(int concurrency) {
|
||||
this.concurrency = concurrency;
|
||||
if (concurrency > maxConcurrency)
|
||||
maxConcurrency = concurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the concurrency.
|
||||
*
|
||||
* @return the concurrency
|
||||
*/
|
||||
int getConcurrency() {
|
||||
return this.concurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return maxConcurrency;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
|
@ -9,8 +9,8 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
@ -21,6 +21,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
@ -66,6 +67,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
@ -98,5 +100,5 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -4,7 +4,7 @@ Bundle-Name: SWT database widget
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||
Bundle-Version: 3.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
com.google.guava;bundle-version="15.0.0",
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
|
@ -10,9 +10,11 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
@ -21,8 +23,12 @@ import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
|
||||
@ -32,7 +38,7 @@ public class ArrowPainter implements IPainter {
|
||||
|
||||
private int yCtrlOffset = 30;
|
||||
|
||||
private WaveformCanvas waveCanvas;
|
||||
private final WaveformCanvas waveCanvas;
|
||||
|
||||
private ITx tx;
|
||||
|
||||
@ -48,8 +54,6 @@ public class ArrowPainter implements IPainter {
|
||||
|
||||
long scaleFactor;
|
||||
|
||||
boolean deferUpdate;
|
||||
|
||||
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
|
||||
this.waveCanvas = waveCanvas;
|
||||
highlightType=relationType;
|
||||
@ -78,40 +82,76 @@ public class ArrowPainter implements IPainter {
|
||||
}
|
||||
}
|
||||
|
||||
protected void calculateGeometries() {
|
||||
deferUpdate = false;
|
||||
private int getConcurrencyIndex(ITx tx) {
|
||||
IEvent[] eventList = tx.getStream().getEvents().floorEntry(tx.getBeginTime()).getValue();
|
||||
Optional<Integer> res = Arrays.stream(eventList).map(e -> ((ITxEvent)e).getRowIndex()).findFirst();
|
||||
return res.isPresent()? res.get():0;
|
||||
}
|
||||
|
||||
protected boolean calculateGeometries() {
|
||||
iRect.clear();
|
||||
oRect.clear();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(tx.getStream());
|
||||
if(painter == null)
|
||||
painter = waveCanvas.wave2painterMap.get(tx.getGenerator());
|
||||
if (painter == null) { // stream has been added but painter not yet
|
||||
// created
|
||||
deferUpdate = true;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getRowCount();
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * getConcurrencyIndex(tx),
|
||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
||||
deriveGeom(tx.getOutgoingRelations(), oRect, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
|
||||
for (ITxRelation iTxRelation : relations) {
|
||||
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
|
||||
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * otherTx.getConcurrencyIndex(),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||
height);
|
||||
Rectangle bb = createLinkEntry(otherTx, otherTx.getStream());
|
||||
if(bb!=null){
|
||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||
return;
|
||||
} else {
|
||||
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
|
||||
if(gen instanceof IWaveform) {
|
||||
bb = createLinkEntry(otherTx, (IWaveform) gen);
|
||||
if(bb!=null){
|
||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Rectangle createLinkEntry(ITx otherTx, IWaveform iWaveform) {
|
||||
if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
if(painter==null) {
|
||||
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
|
||||
if(gen instanceof IWaveform) {
|
||||
painter = waveCanvas.wave2painterMap.get(gen);
|
||||
if(painter!=null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(painter!=null) {
|
||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||
return new Rectangle(
|
||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||
height);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintArea(Projection proj, Rectangle clientRect) {
|
||||
yCtrlOffset = waveCanvas.styleProvider.getTrackHeight()/2;
|
||||
@ -119,11 +159,9 @@ public class ArrowPainter implements IPainter {
|
||||
Color highliteColor = waveCanvas.styleProvider.getColor(WaveformColors.REL_ARROW_HIGHLITE);
|
||||
|
||||
if(tx==null) return;
|
||||
if (!deferUpdate) {
|
||||
scaleFactor = waveCanvas.getScaleFactor();
|
||||
calculateGeometries();
|
||||
}
|
||||
if(deferUpdate) return;
|
||||
scaleFactor = waveCanvas.getScaleFactor();
|
||||
if(calculateGeometries())
|
||||
return;
|
||||
int correctionValue = (int)(selectionOffset);
|
||||
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
|
||||
for (LinkEntry entry : iRect) {
|
||||
|
@ -19,7 +19,7 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
public class RulerPainter implements IPainter {
|
||||
protected WaveformCanvas waveCanvas;
|
||||
protected final WaveformCanvas waveCanvas;
|
||||
|
||||
static final int RULER_TICK_MINOR = 10;
|
||||
static final int RULER_TICK_MAJOR = 100;
|
||||
|
@ -10,10 +10,9 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
@ -37,19 +36,26 @@ public class StreamPainter extends TrackPainter{
|
||||
private IWaveform stream;
|
||||
private int txBase;
|
||||
private int txHeight;
|
||||
private TreeSet<ITx> seenTx;
|
||||
private TreeMap<ITx, ITxEvent> seenTx;
|
||||
|
||||
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
||||
super(trackEntry, even);
|
||||
this.waveCanvas = waveCanvas;
|
||||
this.stream=trackEntry.waveform;
|
||||
this.seenTx=new TreeSet<>();
|
||||
this.seenTx=new TreeMap<>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getWidth();
|
||||
int trackHeight=trackEntry.height/stream.getRowCount();
|
||||
if(stream.getEvents().size()==0) {
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
proj.setLineWidth(1);
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
return;
|
||||
}
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected) {
|
||||
@ -65,8 +71,8 @@ public class StreamPainter extends TrackPainter{
|
||||
long beginTime = beginPos*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
Entry<Long, IEvent[]> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, IEvent[]> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
|
||||
if(lastTx==null) lastTx=stream.getEvents().lastEntry();
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
@ -77,46 +83,51 @@ public class StreamPainter extends TrackPainter{
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
if(firstTx==lastTx) {
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||
drawTx(proj, area, txEvent.getTransaction(), false);
|
||||
for(IEvent txEvent: firstTx.getValue())
|
||||
drawTx(proj, area, ((ITxEvent)txEvent).getTransaction(), ((ITxEvent)txEvent).getRowIndex(), false);
|
||||
}else{
|
||||
seenTx.clear();
|
||||
NavigableMap<Long, IEvent[]> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||
boolean highlighed=false;
|
||||
ITxEvent highlighed=null;
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1;
|
||||
for(Entry<Long, IEvent[]> entry: entries.entrySet())
|
||||
for(IEvent evt:entry.getValue()){
|
||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||
highlighed|=selectedId==tx.getId();
|
||||
for(IEvent e:entry.getValue()){
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx = evt.getTransaction();
|
||||
if(selectedId==tx.getId())
|
||||
highlighed=evt;
|
||||
switch(evt.getKind()) {
|
||||
case BEGIN:
|
||||
seenTx.add(tx);
|
||||
seenTx.put(tx, evt);
|
||||
break;
|
||||
case END:
|
||||
drawTx(proj, area, tx, evt.getRowIndex(), false);
|
||||
seenTx.remove(tx);
|
||||
break;
|
||||
case SINGLE:
|
||||
drawTx(proj, area, tx, false);
|
||||
drawTx(proj, area, tx, evt.getRowIndex(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(ITx tx:seenTx){
|
||||
drawTx(proj, area, tx, false);
|
||||
}
|
||||
if(highlighed){
|
||||
seenTx.entrySet().stream().forEach(e -> {
|
||||
drawTx(proj, area, e.getKey(), e.getValue().getRowIndex(), false);
|
||||
});
|
||||
|
||||
if(highlighed!=null){
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE_HIGHLITE));
|
||||
drawTx(proj, area, waveCanvas.currentSelection, true);
|
||||
drawTx(proj, area, highlighed.getTransaction(), highlighed.getRowIndex(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, int concurrencyIndex, boolean highlighted ) {
|
||||
// compute colors
|
||||
Color[] transColor = waveCanvas.styleProvider.computeColor( tx.getGenerator().getName());
|
||||
|
||||
proj.setBackground(transColor[highlighted?1:0]);
|
||||
|
||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.styleProvider.getTrackHeight();
|
||||
int offset = concurrencyIndex*this.waveCanvas.styleProvider.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
|
||||
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
|
||||
@ -164,25 +175,19 @@ public class StreamPainter extends TrackPainter{
|
||||
|
||||
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, IEvent[]> firstTx) {
|
||||
long timePoint=offset*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)&&
|
||||
tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
// now with some fuzziness
|
||||
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointLow=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE) &&
|
||||
tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
for(IEvent e:firstTx.getValue()){
|
||||
if(e instanceof ITxEvent) {
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx=evt.getTransaction();
|
||||
if(
|
||||
(evt.getKind()==EventKind.SINGLE && evt.getTime()==timePoint) ||
|
||||
(evt.getKind()==EventKind.SINGLE && evt.getTime()>timePointLow && evt.getTime()<timePointHigh) ||
|
||||
(evt.getKind()==EventKind.BEGIN && evt.getRowIndex()==lane && evt.getTime()<=timePoint && tx.getEndTime()>=timePoint)
|
||||
){
|
||||
return tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -11,10 +11,12 @@
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
@ -32,9 +34,11 @@ import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.ScrollBar;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
@ -175,10 +179,10 @@ public class WaveformCanvas extends Canvas {
|
||||
|
||||
public void setZoomLevel(int level, long centerTime) {
|
||||
//FIXME: keep center if zoom-out and cursor is not in view
|
||||
long oldScaleFactor=scaleFactor;
|
||||
if(level<0) level = 0;
|
||||
long xc=centerTime/this.scaleFactor; // cursor total x-offset
|
||||
if(level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length){
|
||||
this.scaleFactor = (long) Math.pow(10, level/2d);
|
||||
this.scaleFactor = (long) Math.pow(10, level>>1);
|
||||
if(level%2==1) this.scaleFactor*=3;
|
||||
ITx tx = arrowPainter.getTx();
|
||||
arrowPainter.setTx(null);
|
||||
@ -188,7 +192,6 @@ public class WaveformCanvas extends Canvas {
|
||||
* xcn = tc/newScaleFactor
|
||||
* t0n = (xcn-xoffs)*scaleFactor
|
||||
*/
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
@ -424,13 +427,17 @@ public class WaveformCanvas extends Canvas {
|
||||
}
|
||||
for (IWaveformPainter painter : wave2painterMap.values()) {
|
||||
if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
|
||||
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * tx.getConcurrencyIndex();
|
||||
int bottom = top + styleProvider.getTrackHeight();
|
||||
if (top < -origin.y) {
|
||||
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
|
||||
} else if (bottom > (size.y - origin.y)) {
|
||||
setOrigin(origin.x, size.y - bottom);
|
||||
}
|
||||
Entry<Long, IEvent[]> entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime());
|
||||
Optional<IEvent> res = Arrays.stream(entry.getValue()).filter(e -> ((ITxEvent)e).getTransaction().equals(tx)).findFirst();
|
||||
if(res.isPresent()) {
|
||||
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * ((ITxEvent)res.get()).getRowIndex();
|
||||
int bottom = top + styleProvider.getTrackHeight();
|
||||
if (top < -origin.y) {
|
||||
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
|
||||
} else if (bottom > (size.y - origin.y)) {
|
||||
setOrigin(origin.x, size.y - bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ public class WaveformView implements IWaveformView {
|
||||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getWidth();
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
@ -579,17 +579,18 @@ public class WaveformView implements IWaveformView {
|
||||
entry.currentValue = Double.toString(val);
|
||||
}
|
||||
} else if (entry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
ITx[] resultsList = new ITx[entry.waveform.getWidth()];
|
||||
ITx[] resultsList = new ITx[entry.waveform.getRowCount()];
|
||||
Entry<Long, IEvent[]> firstTx = entry.waveform.getEvents().floorEntry(time);
|
||||
if (firstTx != null) {
|
||||
do {
|
||||
for (IEvent evt : firstTx.getValue()) {
|
||||
if (evt instanceof ITxEvent) {
|
||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||
for (IEvent e : firstTx.getValue()) {
|
||||
if (e instanceof ITxEvent) {
|
||||
ITxEvent evt = ((ITxEvent) e);
|
||||
ITx tx = evt.getTransaction();
|
||||
if ((evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)
|
||||
&& tx.getBeginTime() <= time && tx.getEndTime() >= time
|
||||
&& resultsList[tx.getConcurrencyIndex()] == null)
|
||||
resultsList[tx.getConcurrencyIndex()] = ((ITxEvent) evt).getTransaction();
|
||||
&& resultsList[evt.getRowIndex()] == null)
|
||||
resultsList[evt.getRowIndex()] = evt.getTransaction();
|
||||
}
|
||||
}
|
||||
firstTx = entry.waveform.getEvents().lowerEntry(firstTx.getKey());
|
||||
@ -1036,7 +1037,7 @@ public class WaveformView implements IWaveformView {
|
||||
TrackEntry trackEntry = trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
@ -1044,7 +1045,7 @@ public class WaveformView implements IWaveformView {
|
||||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = styleProvider.getTrackHeight();
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
||||
}
|
||||
}
|
||||
@ -1065,7 +1066,7 @@ public class WaveformView implements IWaveformView {
|
||||
TrackEntry trackEntry = trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
@ -1073,7 +1074,7 @@ public class WaveformView implements IWaveformView {
|
||||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = styleProvider.getTrackHeight();
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue,
|
||||
entry.getValue().selected);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
|
@ -1,8 +1,10 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -4,7 +4,7 @@ Bundle-Name: VCD signal database
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
||||
Bundle-Version: 2.2.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||
com.google.guava;bundle-version="15.0.0"
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
@ -204,7 +204,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||
@Override
|
||||
public int getNetWidth(int intValue) {
|
||||
VCDSignal<?> signal = (VCDSignal<?>) signals.get(intValue);
|
||||
return signal.getWidth();
|
||||
return signal.getRowCount();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -109,7 +109,7 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
public int getRowCount() {
|
||||
return width;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,9 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -4,7 +4,7 @@ Bundle-Name: Waveform database
|
||||
Bundle-SymbolicName: com.minres.scviewer.database
|
||||
Bundle-Version: 3.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Export-Package: com.minres.scviewer.database,
|
||||
com.minres.scviewer.database.tx
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
@ -12,6 +12,7 @@ package com.minres.scviewer.database;
|
||||
|
||||
import java.util.NavigableMap;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface IWaveform.
|
||||
*
|
||||
@ -76,6 +77,6 @@ public interface IWaveform extends IHierNode {
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
public int getRowCount();
|
||||
|
||||
}
|
||||
|
@ -123,31 +123,31 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
|
||||
*/
|
||||
@Override
|
||||
public boolean load(File inp) {
|
||||
boolean retval = true;
|
||||
for (IWaveformDbLoader loader : loaders) {
|
||||
if (loader.canLoad(inp)) {
|
||||
loader.addPropertyChangeListener(this);
|
||||
try {
|
||||
loader.addPropertyChangeListener(this);
|
||||
loader.load(this, inp);
|
||||
loader.removePropertyChangeListener(this);
|
||||
for (IWaveform w : loader.getAllWaves()) {
|
||||
waveforms.put(w.getFullName(), w);
|
||||
}
|
||||
if (loader.getMaxTime() > maxTime) {
|
||||
maxTime = loader.getMaxTime();
|
||||
}
|
||||
if (name == null)
|
||||
name = getFileBasename(inp.getName());
|
||||
buildHierarchyNodes();
|
||||
relationTypes.addAll(loader.getAllRelationTypes());
|
||||
pcs.firePropertyChange(IHierNode.LOADING_FINISHED, null, null);
|
||||
loaded = true;
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
retval=false;
|
||||
}
|
||||
loader.removePropertyChangeListener(this);
|
||||
for (IWaveform w : loader.getAllWaves()) {
|
||||
waveforms.put(w.getFullName(), w);
|
||||
}
|
||||
if (loader.getMaxTime() > maxTime) {
|
||||
maxTime = loader.getMaxTime();
|
||||
}
|
||||
if (name == null)
|
||||
name = getFileBasename(inp.getName());
|
||||
buildHierarchyNodes();
|
||||
relationTypes.addAll(loader.getAllRelationTypes());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
pcs.firePropertyChange(IHierNode.LOADING_FINISHED, null, null);
|
||||
loaded = true;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,14 +226,13 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (childNode != null) {
|
||||
if (childNode == null) {
|
||||
HierNode newNode = new HierNode(name, node);
|
||||
node.addChild(newNode);
|
||||
node = newNode;
|
||||
} else {
|
||||
node = childNode;
|
||||
break;
|
||||
}
|
||||
HierNode newNode = new HierNode(name, node);
|
||||
node.addChild(newNode);
|
||||
node = newNode;
|
||||
|
||||
}
|
||||
node.addChild(waveform);
|
||||
waveform.setParent(node);
|
||||
|
@ -39,7 +39,7 @@ public interface ITx extends Comparable<ITx> {
|
||||
*
|
||||
* @return the generator
|
||||
*/
|
||||
public ITxGenerator getGenerator();
|
||||
public IWaveform getGenerator();
|
||||
|
||||
/**
|
||||
* Gets the begin time.
|
||||
@ -55,13 +55,6 @@ public interface ITx extends Comparable<ITx> {
|
||||
*/
|
||||
public Long getEndTime();
|
||||
|
||||
/**
|
||||
* Gets the concurrency index.
|
||||
*
|
||||
* @return the concurrency index
|
||||
*/
|
||||
public int getConcurrencyIndex();
|
||||
|
||||
/**
|
||||
* Gets the attributes.
|
||||
*
|
||||
|
@ -30,4 +30,12 @@ public interface ITxEvent extends IEvent {
|
||||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction();
|
||||
|
||||
/**
|
||||
* Gets the concurrency index.
|
||||
*
|
||||
* @return the concurrency index
|
||||
*/
|
||||
public int getRowIndex();
|
||||
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.tx;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
|
||||
/**
|
||||
* The Interface ITxGenerator.
|
||||
*/
|
||||
public interface ITxGenerator extends IWaveform {
|
||||
|
||||
/**
|
||||
* Gets the stream.
|
||||
*
|
||||
* @return the stream
|
||||
*/
|
||||
public IWaveform getStream();
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
|
@ -1,13 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.11.0.qualifier
|
||||
Bundle-Version: 2.12.1
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
@ -36,7 +36,7 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.equinox.p2.engine;bundle-version="2.6.600",
|
||||
org.eclipse.equinox.p2.operations;bundle-version="2.5.700",
|
||||
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.3.400"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Import-Package: com.minres.scviewer.database,
|
||||
javax.inject;version="1.0.0"
|
||||
Automatic-Module-Name: com.minres.scviewer.e4.application
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 700 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/stream.png
Executable file → Normal file
BIN
plugins/com.minres.scviewer.e4.application/icons/stream.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 536 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/stream_hier.png
Executable file
BIN
plugins/com.minres.scviewer.e4.application/icons/stream_hier.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 688 B |
@ -3,11 +3,10 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||
<version>2.11.0-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
@ -482,6 +482,7 @@ public class HeapStatus extends Composite {
|
||||
});
|
||||
}
|
||||
};
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ public class DesignBrowser {
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider(true));
|
||||
treeViewer.addFilter(treeAttributeFilter);
|
||||
treeViewer.setUseHashlookup(true);
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
@ -252,7 +252,7 @@ public class DesignBrowser {
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider(false));
|
||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
txTableViewer.addFilter(tableAttributeFilter);
|
||||
txTableViewer.addDoubleClickListener(event -> {
|
||||
|
@ -337,7 +337,11 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
if(f instanceof File) {
|
||||
if(matchers.isEmpty()) return true;
|
||||
for (PathMatcher m : matchers) {
|
||||
try {
|
||||
if(m.matches(((File)f).toPath())) return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -37,7 +37,6 @@ import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||
@ -78,6 +77,8 @@ public class TransactionList extends Composite {
|
||||
|
||||
private TableViewer tableViewer = null;
|
||||
|
||||
Thread updateThread = null;
|
||||
|
||||
private TableColumn valueColumn = null;
|
||||
|
||||
private AttributeLabelProvider valueLabelProvider = null;
|
||||
@ -86,8 +87,6 @@ public class TransactionList extends Composite {
|
||||
|
||||
private ObservableList<AttributeNameBean> attrNames = new WritableList<>();
|
||||
|
||||
private List<ITx> eventList = new ArrayList<>();
|
||||
|
||||
private List<ITx> emptyList = new ArrayList<>();
|
||||
|
||||
TxFilter txFilter;
|
||||
@ -244,56 +243,48 @@ public class TransactionList extends Composite {
|
||||
} else if(stream != trackEntry.waveform) {
|
||||
stream=trackEntry.waveform;
|
||||
tableViewer.setInput(emptyList);
|
||||
new Thread() {
|
||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<>();
|
||||
|
||||
private List<AttributeNameBean> getEntries() {
|
||||
return propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
eventList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)
|
||||
.map(evt-> {
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
for(ITxAttribute attr: tx.getAttributes()) {
|
||||
propNames.put(attr.getName(), attr.getDataType());
|
||||
}
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tableViewer.setInput(eventList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(getEntries());
|
||||
if(!attrNames.isEmpty())
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null) {
|
||||
searchPropComboViewer.setInput(attrNames);
|
||||
Object sel = searchPropComboViewer.getElementAt(0);
|
||||
if(sel!=null) searchPropComboViewer.setSelection(new StructuredSelection(sel));
|
||||
}
|
||||
tableViewer.refresh(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
try{
|
||||
if(updateThread!=null)
|
||||
updateThread.interrupt();
|
||||
}catch(SecurityException e){}
|
||||
updateThread = new Thread(()-> {
|
||||
final ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<>();
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
final List<ITx> txList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)
|
||||
.map(evt-> {
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
tx.getAttributes().forEach(attr -> propNames.put(attr.getName(), attr.getDataType()));
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
final List<AttributeNameBean> newAttrNames=propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(() -> {
|
||||
tableViewer.setInput(txList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(newAttrNames);
|
||||
if(!attrNames.isEmpty())
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null)
|
||||
searchPropComboViewer.refresh();
|
||||
if (viewPropComboViewer!=null)
|
||||
viewPropComboViewer.refresh();
|
||||
});
|
||||
updateThread=null;
|
||||
});
|
||||
updateThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSearchProps(String propName, DataType type, String propValue) {
|
||||
for(int i=0; i<attrNames.size(); ++i) {
|
||||
AttributeNameBean e = attrNames.get(i);
|
||||
if(propName.equals(e.getName()) && type.equals(e.getType())) {
|
||||
for(int i=0; i<searchPropComboViewer.getCombo().getItemCount(); ++i) {
|
||||
String itemName = searchPropComboViewer.getCombo().getItem(i);
|
||||
if(propName.equals(itemName)) {
|
||||
searchPropComboViewer.getCombo().select(i);
|
||||
break;
|
||||
}
|
||||
|
@ -52,12 +52,17 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
/**
|
||||
* Instantiates a new tx db label provider.
|
||||
*/
|
||||
public TxDbLabelProvider() {
|
||||
public TxDbLabelProvider(boolean isTree) {
|
||||
super();
|
||||
loadinDatabase=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
database=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
folder=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if(isTree) {
|
||||
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream_hier.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
}
|
||||
signal=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
wave=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
@ -134,7 +139,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
@ -159,7 +164,13 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
*/
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
return ((IHierNode)element).getName();
|
||||
if(element instanceof IWaveformDb){
|
||||
IWaveformDb db = (IWaveformDb) element;
|
||||
if(db.getName()== null)
|
||||
return "";
|
||||
return db.getName()+(db.isLoaded()?"":" (loading)");
|
||||
} else
|
||||
return ((IHierNode)element).getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -33,7 +33,6 @@
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
|
@ -1,13 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
|
@ -18,7 +18,7 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
org.eclipse.osgi,
|
||||
org.eclipse.core.expressions;bundle-version="3.4.600",
|
||||
org.eclipse.jface
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.google.common.collect
|
||||
Service-Component: OSGI-INF/component.xml
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
@ -77,7 +77,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
|
23
pom.xml
23
pom.xml
@ -4,10 +4,10 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>com.minres.scviewer.target</module>
|
||||
<module>releng/com.minres.scviewer.target</module>
|
||||
<module>plugins/com.minres.scviewer.database</module>
|
||||
<module>plugins/com.minres.scviewer.database.sqlite</module>
|
||||
<module>plugins/com.minres.scviewer.database.text</module>
|
||||
@ -21,13 +21,11 @@
|
||||
<module>features/com.minres.scviewer.feature</module>
|
||||
<module>features/com.minres.scviewer.e4.platform.feature</module>
|
||||
<module>features/com.minres.scviewer.e4.feature</module>
|
||||
<module>p2repositories//com.minres.scviewer.updateSite</module>
|
||||
<module>releng/com.minres.scviewer.updateSite</module>
|
||||
<module>products/com.minres.scviewer.e4.product</module>
|
||||
<module>products/com.minres.scviewer.e4.product_slim</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project-version>2.11.0-SNAPSHOT</project-version>
|
||||
<tycho-version>1.5.0</tycho-version>
|
||||
<groovy-eclipse-compiler-version>3.6.0-03</groovy-eclipse-compiler-version>
|
||||
<groovy-eclipse-batch-version>3.0.3-01</groovy-eclipse-batch-version>
|
||||
@ -35,6 +33,19 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>parse-version</id>
|
||||
<goals>
|
||||
<goal>parse-version</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-maven-plugin</artifactId>
|
||||
@ -56,7 +67,7 @@
|
||||
<artifact>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.target</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
</artifact>
|
||||
</target>
|
||||
<environments>
|
||||
|
@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.11.0</version>
|
||||
<version>2.12.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||
<version>2.11.0-SNAPSHOT</version>
|
||||
<version>2.12.1</version>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<build>
|
||||
@ -46,7 +46,7 @@
|
||||
<products>
|
||||
<product>
|
||||
<id>product</id>
|
||||
<archiveFileName>SCViewer-${project.version}</archiveFileName>
|
||||
<archiveFileName>SCViewer-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</archiveFileName>
|
||||
<rootFolders>
|
||||
<macosx>SCViewer.app</macosx>
|
||||
</rootFolders>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.11.0.qualifier" useFeatures="true" includeLaunchers="true">
|
||||
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.12.1" useFeatures="true" includeLaunchers="true">
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
@ -9,7 +9,7 @@
|
||||
<launcherArgs>
|
||||
<programArgs>-clearPersistedState
|
||||
</programArgs>
|
||||
<vmArgs>-Xmx2G -Dosgi.instance.area=@user.home/.scviewer -Dosgi.instance.area.default=@user.home/.scviewer
|
||||
<vmArgs>-Xms64m -Xmx2G -Dosgi.instance.area=@user.home/.scviewer -Dosgi.instance.area.default=@user.home/.scviewer --add-modules=ALL-SYSTEM -Dfile.encoding=UTF-8
|
||||
</vmArgs>
|
||||
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
|
||||
</vmArgsMac>
|
||||
@ -34,9 +34,9 @@
|
||||
</launcher>
|
||||
|
||||
<vm>
|
||||
<linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
|
||||
<macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>
|
||||
<windows include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</windows>
|
||||
<linux include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</linux>
|
||||
<macos include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</macos>
|
||||
<windows include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11</windows>
|
||||
</vm>
|
||||
|
||||
<license>
|
||||
|
@ -1 +0,0 @@
|
||||
/target/
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.minres.scviewer.e4.product_slim</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 290 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user