Expose transaction concurrency indexes in streams and generators
This commit is contained in:
1 parent
40d402ce8a
commit
1f861cefb8
13 files changed
+264
-16
No files matched your search
+6
-1
@@ -158,7 +158,12 @@ abstract class AbstractTxStream extends HierNode implements IWaveform {
|
||||
*/
|
||||
synchronized void calculateConcurrency() {
|
||||
if (rowCount >= 0) return;
|
||||
int count = TxRowAllocator.assign(getEvents(), (event, row) -> ((TxEvent) event).setConcurrencyIndex(row));
|
||||
int count = TxRowAllocator.assign(getEvents(), (event, row) -> {
|
||||
((TxEvent) event).setConcurrencyIndex(row);
|
||||
Tx tx = (Tx) event.getTransaction();
|
||||
if (this instanceof TxGenerator) tx.setConcurrencyIdxInGen(row);
|
||||
else tx.setConcurrencyIndxInStream(row);
|
||||
});
|
||||
for (com.minres.scviewer.database.IHierNode child : getChildNodes())
|
||||
((TxGenerator) child).calculateConcurrency();
|
||||
rowCount = count;
|
||||
|
||||
+2
-1
@@ -144,7 +144,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
* @param txId the tx id
|
||||
* @return the transaction
|
||||
*/
|
||||
public ITx getTransaction(long txId) {
|
||||
public synchronized ITx getTransaction(long txId) {
|
||||
if (txCache.containsKey(txId))
|
||||
return txCache.get(txId);
|
||||
if(transactions.containsKey(txId)) {
|
||||
@@ -267,6 +267,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||
txStreams.clear();
|
||||
txGenerators.clear();
|
||||
transactions = null;
|
||||
txCache.clear();
|
||||
attributeTypes.clear();
|
||||
relationsIn.clear();
|
||||
relationsOut.clear();
|
||||
|
||||
+23
@@ -38,6 +38,9 @@ class Tx implements ITx {
|
||||
|
||||
private final long streamId;
|
||||
|
||||
private volatile int concurrencyIndxInStream = -1;
|
||||
private volatile int concurrencyIdxInGen = -1;
|
||||
|
||||
/** The begin time. */
|
||||
long beginTime = -1;
|
||||
|
||||
@@ -174,6 +177,26 @@ class Tx implements ITx {
|
||||
return loader.txGenerators.get(generatorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConcurrencyIndxInStream() {
|
||||
if (concurrencyIndxInStream < 0) getStream().getRowCount();
|
||||
return concurrencyIndxInStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConcurrencyIdxInGen() {
|
||||
if (concurrencyIdxInGen < 0) getGenerator().getRowCount();
|
||||
return concurrencyIdxInGen;
|
||||
}
|
||||
|
||||
void setConcurrencyIndxInStream(int index) {
|
||||
concurrencyIndxInStream = index;
|
||||
}
|
||||
|
||||
void setConcurrencyIdxInGen(int index) {
|
||||
concurrencyIdxInGen = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the begin time.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user