@@ -27,15 +27,12 @@ class ProgramBarStress: public Program
2727 virtual Description getDescription ()
2828 {
2929 return {" Bar Stress" , " Stress the Bar Accessor" ,
30- " roc-bar-stress --pci-address 42:00.0 --gbt-link 0 --cycles 100000 --print-freq 10000 --errorcheck" };
30+ " roc-bar-stress --id 42:00.0 --gbt-link 0 --cycles 100000 --print-freq 10000 --errorcheck" };
3131 }
3232
3333 virtual void addOptions (boost::program_options::options_description& options)
3434 {
3535 options.add_options ()
36- (" pci-address" ,
37- po::value<std::string>(&mOptions .pciAddress )->default_value (" -1" ),
38- " Card's PCI Address" )
3936 (" gbt-link" ,
4037 po::value<uint32_t >(&mOptions .gbtLink )->default_value (0 ),
4138 " GBT link over which the bar writes will be performed. CRU is 0-17" )
@@ -48,6 +45,7 @@ class ProgramBarStress: public Program
4845 (" errorcheck" ,
4946 po::bool_switch (&mOptions .errorCheck ),
5047 " Perform data validation" );
48+ Options::addOptionCardId (options);
5149 }
5250
5351 int stress (Swt *swt, long long cycles, long long printFrequency, bool errorCheck)
@@ -107,7 +105,9 @@ class ProgramBarStress: public Program
107105 virtual void run (const boost::program_options::variables_map& map)
108106 {
109107
110- getLogger () << " PCI Address: " << mOptions .pciAddress << InfoLogger::endm;
108+ auto cardId = Options::getOptionCardId (map);
109+
110+ getLogger () << " Card ID: " << cardId << InfoLogger::endm;
111111 getLogger () << " GBT Link: " << mOptions .gbtLink << InfoLogger::endm;
112112 getLogger () << " Cycles of SWT write(/read) operations: " << mOptions .cycles << InfoLogger::endm;
113113 getLogger () << " Print frequency: " << mOptions .printFrequency << InfoLogger::endm;
@@ -121,11 +121,10 @@ class ProgramBarStress: public Program
121121 getLogger () << " Logging time every " << barOps << " bar operations, of which:" << InfoLogger::endm;
122122 getLogger () << " barWrites: " << barWrites << " | barReads: " << barReads << InfoLogger::endm;
123123
124-
125124 std::shared_ptr<BarInterface>
126- bar0 = ChannelFactory ().getBar (mOptions . pciAddress , 0 );
125+ bar0 = ChannelFactory ().getBar (cardId , 0 );
127126 std::shared_ptr<BarInterface>
128- bar2 = ChannelFactory ().getBar (mOptions . pciAddress , 2 );
127+ bar2 = ChannelFactory ().getBar (cardId , 2 );
129128
130129 if (isVerbose ())
131130 getLogger () << " Resetting card..." << InfoLogger::endm;
@@ -153,7 +152,6 @@ class ProgramBarStress: public Program
153152
154153 struct OptionsStruct
155154 {
156- std::string pciAddress = " -1" ;
157155 uint32_t gbtLink = 0 ;
158156 long long cycles = 100 ;
159157 long long printFrequency = 10 ;
0 commit comments