Skip to content

Commit bd66b65

Browse files
committed
[alf-client] Add parallel-sc case
1 parent c413aae commit bd66b65

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

apps/AlfClient.cxx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class AlfClient : public AliceO2::Common::Program
6161
options.add_options()("link",
6262
po::value<int>(&mOptions.link),
6363
"Link number");
64+
options.add_options()("link2",
65+
po::value<int>(&mOptions.link2),
66+
"Link2 number");
6467
options.add_options()("alf-id",
6568
po::value<std::string>(&mOptions.alfId)->default_value(""),
6669
"Hostname of node running the ALF server(required)");
@@ -85,6 +88,9 @@ class AlfClient : public AliceO2::Common::Program
8588
options.add_options()("swt-stress",
8689
po::bool_switch(&mOptions.swtStress)->default_value(false),
8790
"Flag enabling the swt-stress tests");
91+
options.add_options()("parallel-sc",
92+
po::bool_switch(&mOptions.parallelSc)->default_value(false),
93+
"Flag enabling the parallel SC tests");
8894
options.add_options()("swt-stress-cycles",
8995
po::value<int>(&mOptions.swtStressCycles)->default_value(2),
9096
"Number of cycles for which to run the SWT stress test");
@@ -123,8 +129,10 @@ class AlfClient : public AliceO2::Common::Program
123129
std::cout << "Starting the DIM Client using ALF ID=" << alfId << ", card=" << mOptions.serial << ":" << mOptions.endpoint << " and link=" << mOptions.link << std::endl;
124130

125131
AlfLink link = AlfLink{ alfId, roc::SerialId(mOptions.serial, mOptions.endpoint), mOptions.link, mOptions.endpoint * 12 + mOptions.link, nullptr, roc::CardType::Cru };
132+
AlfLink link2 = AlfLink{ alfId, roc::SerialId(mOptions.serial, mOptions.endpoint), mOptions.link2, mOptions.endpoint * 12 + mOptions.link2, nullptr, roc::CardType::Cru };
126133

127134
ServiceNames names(link);
135+
ServiceNames names2(link2);
128136

129137
if (mOptions.crorc) {
130138
link.cardType = roc::CardType::Crorc;
@@ -146,6 +154,7 @@ class AlfClient : public AliceO2::Common::Program
146154
LlaSessionStopRpc llaSessionStopRpc(names.llaSessionStop());
147155

148156
SwtSequenceRpc swtSequence(names.swtSequence());
157+
SwtSequenceRpc swtSequence2(names2.swtSequence());
149158
ScaSequenceRpc scaSequence(names.scaSequence());
150159
IcSequenceRpc icSequence(names.icSequence());
151160
IcGbtI2cWriteRpc icGbtI2cWriteRpc(names.icGbtI2cWrite());
@@ -261,6 +270,27 @@ class AlfClient : public AliceO2::Common::Program
261270
}
262271
}
263272

273+
if (mOptions.parallelSc) {
274+
std::thread t1(
275+
[&] {auto swtOut = swtSequence.write({ std::make_pair("", "lock"),
276+
std::make_pair("0x00000000000deadbeef", "write"),
277+
std::make_pair("4", "read") });
278+
std::cout << "[SWT_SEQUENCE L" << mOptions.link << "] output: " << swtOut << std::endl; }
279+
);
280+
281+
std::thread t2(
282+
[&] {auto swtOut2 = swtSequence2.write({ std::make_pair("", "lock"),
283+
std::make_pair("0x000000000000badcafe", "write"),
284+
std::make_pair("4", "read") });
285+
std::cout << "[SWT_SEQUENCE L" << mOptions.link2 << "] output: " << swtOut2 << std::endl; }
286+
);
287+
288+
t1.join();
289+
t2.join();
290+
291+
292+
}
293+
264294
std::cout << "See ya!" << std::endl;
265295
}
266296

@@ -270,6 +300,7 @@ class AlfClient : public AliceO2::Common::Program
270300
int serial = -1;
271301
int endpoint = 0;
272302
int link = -1;
303+
int link2 = -1;
273304
std::string alfId = "";
274305
bool crorc = false;
275306
bool ic = false;
@@ -278,6 +309,7 @@ class AlfClient : public AliceO2::Common::Program
278309
bool swt = false;
279310
bool patternPlayer = false;
280311
bool swtStress = false;
312+
bool parallelSc = false;
281313
int swtStressCycles = 2;
282314
int swtStressWords = 1000;
283315
} mOptions;

include/Alf/ScBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ScBase
6565
void barWrite(uint32_t index, uint32_t data);
6666

6767
AlfLink mLink;
68-
std::unique_ptr<LlaSession> mLlaSession;
68+
std::shared_ptr<LlaSession> mLlaSession;
6969

7070
private:
7171
/// Does the necessary initializations after an object creating

0 commit comments

Comments
 (0)