Skip to content

Commit ecf0fdc

Browse files
committed
[roc-loopback] Split user and expert view
1 parent 33a7b18 commit ecf0fdc

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

src/CommandLineUtilities/ProgramLoopback.cxx

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class ProgramLoopback : public Program
7676
options.add_options()("low-mask",
7777
po::value<std::string>(&mOptions.lowMask)->default_value("0xffffffff"),
7878
"Low part of the mask");
79+
options.add_options()("expert-view",
80+
po::bool_switch(&mOptions.expertView)->default_value(false),
81+
"Enables expert view");
7982
}
8083

8184
virtual void run(const boost::program_options::variables_map& map)
@@ -98,9 +101,15 @@ class ProgramLoopback : public Program
98101
if (cardType == CardType::type::Crorc) {
99102
Logger::get() << "CRORC not supported" << LogErrorOps << endm;
100103
} else if (cardType == CardType::type::Cru) {
101-
formatHeader = " %-9s %-10s %-19s %-16s %-12s %-21s %-17s\n";
102-
formatRow = " %-9s %-10s %-19s %-16s %-12s %-21s %-17s\n";
103-
header = (boost::format(formatHeader) % "Link ID" % "PLL Lock" % "RX Locked to Data" % "Data layer UP" % "GBT PHY UP" % "RX Data Error Count" % "FEC Error Count").str();
104+
if (mOptions.expertView) {
105+
formatHeader = " %-9s %-10s %-19s %-16s %-12s %-21s %-17s\n";
106+
formatRow = " %-9s %-10s %-19s %-16s %-12s %-21s %-17s\n";
107+
header = (boost::format(formatHeader) % "Link ID" % "PLL Lock" % "RX Locked to Data" % "Data layer UP" % "GBT PHY UP" % "RX Data Error Count" % "FEC Error Count").str();
108+
} else {
109+
formatHeader = " %-9s %-12s %-21s %-17s\n";
110+
formatRow = " %-9s %-12s %-21s %-17s\n";
111+
header = (boost::format(formatHeader) % "Link ID" % "GBT PHY UP" % "RX Data Error Count" % "FEC Error Count").str();
112+
}
104113
lineFat = std::string(header.length(), '=') + '\n';
105114
lineThin = std::string(header.length(), '-') + '\n';
106115

@@ -133,14 +142,17 @@ class ProgramLoopback : public Program
133142
std::string dataLayerUpString = Utilities::toBoolString(stats.dataLayerUp);
134143
std::string gbtPhyUpString = Utilities::toBoolString(stats.gbtPhyUp);
135144

136-
auto format = boost::format(formatRow) %
137-
globalId %
138-
pllLockString %
139-
rxLockedToDataString %
140-
dataLayerUpString %
141-
gbtPhyUpString %
142-
stats.rxDataErrorCount %
143-
stats.fecErrorCount;
145+
auto format = boost::format(formatRow) % globalId;
146+
if (mOptions.expertView) {
147+
format = format %
148+
pllLockString %
149+
rxLockedToDataString %
150+
dataLayerUpString;
151+
}
152+
format = format %
153+
gbtPhyUpString %
154+
stats.rxDataErrorCount %
155+
stats.fecErrorCount;
144156
table << format;
145157
}
146158
// clear the screen
@@ -171,6 +183,7 @@ class ProgramLoopback : public Program
171183
std::string lowMask = "0xffffffff";
172184
bool skipReset = false;
173185
int interval = 1;
186+
bool expertView = false;
174187
} mOptions;
175188
};
176189

0 commit comments

Comments
 (0)