Expose transaction concurrency indexes in streams and generators

This commit is contained in:
eyck committed 2026-11-14 18:13:22 +01:00
1 parent 40d402ce8a
commit 1f861cefb8
13 files changed
+264 -16

No files matched your search

@@ -148,7 +148,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;
@@ -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;
@@ -175,6 +178,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.
*
@@ -133,6 +133,16 @@ class TxRelation implements ITxRelation {
return resolve().getGenerator();
}
@Override
public int getConcurrencyIndxInStream() {
return resolve().getConcurrencyIndxInStream();
}
@Override
public int getConcurrencyIdxInGen() {
return resolve().getConcurrencyIdxInGen();
}
@Override
public long getBeginTime() {
return resolve().getBeginTime();