1
0
mirror of https://github.com/wfjm/w11.git synced 2026-04-17 01:45:33 +00:00

UnitTerm: detailed stats, improved attach handling

- RtraceTools: TraceBuffer: add level 5 (full word dump)
- Rw11UnitTerm: add detailed stats and StatInc{Rx,Tx}
- Rw11UnitTermBase: add AttachDone(),DetachDone()
- Rw11UnitPC11: AttachDone(): use base class AttachDone()
This commit is contained in:
wfjm
2019-05-24 18:45:47 +02:00
parent 6f56f29202
commit 6594b3c90e
6 changed files with 104 additions and 13 deletions

View File

@@ -36,6 +36,8 @@ The full set of tests is only run for tagged releases.
### Changes
- tools changes
- Rw11UnitTerm: add detailed stats and StatInc{Rx,Tx}
- Rw11UnitTermBase: add AttachDone(),DetachDone()
- Rw11VirtDiskRam: add noboot attach option
- renamed kw11p tbench from w11a_kw11p to kw11p

View File

@@ -1,4 +1,4 @@
// $Id: Rw11UnitPC11.cpp 1134 2019-04-21 17:18:03Z mueller $
// $Id: Rw11UnitPC11.cpp 1149 2019-05-12 21:00:29Z mueller $
//
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-05-12 1149 1.1.1 AttachDone(): use base class AttachDone()
// 2019-04-20 1134 1.1 add AttachDone()
// 2017-04-07 868 1.0.1 Dump(): add detail arg
// 2013-05-03 515 1.0 Initial version
@@ -73,8 +74,10 @@ void Rw11UnitPC11::Dump(std::ostream& os, int ind, const char* text,
void Rw11UnitPC11::AttachDone()
{
Cntl().UnitSetup(fIndex);
Cntl().AttachDone(fIndex);
// the base class AttachDone() calls Cntl().UnitSetup() for all UnitStream's
// the UnitPC11 specialization calls Cntl().AttachDone in addition
Rw11UnitStreamBase<Rw11CntlPC11>::AttachDone();
Cntl().AttachDone(Index());
return;
}

View File

@@ -1,6 +1,6 @@
// $Id: Rw11UnitTerm.cpp 1114 2019-02-23 18:01:55Z mueller $
// $Id: Rw11UnitTerm.cpp 1150 2019-05-19 17:52:54Z mueller $
//
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-05-18 1150 1.2 add detailed stats and StatInc{Rx,Tx}
// 2018-12-19 1090 1.1.7 use RosPrintf(bool)
// 2018-12-17 1085 1.1.6 use std::lock_guard instead of boost
// 2018-12-14 1081 1.1.5 use std::bind instead of boost
@@ -67,6 +68,16 @@ Rw11UnitTerm::Rw11UnitTerm(Rw11Cntl* pcntl, size_t index)
{
fStats.Define(kStatNPreAttDrop, "NPreAttDrop",
"snd bytes dropped prior attach");
fStats.Define(kStatNRxFerr, "NRxFerr", "rx frame error");
fStats.Define(kStatNRxChar, "NRxChar", "rx char (no ferr)");
fStats.Define(kStatNRxNull, "NRxNull", "rx null char");
fStats.Define(kStatNRx8bit, "NRx8bit", "rx with bit 8 set");
fStats.Define(kStatNRxLine, "NRxline", "rx lines (CR)");
fStats.Define(kStatNTxFerr, "NTxFerr", "tx frame error");
fStats.Define(kStatNTxChar, "NTxChar", "tx char (no ferr)");
fStats.Define(kStatNTxNull, "NTxNull", "tx null char");
fStats.Define(kStatNTx8bit, "NTx8bit", "tx with bit 8 set");
fStats.Define(kStatNTxLine, "NTxline", "tx lines (LF)");
}
//------------------------------------------+-----------------------------------
@@ -126,6 +137,40 @@ void Rw11UnitTerm::SetLog(const std::string& fname)
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11UnitTerm::StatIncRx(uint8_t ichr, bool ferr)
{
if (ferr) {
fStats.Inc(kStatNRxFerr);
} else {
fStats.Inc(kStatNRxChar);
if (ichr == 0) fStats.Inc(kStatNRxNull);
if (ichr & 0x80) fStats.Inc(kStatNRx8bit);
if (fTi7bit) ichr &= 0x80;
if (ichr == '\r') fStats.Inc(kStatNRxLine); // count CR
}
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
void Rw11UnitTerm::StatIncTx(uint8_t ochr, bool ferr)
{
if (ferr) {
fStats.Inc(kStatNTxFerr);
} else {
fStats.Inc(kStatNTxChar);
if (ochr == 0) fStats.Inc(kStatNTxNull);
if (ochr & 0x80) fStats.Inc(kStatNTx8bit);
if (fTo7bit) ochr &= 0x80;
if (ochr == '\n') fStats.Inc(kStatNTxLine); // count LF
}
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
uint8_t Rw11UnitTerm::RcvQueueNext()
{
if (RcvQueueEmpty()) return 0;

View File

@@ -1,6 +1,6 @@
// $Id: Rw11UnitTerm.hpp 1052 2018-09-30 08:10:52Z mueller $
// $Id: Rw11UnitTerm.hpp 1150 2019-05-19 17:52:54Z mueller $
//
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-05-18 1150 1.2 add detailed stats and StatInc{Rx,Tx}
// 2017-04-07 868 1.1.2 Dump(): add detail arg
// 2017-02-25 855 1.1.1 RcvNext() --> RcvQueueNext(); WakeupCntl() now pure
// 2013-05-03 515 1.1 use AttachDone(),DetachCleanup(),DetachDone()
@@ -57,6 +58,9 @@ namespace Retro {
void SetLog(const std::string& fname);
const std::string& Log() const;
void StatIncRx(uint8_t ichr, bool ferr=false);
void StatIncTx(uint8_t ochr, bool ferr=false);
virtual bool RcvQueueEmpty();
virtual size_t RcvQueueSize();
virtual uint8_t RcvQueueNext();
@@ -72,7 +76,17 @@ namespace Retro {
// statistics counter indices
enum stats {
kStatNPreAttDrop = Rw11Unit::kDimStat,
kStatNPreAttDrop = Rw11Unit::kDimStat, //!< dropped prior to attach
kStatNRxFerr, //!< rx frame error
kStatNRxChar, //!< rx char (no ferr)
kStatNRxNull, //!< rx null char
kStatNRx8bit, //!< rx with bit 8 set
kStatNRxLine, //!< rx lines (CR)
kStatNTxFerr, //!< tx frame error
kStatNTxChar, //!< tx char (no ferr)
kStatNTxNull, //!< tx null char
kStatNTx8bit, //!< tx with bit 8 set
kStatNTxLine, //!< tx lines (LF)
kDimStat
};

View File

@@ -1,6 +1,6 @@
// $Id: Rw11UnitTermBase.hpp 983 2018-01-02 20:35:59Z mueller $
// $Id: Rw11UnitTermBase.hpp 1149 2019-05-12 21:00:29Z mueller $
//
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-05-12 1149 1.1 add AttachDone(),DetachDone()
// 2017-04-07 868 1.0.1 Dump(): add detail arg
// 2013-03-03 494 1.0 Initial version
// 2013-02-22 490 0.1 First draft
@@ -45,6 +46,10 @@ namespace Retro {
virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
int detail=0) const;
protected:
virtual void AttachDone();
virtual void DetachDone();
protected:
TC* fpCntl;
};

View File

@@ -1,6 +1,6 @@
// $Id: Rw11UnitTermBase.ipp 983 2018-01-02 20:35:59Z mueller $
// $Id: Rw11UnitTermBase.ipp 1149 2019-05-12 21:00:29Z mueller $
//
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// This program is free software; you may redistribute and/or modify it under
// the terms of the GNU General Public License as published by the Free
@@ -13,6 +13,7 @@
//
// Revision History:
// Date Rev Version Comment
// 2019-05-12 1149 1.1 add AttachDone(),DetachDone()
// 2017-04-07 868 1.0.1 Dump(): add detail arg
// 2013-03-03 494 1.0 Initial version
// 2013-02-22 490 0.1 First draft
@@ -80,6 +81,27 @@ void Rw11UnitTermBase<TC>::Dump(std::ostream& os, int ind, const char* text,
os << bl << " fpCntl: " << fpCntl << std::endl;
Rw11UnitTerm::Dump(os, ind, " ^", detail);
return;
}
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TC>
void Rw11UnitTermBase<TC>::AttachDone()
{
Rw11UnitTerm::AttachDone(); // call base class handler
Cntl().UnitSetup(Index()); // inform controller
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
template <class TC>
void Rw11UnitTermBase<TC>::DetachDone()
{
Cntl().UnitSetup(Index());
return;
}
} // end namespace Retro