added change tracking to ARM stats

This commit is contained in:
Thomas Jentzsch 2021-06-09 10:50:32 +02:00
parent 950096c671
commit 61afc41ab3
6 changed files with 108 additions and 24 deletions

View File

@ -250,6 +250,8 @@ void CartridgeBUSWidget::saveOldState()
myOldState.mwavesizes.clear();
myOldState.internalram.clear();
myOldState.samplepointer.clear();
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
for(uInt32 i = 0; i < 18; ++i)
{
@ -290,6 +292,18 @@ void CartridgeBUSWidget::saveOldState()
myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.samplepointer.push_back(myCart.getSample());
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -416,25 +430,37 @@ void CartridgeBUSWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
}

View File

@ -47,6 +47,8 @@ class CartridgeBUSWidget : public CartDebugWidget
IntArray mwaves;
IntArray mwavesizes;
IntArray samplepointer;
uIntArray armStats;
uIntArray armPrevStats;
uInt32 random{0};
ByteArray internalram;
};

View File

@ -266,6 +266,8 @@ void CartridgeCDFWidget::saveOldState()
myOldState.mwavesizes.clear();
myOldState.internalram.clear();
myOldState.samplepointer.clear();
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
for(uInt32 i = 0; i < static_cast<uInt32>((isCDFJ() || isCDFJplus()) ? 35 : 34); ++i)
{
@ -297,6 +299,18 @@ void CartridgeCDFWidget::saveOldState()
myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.samplepointer.push_back(myCart.getSample());
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -428,25 +442,37 @@ void CartridgeCDFWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
}

View File

@ -48,6 +48,8 @@ class CartridgeCDFWidget : public CartDebugWidget
IntArray mwaves;
IntArray mwavesizes;
IntArray samplepointer;
uIntArray armStats;
uIntArray armPrevStats;
uInt32 random{0};
ByteArray internalram;
};

View File

@ -246,6 +246,8 @@ void CartridgeDPCPlusWidget::saveOldState()
myOldState.mfreqs.clear();
myOldState.mwaves.clear();
myOldState.internalram.clear();
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
for(uInt32 i = 0; i < 8; ++i)
{
@ -269,6 +271,18 @@ void CartridgeDPCPlusWidget::saveOldState()
myOldState.internalram.push_back(myCart.myDisplayImage[i]);
myOldState.bank = myCart.getBank();
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -359,25 +373,37 @@ void CartridgeDPCPlusWidget::loadConfig()
myFastFetch->setState(myCart.myFastFetch);
myIMLDA->setState(myCart.myLDAimmediate);
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6));
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
}

View File

@ -46,6 +46,8 @@ class CartridgeDPCPlusWidget : public CartDebugWidget
IntArray mcounters;
IntArray mfreqs;
IntArray mwaves;
uIntArray armStats;
uIntArray armPrevStats;
uInt32 random{0};
ByteArray internalram;
uInt16 bank{0};