added ARM stats to BUS and DPC+ debug widgets

This commit is contained in:
thrust26 2021-02-10 16:07:28 +01:00
parent 47e9269cf2
commit 756b6ff207
8 changed files with 99 additions and 10 deletions

View File

@ -18,6 +18,7 @@
#include "CartBUS.hxx"
#include "DataGridWidget.hxx"
#include "PopUpWidget.hxx"
#include "EditTextWidget.hxx"
#include "CartBUSWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -49,8 +50,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
#endif
int xpos = 2,
ypos = addBaseInformation(size, "AtariAge", info.str(), 4) +
myLineHeight;
ypos = addBaseInformation(size, "AtariAge", info.str(), 4) + 4;
VariantList items;
VarList::push_back(items, "0 ($FFF5)");
@ -184,6 +184,34 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myDigitalSample = new CheckboxWidget(boss, _font, xpossp, ypos, "Digital Sample mode");
myDigitalSample->setTarget(this);
myDigitalSample->setEditable(false);
xpos = 10; ypos += myLineHeight + 4 * 2;
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,
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, "");
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 ");
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 ");
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.");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -366,6 +394,16 @@ void CartridgeBUSWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6));
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6));
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6));
CartDebugWidget::loadConfig();
}

View File

@ -22,6 +22,7 @@ class CartridgeBUS;
class PopUpWidget;
class CheckboxWidget;
class DataGridWidget;
class EditTextWidget;
#include "CartDebugWidget.hxx"
@ -65,6 +66,10 @@ class CartridgeBUSWidget : public CartDebugWidget
DataGridWidget* mySamplePointer{nullptr};
CheckboxWidget* myBusOverdrive{nullptr};
CheckboxWidget* myDigitalSample{nullptr};
EditTextWidget* myThumbMemCycles{nullptr};
EditTextWidget* myThumbFetches{nullptr};
EditTextWidget* myThumbReads{nullptr};
EditTextWidget* myThumbWrites{nullptr};
std::array<StaticTextWidget*, 6> myDatastreamLabels{nullptr};
CartState myOldState;

View File

@ -18,6 +18,7 @@
#include "CartDPCPlus.hxx"
#include "DataGridWidget.hxx"
#include "PopUpWidget.hxx"
#include "EditTextWidget.hxx"
#include "CartDPCPlusWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -178,6 +179,35 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myIMLDA = new CheckboxWidget(boss, _font, xpos, ypos, "Immediate mode LDA");
myIMLDA->setTarget(this);
myIMLDA->setEditable(false);
xpos = 2; ypos += myLineHeight + 4 * 1;
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,
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, "");
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 ");
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 ");
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.");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -306,6 +336,16 @@ void CartridgeDPCPlusWidget::loadConfig()
myFastFetch->setState(myCart.myFastFetch);
myIMLDA->setState(myCart.myLDAimmediate);
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6));
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6));
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6));
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6));
CartDebugWidget::loadConfig();
}

View File

@ -22,6 +22,7 @@ class CartridgeDPCPlus;
class PopUpWidget;
class CheckboxWidget;
class DataGridWidget;
class EditTextWidget;
#include "CartDebugWidget.hxx"
@ -65,6 +66,10 @@ class CartridgeDPCPlusWidget : public CartDebugWidget
CheckboxWidget* myFastFetch{nullptr};
CheckboxWidget* myIMLDA{nullptr};
DataGridWidget* myRandom{nullptr};
EditTextWidget* myThumbMemCycles{nullptr};
EditTextWidget* myThumbFetches{nullptr};
EditTextWidget* myThumbReads{nullptr};
EditTextWidget* myThumbWrites{nullptr};
CartState myOldState;

View File

@ -25,6 +25,7 @@ class Thumbulator;
#endif
#include "bspf.hxx"
#include "Thumbulator.hxx"
#include "Cart.hxx"
/**
@ -233,6 +234,9 @@ class CartridgeBUS : public Cartridge
uInt32 getWaveformSize(uInt8 index) const;
uInt32 getSample();
// Get number of memory accesses of last ARM run.
const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); }
private:
// The 32K ROM image of the cartridge
ByteBuffer myImage;

View File

@ -827,9 +827,3 @@ uInt32 CartridgeCDF::romSize() const
return new CartridgeCDFInfoWidget(boss, lfont, nfont, x, y, w, h, *this);
}
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Thumbulator::Stats& CartridgeCDF::stats() const
{
return myThumbEmulator->stats();
}

View File

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

View File

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