added last but one ARM stats to debug widgets

This commit is contained in:
Thomas Jentzsch 2021-06-09 09:32:14 +02:00
parent ae527a7f5e
commit 950096c671
11 changed files with 133 additions and 15 deletions

View File

@ -189,29 +189,51 @@ CartridgeBUSWidget::CartridgeBUSWidget(
new StaticTextWidget(boss, _font, xpos, ypos + 1, "Last ARM run stats:");
xpos = 10 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
StaticTextWidget* s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Mem. cycles ");
myThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
myPrevThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbMemCycles->setEditable(false);
myPrevThumbMemCycles->setToolTip("Number of memory cycles of last but one ARM run.");
myThumbMemCycles = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getRight() + _fontWidth / 2, ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbMemCycles->setEditable(false);
myThumbMemCycles->setToolTip("Number of memory cycles of last ARM run.");
s = new StaticTextWidget(boss, _font, myThumbMemCycles->getRight() + _fontWidth * 2, ypos + 1, "Fetches ");
myThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
myPrevThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbFetches->setEditable(false);
myPrevThumbFetches->setToolTip("Number of fetches/instructions of last but one ARM run.");
myThumbFetches = new EditTextWidget(boss, _font, myPrevThumbFetches->getRight() + _fontWidth / 2, ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbFetches->setEditable(false);
myThumbFetches->setToolTip("Number of fetches/instructions of last ARM run.");
ypos += myLineHeight + 4;
s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Reads ");
myPrevThumbReads = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbReads->setEditable(false);
myPrevThumbReads->setToolTip("Number of reads of last but one ARM run.");
myThumbReads = new EditTextWidget(boss, _font, myThumbMemCycles->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbReads->setEditable(false);
myThumbReads->setToolTip("Number of reads of last ARM run.");
s = new StaticTextWidget(boss, _font, myThumbReads->getRight() + _fontWidth * 2, ypos + 1, "Writes ");
myPrevThumbWrites = new EditTextWidget(boss, _font, myPrevThumbFetches->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbWrites->setEditable(false);
myPrevThumbWrites->setToolTip("Number of writes of last but one ARM run.");
myThumbWrites = new EditTextWidget(boss, _font, myThumbFetches->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbWrites->setEditable(false);
myThumbWrites->setToolTip("Number of write of last ARM run.");
myThumbWrites->setToolTip("Number of writes of last ARM run.");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -394,6 +416,16 @@ void CartridgeBUSWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6));
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6));
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));

View File

@ -66,6 +66,10 @@ class CartridgeBUSWidget : public CartDebugWidget
DataGridWidget* mySamplePointer{nullptr};
CheckboxWidget* myBusOverdrive{nullptr};
CheckboxWidget* myDigitalSample{nullptr};
EditTextWidget* myPrevThumbMemCycles{nullptr};
EditTextWidget* myPrevThumbFetches{nullptr};
EditTextWidget* myPrevThumbReads{nullptr};
EditTextWidget* myPrevThumbWrites{nullptr};
EditTextWidget* myThumbMemCycles{nullptr};
EditTextWidget* myThumbFetches{nullptr};
EditTextWidget* myThumbReads{nullptr};

View File

@ -204,29 +204,52 @@ CartridgeCDFWidget::CartridgeCDFWidget(
new StaticTextWidget(boss, _font, xpos, ypos + 1, "Last ARM run stats:");
xpos = HBORDER + INDENT; ypos += myLineHeight + VGAP;
StaticTextWidget* s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Mem. cycles ");
myThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbMemCycles->setEditable(false);
myPrevThumbMemCycles->setToolTip("Number of memory cycles of last but one ARM run.");
myThumbMemCycles = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getRight() + _fontWidth / 2, ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbMemCycles->setEditable(false);
myThumbMemCycles->setToolTip("Number of memory cycles of last ARM run.");
s = new StaticTextWidget(boss, _font, myThumbMemCycles->getRight() + _fontWidth * 2, ypos + 1, "Fetches ");
myThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbFetches->setEditable(false);
myPrevThumbFetches->setToolTip("Number of fetches/instructions of last but one ARM run.");
myThumbFetches = new EditTextWidget(boss, _font, myPrevThumbFetches->getRight() + _fontWidth / 2, ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbFetches->setEditable(false);
myThumbFetches->setToolTip("Number of fetches/instructions of last ARM run.");
ypos += myLineHeight + VGAP;
s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Reads ");
myPrevThumbReads = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbReads->setEditable(false);
myPrevThumbReads->setToolTip("Number of reads of last but one ARM run.");
myThumbReads = new EditTextWidget(boss, _font, myThumbMemCycles->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbReads->setEditable(false);
myThumbReads->setToolTip("Number of reads of last ARM run.");
s = new StaticTextWidget(boss, _font, myThumbReads->getRight() + _fontWidth * 2, ypos + 1, "Writes ");
myPrevThumbWrites = new EditTextWidget(boss, _font, myPrevThumbFetches->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbWrites->setEditable(false);
myPrevThumbWrites->setToolTip("Number of writes of last but one ARM run.");
myThumbWrites = new EditTextWidget(boss, _font, myThumbFetches->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbWrites->setEditable(false);
myThumbWrites->setToolTip("Number of write of last ARM run.");
myThumbWrites->setToolTip("Number of writes of last ARM run.");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -405,6 +428,16 @@ void CartridgeCDFWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6));
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6));
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));

View File

