From a737f5588d5843b2a728c24d863a765c2465dd2e Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Tue, 21 Feb 2023 20:03:59 +0100 Subject: [PATCH 1/3] fixes entries in product definition --- products/com.minres.scviewer.e4.product/scviewer.product | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index 237a44b..bbd2b96 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + @@ -67,8 +67,8 @@ - + @@ -79,7 +79,7 @@ - + From 3b57ec029bf86d795863e5144af8b8fec3491b57 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 22 Feb 2023 07:24:02 +0100 Subject: [PATCH 2/3] adds support for compressed FTR --- .../scviewer/database/ftr/FtrDbLoader.java | 73 ++++++++++++++---- .../inputs/my_db_c.ftr | Bin 0 -> 1497 bytes .../database/test/DatabaseServicesTest.java | 34 ++++++++ 3 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 tests/com.minres.scviewer.database.test/inputs/my_db_c.ftr diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java index d2f0ba0..1157f0f 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -17,15 +17,13 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.TreeMap; +import org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorInputStream; import org.eclipse.collections.impl.map.mutable.UnifiedMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +40,6 @@ import com.minres.scviewer.database.RelationType; import com.minres.scviewer.database.RelationTypeFactory; import com.minres.scviewer.database.tx.ITx; import com.minres.scviewer.database.tx.ITxAttribute; -import com.minres.scviewer.database.RelationType; import jacob.CborDecoder; import jacob.CborType; @@ -97,9 +94,8 @@ public class FtrDbLoader implements IWaveformDbLoader { /** The pcs. */ protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); - /** The Constant x. */ - static final byte[] x = "scv_tr_stream".getBytes(); - + long time_scale_factor = 1000l; + /** * Adds the property change listener. * @@ -203,9 +199,17 @@ public class FtrDbLoader implements IWaveformDbLoader { try(FileInputStream fis = new FileInputStream(file)) { FileChannel fc = fis.getChannel(); for (Long offset : fileOffsets) { - fc.position(offset); - CborDecoder parser = new CborDecoder(fis); - ret.add(parser.readByteString()); + if(offset>=0) { + fc.position(offset); + CborDecoder parser = new CborDecoder(fis); + ret.add(parser.readByteString()); + } else { + fc.position(-offset); + CborDecoder parser = new CborDecoder(fis); + BlockLZ4CompressorInputStream decomp = new BlockLZ4CompressorInputStream(new ByteArrayInputStream(parser.readByteString())); + ret.add(decomp.readAllBytes()); + decomp.close(); + } } } catch (Exception e) { LOG.error("Error parsing file "+file.getName(), e); @@ -318,16 +322,40 @@ public class FtrDbLoader implements IWaveformDbLoader { while(next != null && !break_type.isEqualType(next)) { long tag = readTag(); switch((int)tag) { - case 6: // info + case 6: { // info + CborDecoder cbd = new CborDecoder(new ByteArrayInputStream(readByteString())); + long sz = cbd.readArrayLength(); + assert(sz==3); + long time_numerator=cbd.readInt(); + long time_denominator=cbd.readInt(); + loader.time_scale_factor = 1000000000000000l*time_numerator/time_denominator; + long epoch_tag = cbd.readTag(); + assert(epoch_tag==1); + cbd.readInt(); // epoch break; + } case 8: { // dictionary uncompressed parseDict(new CborDecoder(new ByteArrayInputStream(readByteString()))); break; } + case 9: { // dictionary compressed + long sz = readArrayLength(); + assert(sz==2); + readInt(); // uncompressed size + parseDict(new CborDecoder(new BlockLZ4CompressorInputStream(new ByteArrayInputStream(readByteString())))); + break; + } case 10: { // directory uncompressed parseDir(new CborDecoder(new ByteArrayInputStream(readByteString()))); break; } + case 11: { // directory compressed + long sz = readArrayLength(); + assert(sz==2); + readInt(); // uncompressed size + parseDir(new CborDecoder(new BlockLZ4CompressorInputStream(new ByteArrayInputStream(readByteString())))); + break; + } case 12: { //tx chunk uncompressed long len = readArrayLength(); assert(len==2); @@ -337,10 +365,29 @@ public class FtrDbLoader implements IWaveformDbLoader { parseTx(txStream, txStream.fileOffsets.size()-1, readByteString()); break; } + case 13: { //tx chunk compressed + long len = readArrayLength(); + assert(len==3); + long stream_id = readInt(); + readInt(); // uncompressed size + TxStream txStream = loader.txStreams.get(stream_id); + txStream.fileOffsets.add(0-inputStream.getChannel().position()); + BlockLZ4CompressorInputStream decomp = new BlockLZ4CompressorInputStream(new ByteArrayInputStream(readByteString())); + parseTx(txStream, txStream.fileOffsets.size()-1, decomp.readAllBytes()); + decomp.close(); + break; + } case 14: { // relations uncompressed parseRel(new CborDecoder(new ByteArrayInputStream(readByteString()))); break; } + case 15: { // relations uncompressed + long sz = readArrayLength(); + assert(sz==2); + readInt(); // uncompressed size + parseRel(new CborDecoder(new BlockLZ4CompressorInputStream(new ByteArrayInputStream(readByteString())))); + break; + } } next = peekType(); } @@ -413,8 +460,8 @@ public class FtrDbLoader implements IWaveformDbLoader { assert(len==4); long txId = cborDecoder.readInt(); long genId = cborDecoder.readInt(); - long startTime = cborDecoder.readInt()*1000; //TODO: scale based on info - long endTime = cborDecoder.readInt()*1000; //TODO: scale based on info + long startTime = cborDecoder.readInt()*loader.time_scale_factor; + long endTime = cborDecoder.readInt()*loader.time_scale_factor; TxGenerator gen = loader.txGenerators.get(genId); FtrTx scvTx = new FtrTx(txId, gen.stream.getId(), genId, startTime, endTime, blockId, blockOffset); loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime; diff --git a/tests/com.minres.scviewer.database.test/inputs/my_db_c.ftr b/tests/com.minres.scviewer.database.test/inputs/my_db_c.ftr new file mode 100644 index 0000000000000000000000000000000000000000..c207da3b0581fcd7c2bb3f8bb757e1fdd01e1b90 GIT binary patch literal 1497 zcmXw(-%DF(7{{OY5*@1AnaC5oQx;>5q;qf}E*wvM>{$u4q-HbJ0 za&hLPqB3i}dUD}bezB;|hKQ*Y_Z3tct$%O1lr`xKzx8X$_XG<|!{hABYIJRNXO+oh zko-nvSGXPYRMa^*eNDg&{SCqd=)n(fs+A%)q;$&SjsI?R|;}l6pw+9q>Frc?pt++5ni2)j(~4|F;w!GtRNBV*<{`pr&6s=r4(n zfblS3aH3+6{-zGwb*e-`LVFTMW|j?D8723`usxC8icAf3Z*F^l%OuurjSrL=V74+xq&jm zqe2BZhq{@^P)B$iwaF8xn|TZFCT|64M4jPXsI&Y$>MZX@ V-NP@S?%} waveforms = waveformDb.getAllWaves(); + assertEquals(8, waveforms.size()); + assertEquals(1, waveformDb.getChildNodes().size()); + for(IWaveform w:waveforms) { + if(w.getId()==1) { + assertEquals(2, w.getRowCount()); + } else if(w.getId()==2l) { + assertEquals(1, w.getRowCount()); + } else if(w.getId()==3l) { + assertEquals(1, w.getRowCount()); + } + } + //waveforms.stream().filter(s -> s.getId()==1).collect(Collectors.toList()); + waveforms.stream().filter(s -> s.getId()==1).forEach(s -> { + assertEquals(27, s.getEvents().size()); + }); + waveforms.stream().filter(s -> s.getId()==1).map(s -> s.getEventsAtTime(0)).forEach(el -> { + assertEquals(1, el.length); + IEvent evt = el[0]; + assertTrue(evt instanceof ITxEvent); + ITx tx = ((ITxEvent)evt).getTransaction(); + assertNotNull(tx); + assertEquals(0, tx.getBeginTime()); + assertEquals(280000000, tx.getEndTime()); + List attr = tx.getAttributes(); + assertEquals(3, attr.size()); + }); + } } From ebf3f920bf251b6828eb3e467e80f141645a02be Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 22 Feb 2023 07:29:26 +0100 Subject: [PATCH 3/3] updates version numbers --- doc/com.minres.scviewer.doc/pom.xml | 2 +- features/com.minres.scviewer.database.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.help.feature/pom.xml | 2 +- features/com.minres.scviewer.e4.platform.feature/pom.xml | 2 +- features/com.minres.scviewer.feature/pom.xml | 2 +- features/com.minres.scviewer.ui.feature/pom.xml | 2 +- plugins/com.minres.scviewer.database.ftr/pom.xml | 2 +- plugins/com.minres.scviewer.database.sqlite/pom.xml | 2 +- plugins/com.minres.scviewer.database.text/pom.xml | 2 +- plugins/com.minres.scviewer.database.ui.swt/pom.xml | 2 +- plugins/com.minres.scviewer.database.vcd/pom.xml | 2 +- plugins/com.minres.scviewer.database/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.e4.application.help/pom.xml | 2 +- .../com.minres.scviewer.e4.application/META-INF/MANIFEST.MF | 2 +- plugins/com.minres.scviewer.e4.application/pom.xml | 2 +- plugins/com.minres.scviewer.ui/pom.xml | 2 +- pom.xml | 4 ++-- products/com.minres.scviewer.e4.product/pom.xml | 4 ++-- products/com.minres.scviewer.e4.product/scviewer.product | 2 +- releng/com.minres.scviewer.target/pom.xml | 2 +- releng/com.minres.scviewer.updateSite/pom.xml | 2 +- tests/com.minres.scviewer.database.test/pom.xml | 2 +- 24 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/com.minres.scviewer.doc/pom.xml b/doc/com.minres.scviewer.doc/pom.xml index 27d7d1a..312f53b 100644 --- a/doc/com.minres.scviewer.doc/pom.xml +++ b/doc/com.minres.scviewer.doc/pom.xml @@ -7,7 +7,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. diff --git a/features/com.minres.scviewer.database.feature/pom.xml b/features/com.minres.scviewer.database.feature/pom.xml index 0cf5a2a..cd91068 100644 --- a/features/com.minres.scviewer.database.feature/pom.xml +++ b/features/com.minres.scviewer.database.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 3.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.feature/pom.xml b/features/com.minres.scviewer.e4.feature/pom.xml index 368c1a7..cfec10a 100644 --- a/features/com.minres.scviewer.e4.feature/pom.xml +++ b/features/com.minres.scviewer.e4.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.help.feature/pom.xml b/features/com.minres.scviewer.e4.help.feature/pom.xml index 5d0c641..1192a6b 100644 --- a/features/com.minres.scviewer.e4.help.feature/pom.xml +++ b/features/com.minres.scviewer.e4.help.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 1.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.e4.platform.feature/pom.xml b/features/com.minres.scviewer.e4.platform.feature/pom.xml index 6cc5df3..8fc5ccf 100644 --- a/features/com.minres.scviewer.e4.platform.feature/pom.xml +++ b/features/com.minres.scviewer.e4.platform.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 1.0.0-SNAPSHOT diff --git a/features/com.minres.scviewer.feature/pom.xml b/features/com.minres.scviewer.feature/pom.xml index 67f14a9..f7c89d0 100644 --- a/features/com.minres.scviewer.feature/pom.xml +++ b/features/com.minres.scviewer.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 1.1.0-SNAPSHOT diff --git a/features/com.minres.scviewer.ui.feature/pom.xml b/features/com.minres.scviewer.ui.feature/pom.xml index f98fb1c..ced77a1 100644 --- a/features/com.minres.scviewer.ui.feature/pom.xml +++ b/features/com.minres.scviewer.ui.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 1.1.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.ftr/pom.xml b/plugins/com.minres.scviewer.database.ftr/pom.xml index b35f6b7..00217c0 100644 --- a/plugins/com.minres.scviewer.database.ftr/pom.xml +++ b/plugins/com.minres.scviewer.database.ftr/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.sqlite/pom.xml b/plugins/com.minres.scviewer.database.sqlite/pom.xml index 38f7d5c..9c4ac8f 100644 --- a/plugins/com.minres.scviewer.database.sqlite/pom.xml +++ b/plugins/com.minres.scviewer.database.sqlite/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.text/pom.xml b/plugins/com.minres.scviewer.database.text/pom.xml index 645facd..81881c1 100644 --- a/plugins/com.minres.scviewer.database.text/pom.xml +++ b/plugins/com.minres.scviewer.database.text/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database.ui.swt/pom.xml b/plugins/com.minres.scviewer.database.ui.swt/pom.xml index c8c1553..806f54e 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/pom.xml +++ b/plugins/com.minres.scviewer.database.ui.swt/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. 4.0.0-SNAPSHOT diff --git a/plugins/com.minres.scviewer.database.vcd/pom.xml b/plugins/com.minres.scviewer.database.vcd/pom.xml index 7fe350b..dae5ea0 100644 --- a/plugins/com.minres.scviewer.database.vcd/pom.xml +++ b/plugins/com.minres.scviewer.database.vcd/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.database/pom.xml b/plugins/com.minres.scviewer.database/pom.xml index 593105a..ea83e1c 100644 --- a/plugins/com.minres.scviewer.database/pom.xml +++ b/plugins/com.minres.scviewer.database/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF index 6e54435..10ffb53 100644 --- a/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.e4.application.help/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: SCViewer Help Bundle-SymbolicName: com.minres.scviewer.e4.application.help;singleton:=true -Bundle-Version: 2.17.0 +Bundle-Version: 2.17.1 Bundle-Vendor: MINRES Technologies GmbH Automatic-Module-Name: com.minres.scviewer.e4.application.help Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/plugins/com.minres.scviewer.e4.application.help/pom.xml b/plugins/com.minres.scviewer.e4.application.help/pom.xml index c913303..fd8ce25 100644 --- a/plugins/com.minres.scviewer.e4.application.help/pom.xml +++ b/plugins/com.minres.scviewer.e4.application.help/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index b3c837d..f6fc855 100644 --- a/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF @@ -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.17.0 +Bundle-Version: 2.17.1 Bundle-Vendor: %Bundle-Vendor Require-Bundle: javax.inject;bundle-version="1.0.0", org.eclipse.core.runtime;bundle-version="3.11.1", diff --git a/plugins/com.minres.scviewer.e4.application/pom.xml b/plugins/com.minres.scviewer.e4.application/pom.xml index 673a2e5..e67949b 100644 --- a/plugins/com.minres.scviewer.e4.application/pom.xml +++ b/plugins/com.minres.scviewer.e4.application/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/plugins/com.minres.scviewer.ui/pom.xml b/plugins/com.minres.scviewer.ui/pom.xml index 33d8616..43bd5ae 100644 --- a/plugins/com.minres.scviewer.ui/pom.xml +++ b/plugins/com.minres.scviewer.ui/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-plugin diff --git a/pom.xml b/pom.xml index e5ce28d..aca5226 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 pom releng/com.minres.scviewer.target @@ -70,7 +70,7 @@ com.minres.scviewer com.minres.scviewer.target - 2.17.0 + 2.17.1 org.eclipse.justj.openjdk.hotspot.jre.minimal-15 diff --git a/products/com.minres.scviewer.e4.product/pom.xml b/products/com.minres.scviewer.e4.product/pom.xml index a9de28e..25b1ae1 100644 --- a/products/com.minres.scviewer.e4.product/pom.xml +++ b/products/com.minres.scviewer.e4.product/pom.xml @@ -6,11 +6,11 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. com.minres.scviewer.e4.product - 2.17.0 + 2.17.1 eclipse-repository com.minres.scviewer diff --git a/products/com.minres.scviewer.e4.product/scviewer.product b/products/com.minres.scviewer.e4.product/scviewer.product index bbd2b96..54f8e01 100644 --- a/products/com.minres.scviewer.e4.product/scviewer.product +++ b/products/com.minres.scviewer.e4.product/scviewer.product @@ -1,7 +1,7 @@ - + diff --git a/releng/com.minres.scviewer.target/pom.xml b/releng/com.minres.scviewer.target/pom.xml index 62c3b58..542b45a 100644 --- a/releng/com.minres.scviewer.target/pom.xml +++ b/releng/com.minres.scviewer.target/pom.xml @@ -12,7 +12,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. diff --git a/releng/com.minres.scviewer.updateSite/pom.xml b/releng/com.minres.scviewer.updateSite/pom.xml index 90e84a3..24cd8ec 100644 --- a/releng/com.minres.scviewer.updateSite/pom.xml +++ b/releng/com.minres.scviewer.updateSite/pom.xml @@ -7,7 +7,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. diff --git a/tests/com.minres.scviewer.database.test/pom.xml b/tests/com.minres.scviewer.database.test/pom.xml index 1d34b0a..d694c69 100644 --- a/tests/com.minres.scviewer.database.test/pom.xml +++ b/tests/com.minres.scviewer.database.test/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 2.17.0 + 2.17.1 ../.. eclipse-test-plugin