Skip to content

Commit 9334301

Browse files
committed
compact output
1 parent ccfda05 commit 9334301

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class ProgramStatus : public Program
7272
std::ostringstream table;
7373
std::string formatHeader;
7474
std::string formatRow;
75-
std::string header;
75+
std::string header1;
76+
std::string header2;
7677
std::string lineFat;
7778
std::string lineThin;
7879

@@ -91,14 +92,15 @@ class ProgramStatus : public Program
9192
}
9293

9394
if (cardType == CardType::type::Crorc) {
94-
formatHeader = " %-9s %-8s %-19s\n";
95-
formatRow = " %-9s %-8s %-19.1f\n";
96-
header = (boost::format(formatHeader) % "Link ID" % "Status" % "Optical power(uW)").str();
97-
lineFat = std::string(header.length(), '=') + '\n';
98-
lineThin = std::string(header.length(), '-') + '\n';
95+
formatHeader = " %-6s %-8s %-11s\n";
96+
formatRow = " %-6s %-8s %-11.1f\n";
97+
header1 = (boost::format(formatHeader) % "Link" % "Status" % "Optical").str();
98+
header2 = (boost::format(formatHeader) % "ID" % "" % "power (uW)").str();
99+
lineFat = std::string(header1.length(), '=') + '\n';
100+
lineThin = std::string(header1.length(), '-') + '\n';
99101

100102
if (!mOptions.jsonOut) {
101-
table << lineFat << header << lineThin;
103+
table << lineFat << header1 << header2 << lineThin;
102104
}
103105

104106
auto params = Parameters::makeParameters(cardId, 0); //status available on BAR0
@@ -176,19 +178,20 @@ class ProgramStatus : public Program
176178
}
177179
}
178180
} else if (cardType == CardType::type::Cru) {
179-
formatHeader = " %-9s %-16s %-10s %-14s %-15s %-10s %-14s %-14s %-8s %-19s %-11s %-7s\n";
180-
formatRow = " %-9s %-16s %-10s %-14s %-15s %-10s %-14.2f %-14.2f %-8s %-19.1f %-11s %-7s\n";
181-
header = (boost::format(formatHeader) % "Link ID" % "GBT Mode Tx/Rx" % "Loopback" % "GBT MUX" % "Datapath Mode" % "Datapath" % "RX freq(MHz)" % "TX freq(MHz)" % "Status" % "Optical power(uW)" % "System ID" % "FEE ID").str();
182-
lineFat = std::string(header.length(), '=') + '\n';
183-
lineThin = std::string(header.length(), '-') + '\n';
181+
formatHeader = " %-6s %-10s %-10s %-14s %-10s %-10s %-8s %-8s %-8s %-11s %-8s %-8s\n";
182+
formatRow = " %-6s %-10s %-10s %-14s %-10s %-10s %-8.2f %-8.2f %-8s %-11.1f %-8s %-8s\n";
183+
header1 = (boost::format(formatHeader) % "Link" % "GBT Mode" % "Loopback" % "GBT MUX" % "Datapath" % "Datapath" % "RX freq" % "TX freq" % "Status" % "Optical" % "System" % "FEE").str();
184+
header2 = (boost::format(formatHeader) % "ID" % "Tx/Rx" % "" % "" % "mode" % "status" % "(MHz)" % "(MHz)" % "" % "power (uW)" % "ID" % "ID").str();
185+
lineFat = std::string(header1.length(), '=') + '\n';
186+
lineThin = std::string(header2.length(), '-') + '\n';
184187

185188
auto params = Parameters::makeParameters(cardId, 2); //status available on BAR2
186189
params.setLinkMask(Parameters::linkMaskFromString(mOptions.links));
187190
auto bar2 = ChannelFactory().getBar(params);
188191
auto cruBar2 = std::dynamic_pointer_cast<CruBar>(bar2);
189192

190193
if (!mOptions.jsonOut) {
191-
table << lineFat << header << lineThin;
194+
table << lineFat << header1 << header2 << lineThin;
192195
}
193196

194197
Cru::ReportInfo reportInfo = cruBar2->report();
@@ -450,7 +453,7 @@ class ProgramStatus : public Program
450453
if (mOptions.jsonOut) {
451454
pt::write_json(std::cout, root);
452455
} else if (!mOptions.monitoring) {
453-
auto lineFat = std::string(header.length(), '=') + '\n';
456+
auto lineFat = std::string(header1.length(), '=') + '\n';
454457
table << lineFat;
455458
std::cout << table.str();
456459
}

0 commit comments

Comments
 (0)