@ -70,6 +70,10 @@ class CartridgeCDFWidget : public CartDebugWidget
CheckboxWidget* myFastFetch{nullptr};
CheckboxWidget* myDigitalSample{nullptr};
EditTextWidget* myPrevThumbMemCycles{nullptr};
EditTextWidget* myPrevThumbFetches{nullptr};
EditTextWidget* myPrevThumbReads{nullptr};
EditTextWidget* myPrevThumbWrites{nullptr};
EditTextWidget* myThumbMemCycles{nullptr};
EditTextWidget* myThumbFetches{nullptr};
EditTextWidget* myThumbReads{nullptr};

View File

@ -184,30 +184,53 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
new StaticTextWidget(boss, _font, xpos, ypos + 1, "Last ARM run stats:");
xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
StaticTextWidget* s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Mem. cycles ");
myThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
myPrevThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbMemCycles->setEditable(false);
myPrevThumbMemCycles->setToolTip("Number of memory cycles of last but one ARM run.");
myThumbMemCycles = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getRight() + _fontWidth / 2, ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbMemCycles->setEditable(false);
myThumbMemCycles->setToolTip("Number of memory cycles of last ARM run.");
s = new StaticTextWidget(boss, _font, myThumbMemCycles->getRight() + _fontWidth * 2, ypos + 1, "Fetches ");
myThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
myPrevThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbFetches->setEditable(false);
myPrevThumbFetches->setToolTip("Number of fetches/instructions of last but one ARM run.");
myThumbFetches = new EditTextWidget(boss, _font, myPrevThumbFetches->getRight() + _fontWidth / 2, ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbFetches->setEditable(false);
myThumbFetches->setToolTip("Number of fetches/instructions of last ARM run.");
ypos += myLineHeight + 4;
s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Reads ");
myPrevThumbReads = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbReads->setEditable(false);
myPrevThumbReads->setToolTip("Number of reads of last but one ARM run.");
myThumbReads = new EditTextWidget(boss, _font, myThumbMemCycles->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbReads->setEditable(false);
myThumbReads->setToolTip("Number of reads of last ARM run.");
s = new StaticTextWidget(boss, _font, myThumbReads->getRight() + _fontWidth * 2, ypos + 1, "Writes ");
myPrevThumbWrites = new EditTextWidget(boss, _font, myPrevThumbFetches->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myPrevThumbWrites->setEditable(false);
myPrevThumbWrites->setToolTip("Number of writes of last but one ARM run.");
myThumbWrites = new EditTextWidget(boss, _font, myThumbFetches->getLeft(), ypos - 1,
EditTextWidget::calcWidth(_font, 6), myLineHeight, "");
myThumbWrites->setEditable(false);
myThumbWrites->setToolTip("Number of write of last ARM run.");
myThumbWrites->setToolTip("Number of writes of last ARM run.");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -336,6 +359,16 @@ void CartridgeDPCPlusWidget::loadConfig()
myFastFetch->setState(myCart.myFastFetch);
myIMLDA->setState(myCart.myLDAimmediate);
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6));
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6));
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6));
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));

View File

@ -66,6 +66,10 @@ class CartridgeDPCPlusWidget : public CartDebugWidget
CheckboxWidget* myFastFetch{nullptr};
CheckboxWidget* myIMLDA{nullptr};
DataGridWidget* myRandom{nullptr};
EditTextWidget* myPrevThumbMemCycles{nullptr};
EditTextWidget* myPrevThumbFetches{nullptr};
EditTextWidget* myPrevThumbReads{nullptr};
EditTextWidget* myPrevThumbWrites{nullptr};
EditTextWidget* myThumbMemCycles{nullptr};
EditTextWidget* myThumbFetches{nullptr};
EditTextWidget* myThumbReads{nullptr};

View File

@ -233,8 +233,9 @@ class CartridgeBUS : public Cartridge
uInt32 getWaveformSize(uInt8 index) const;
uInt32 getSample();
// Get number of memory accesses of last ARM run.
// Get number of memory accesses of last and last but one ARM runs.
const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); }
const Thumbulator::Stats& prevStats() const { return myThumbEmulator->prevStats(); }
private:
// The 32K ROM image of the cartridge

View File

@ -263,8 +263,9 @@ class CartridgeCDF : public Cartridge
uInt32 getSample();
void setupVersion();
// Get number of memory accesses of last ARM run.
// Get number of memory accesses of last and last but one ARM runs.
const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); }
const Thumbulator::Stats& prevStats() const { return myThumbEmulator->prevStats(); }
private:
// The ROM image of the cartridge

View File

@ -223,8 +223,9 @@ class CartridgeDPCPlus : public Cartridge
*/
void callFunction(uInt8 value);
// Get number of memory accesses of last ARM run.
// Get number of memory accesses of last and last but one ARM runs.
const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); }
const Thumbulator::Stats& prevStats() const { return myThumbEmulator->prevStats(); }
private:
// The ROM image and size

View File

@ -2548,6 +2548,9 @@ int Thumbulator::reset()
statusMsg.str("");
#endif
#ifndef NO_THUMB_STATS
_prevStats.fetches = _stats.fetches;
_prevStats.reads = _stats.reads;
_prevStats.writes = _stats.writes;
_stats.fetches = _stats.reads = _stats.writes = 0;
#endif

View File

@ -82,6 +82,7 @@ class Thumbulator
string run();
string run(uInt32 cycles);
const Stats& stats() const { return _stats; }
const Stats& prevStats() const { return _prevStats; }
#ifndef UNSAFE_OPTIMIZATIONS
/**
@ -209,6 +210,7 @@ class Thumbulator
uInt32 instructions{0};
#endif
Stats _stats;
Stats _prevStats;
// For emulation of LPC2103's timer 1, used for NTSC/PAL/SECAM detection.
// Register names from documentation: