Skip to content

Commit 6f89a07

Browse files
committed
clang-format
1 parent 05becbc commit 6f89a07

File tree

8 files changed

+149
-154
lines changed

8 files changed

+149
-154
lines changed

src/sst/core/impl/interactive/simpleDebug.cc

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ SimpleDebugger::SimpleDebugger(Params& params) :
5050
[this](std::vector<std::string>& tokens) { cmd_help(tokens); } },
5151
{ "verbose", "v", "[mask]: set verbosity mask or print if no mask specified", ConsoleCommandGroup::GENERAL,
5252
[this](std::vector<std::string>& tokens) { cmd_verbose(tokens); } },
53-
{ "info", "info", "\"current\"|\"all\" print summary for current thread or all threads", ConsoleCommandGroup::GENERAL,
54-
[this](std::vector<std::string>& tokens) { cmd_info(tokens); } },
53+
{ "info", "info", "\"current\"|\"all\" print summary for current thread or all threads",
54+
ConsoleCommandGroup::GENERAL, [this](std::vector<std::string>& tokens) { cmd_info(tokens); } },
5555
{ "thread", "thd", "[threadID]: switch to specified thread ID", ConsoleCommandGroup::GENERAL,
5656
[this](std::vector<std::string>& tokens) { cmd_thread(tokens); } },
5757
{ "confirm", "cfm", "<true/false>: set confirmation requests on (default) or off", ConsoleCommandGroup::GENERAL,
@@ -141,9 +141,9 @@ SimpleDebugger::SimpleDebugger(Params& params) :
141141
"\t'watch' creates a default watchpoint that breaks into an interactive console when triggered\n"
142142
"\t'trace' creates a watchpoint with a trace buffer to trace a set of variables and trigger an <action>\n"
143143
"\tAvailable actions include: \n"
144-
"\t interactive, printTrace, checkpoint, set <var> <val>, printStatus, or shutdown"
145-
"\t Note: checkpoint action must be enabled at startup via the '--checkpoint-enable' command line option\n"
146-
},
144+
"\t interactive, printTrace, checkpoint, set <var> <val>, printStatus, or shutdown"
145+
"\t Note: checkpoint action must be enabled at startup via the '--checkpoint-enable' command line "
146+
"option\n" },
147147
{ "watch", "<trigger>: adds watchpoint to the watchlist; breaks into interactive console when triggered\n"
148148
"\tExample: watch var1 > 90 && var2 < 100 || var3 changed" },
149149
{ "trace",
@@ -230,7 +230,7 @@ SimpleDebugger::summary()
230230
<< ")\n";
231231
std::cout << " -- Trigger Status\n";
232232
#endif
233-
233+
234234
std::cout << " -- Component Summary\n";
235235
#if 0
236236
std::vector<std::string> tokens;
@@ -240,9 +240,9 @@ SimpleDebugger::summary()
240240
cmd_ls(tokens);
241241
#else
242242
SST::Core::Serialization::ObjectMap* baseObj = getComponentObjectMap();
243-
auto& vars = baseObj->getVariables();
244-
for (auto& x : vars) {
245-
if (x.second->isFundamental()) {
243+
auto& vars = baseObj->getVariables();
244+
for ( auto& x : vars ) {
245+
if ( x.second->isFundamental() ) {
246246
std::cout << x.first << " = " << x.second->get() << " (" << x.second->getType() << ")" << std::endl;
247247
}
248248
else {
@@ -255,17 +255,18 @@ SimpleDebugger::summary()
255255
int
256256
SimpleDebugger::execute(const std::string& msg)
257257
{
258-
RankInfo info = getRank();
258+
RankInfo info = getRank();
259259
RankInfo nRanks = getNumRanks();
260-
printf("\n---- Rank%d:Thread%d: Entering interactive mode at time %" PRI_SIMTIME " \n", info.rank, info.thread, getCurrentSimCycle());
260+
printf("\n---- Rank%d:Thread%d: Entering interactive mode at time %" PRI_SIMTIME " \n", info.rank, info.thread,
261+
getCurrentSimCycle());
261262
printf("%s\n", msg.c_str());
262263

263264
if ( nullptr == obj_ ) {
264265
obj_ = getComponentObjectMap();
265266
}
266-
done = false;
267+
done = false;
267268
retState = -1;
268-
269+
269270

270271
// Select the input source and next command line
271272
std::string line;
@@ -536,28 +537,29 @@ SimpleDebugger::cmd_verbose(std::vector<std::string>& tokens)
536537
}
537538

538539
void
539-
SimpleDebugger::cmd_info(std::vector<std::string>& UNUSED(tokens)) {
540+
SimpleDebugger::cmd_info(std::vector<std::string>& UNUSED(tokens))
541+
{
540542

541-
if (tokens.size() != 2) {
543+
if ( tokens.size() != 2 ) {
542544
printf("Invalid format for info command (info \"current\"|\"all\")\n");
543545
return;
544546
}
545547

546-
RankInfo info = getRank();
548+
RankInfo info = getRank();
547549
RankInfo nRanks = getNumRanks();
548-
if (tokens[1] == "current") {
549-
std::cout << "Rank " << info.rank << "/" << nRanks.rank
550-
<< ", Thread " << info.thread << "/" << nRanks.thread << std::endl;
550+
if ( tokens[1] == "current" ) {
551+
std::cout << "Rank " << info.rank << "/" << nRanks.rank << ", Thread " << info.thread << "/" << nRanks.thread
552+
<< std::endl;
551553
}
552-
else if (tokens[1] == "all") {
553-
if (nRanks.rank == 1 && nRanks.thread == 1) {
554-
std::cout << "Rank " << info.rank << "/" << nRanks.rank
555-
<< ", Thread " << info.thread << "/" << nRanks.thread << std::endl;
554+
else if ( tokens[1] == "all" ) {
555+
if ( nRanks.rank == 1 && nRanks.thread == 1 ) {
556+
std::cout << "Rank " << info.rank << "/" << nRanks.rank << ", Thread " << info.thread << "/"
557+
<< nRanks.thread << std::endl;
556558
}
557559
else {
558560
// Return to syncmanager to print summary for all threads
559561
retState = -2; // summary info
560-
done = true;
562+
done = true;
561563
}
562564
}
563565
else {
@@ -568,40 +570,41 @@ SimpleDebugger::cmd_info(std::vector<std::string>& UNUSED(tokens)) {
568570

569571
// thread <threadID> : switches to new thread
570572
void
571-
SimpleDebugger::cmd_thread(std::vector<std::string>& tokens) {
573+
SimpleDebugger::cmd_thread(std::vector<std::string>& tokens)
574+
{
572575

573-
if (tokens.size() != 2) {
576+
if ( tokens.size() != 2 ) {
574577
printf("Invalid format for thread command (thread <threadID>)\n");
575578
return;
576579
}
577580

578-
RankInfo info = getRank();
581+
RankInfo info = getRank();
579582
RankInfo nRanks = getNumRanks();
580-
int threadID;
583+
int threadID;
581584

582585
// Get threadID
583586
try {
584587
threadID = std::stoi(tokens[1]);
585588
}
586-
catch (const std::invalid_argument& e) {
589+
catch ( const std::invalid_argument& e ) {
587590
std::cout << "Invalid argument for threadID: " << tokens[1] << std::endl;
588591
return;
589592
}
590-
catch (const std::out_of_range& e) {
593+
catch ( const std::out_of_range& e ) {
591594
std::cout << "Out of range for threadID: " << tokens[1] << std::endl;
592595
return;
593596
}
594597

595598
// Check if valid threadID
596-
if (threadID < 0 || threadID >= nRanks.thread) {
597-
printf("ThreadID %d out of range (0:%d)\n", threadID, nRanks.thread-1);
599+
if ( threadID < 0 || threadID >= nRanks.thread ) {
600+
printf("ThreadID %d out of range (0:%d)\n", threadID, nRanks.thread - 1);
598601
return;
599602
}
600-
603+
601604
// If not current thread, set retState and done flag
602-
if (threadID != info.thread) {
605+
if ( threadID != info.thread ) {
603606
retState = threadID;
604-
done = true;
607+
done = true;
605608
}
606609
return;
607610
}
@@ -665,7 +668,7 @@ SimpleDebugger::cmd_cd(std::vector<std::string>& tokens)
665668
}
666669
#else
667670
// skk This works but doesn't delete/deactivate like objmap selectParent
668-
if (tokens.size() == 1) {
671+
if ( tokens.size() == 1 ) {
669672
obj_ = getComponentObjectMap();
670673
return;
671674
}
@@ -923,20 +926,19 @@ SimpleDebugger::cmd_run(std::vector<std::string>& tokens)
923926
return;
924927
}
925928
}
926-
else if (tokens.size() == 3) {
929+
else if ( tokens.size() == 3 ) {
927930
std::string time = tokens[1] + tokens[2];
928931
try {
929-
TimeConverter* tc = getTimeConverter(time);
932+
TimeConverter* tc = getTimeConverter(time);
930933
std::string msg = format_string("Running clock %" PRI_SIMTIME " sim cycles", tc->getFactor());
931934
schedule_interactive(tc->getFactor(), msg);
932935
}
933-
catch (std::exception& e) {
936+
catch ( std::exception& e ) {
934937
printf("Unknown time in call to run: %s\n", time.c_str());
935938
return;
936939
}
937-
938940
}
939-
else if (tokens.size() != 1) {
941+
else if ( tokens.size() != 1 ) {
940942
printf("Too many arguments for 'run <time>'\n");
941943
}
942944

src/sst/core/impl/interactive/simpleDebug.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class SimpleDebugger : public SST::InteractiveConsole
250250
explicit SimpleDebugger(Params& params);
251251
~SimpleDebugger();
252252
253-
int execute(const std::string& msg) override;
253+
int execute(const std::string& msg) override;
254254
void summary() override;
255255
256256
// Callbacks from command line completions
@@ -264,8 +264,8 @@ class SimpleDebugger : public SST::InteractiveConsole
264264
// directory as far as we can.
265265
std::vector<std::string> name_stack;
266266
267-
SST::Core::Serialization::ObjectMap* obj_ = nullptr;
268-
bool done = false;
267+
SST::Core::Serialization::ObjectMap* obj_ = nullptr;
268+
bool done = false;
269269
int retState = -1; // -1 done, positive number is threadID
270270
271271
bool autoCompleteEnable = true;
@@ -299,7 +299,7 @@ class SimpleDebugger : public SST::InteractiveConsole
299299
300300
// Navigation
301301
void cmd_help(std::vector<std::string>& UNUSED(tokens));
302-
void cmd_verbose(std::vector<std::string>& (tokens));
302+
void cmd_verbose(std::vector<std::string>&(tokens));
303303
void cmd_info(std::vector<std::string>& UNUSED(tokens));
304304
void cmd_thread(std::vector<std::string>& tokens);
305305
void cmd_pwd(std::vector<std::string>& UNUSED(tokens));

src/sst/core/interactiveConsole.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ InteractiveConsole::getTimeConverter(const std::string& time)
100100
void
101101
InteractiveConsole::schedule_interactive(SimTime_t time_offset, const std::string& msg)
102102
{
103-
//std::cout << "skk: IC: schedule_interactive\n";
103+
// std::cout << "skk: IC: schedule_interactive\n";
104104
Simulation_impl* sim = Simulation_impl::getSimulation();
105105
InteractiveAction* act = new InteractiveAction(sim, msg);
106106
sim->insertActivity(getCurrentSimCycle() + time_offset, act);
@@ -115,10 +115,10 @@ InteractiveConsole::getComponentObjectMap()
115115
void
116116
InteractiveConsole::simulationShutdown()
117117
{
118-
//Simulation_impl::getSimulation()->endSimulation(); // Only works for single thread
118+
// Simulation_impl::getSimulation()->endSimulation(); // Only works for single thread
119119
std::cout << "Simulation shutdown\n";
120-
Simulation_impl::getSimulation()->signalShutdown(false); // Works for single thread, hangs for multithread
121-
//Simulation_impl::getSimulation()->setShutdown(false); // doesn't work for single thread - just keeps running
120+
Simulation_impl::getSimulation()->signalShutdown(false); // Works for single thread, hangs for multithread
121+
// Simulation_impl::getSimulation()->setShutdown(false); // doesn't work for single thread - just keeps running
122122
}
123123

124124

src/sst/core/interactiveConsole.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,11 @@ class InteractiveConsole
5757
InteractiveConsole() = default;
5858
virtual ~InteractiveConsole() = default;
5959

60-
enum ICretcode {
61-
DONE = -1,
62-
SUMMARY = -2
63-
};
60+
enum ICretcode { DONE = -1, SUMMARY = -2 };
6461
/** Called by TimeVortex to trigger checkpoint on simulation clock interval - not used in parallel simulation */
65-
virtual int execute(const std::string& msg) = 0;
62+
virtual int execute(const std::string& msg) = 0;
6663
/** Called by SyncManager to get summary info for each thread */
67-
virtual void summary() = 0;
64+
virtual void summary() = 0;
6865

6966
protected:
7067
// Functions that can be called by child class

src/sst/core/simulation.cc

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -938,26 +938,27 @@ Simulation_impl::prepare_for_run()
938938
}
939939

940940
void
941-
Simulation_impl::setup_interactive_mode() {
941+
Simulation_impl::setup_interactive_mode()
942+
{
943+
942944

943-
944945
// Start just with multithreading right now
945-
if (num_ranks.rank == 1) {
946-
//std::cout << "skk: run: setup interactive\n";
947-
if (interactive_type_ != "") {
946+
if ( num_ranks.rank == 1 ) {
947+
// std::cout << "skk: run: setup interactive\n";
948+
if ( interactive_type_ != "" ) {
948949
// --interactive-console used to override default
949950
initialize_interactive_console(interactive_type_);
950951
}
951-
else if ((interactive_start_ != "") || (config.sigusr1() == "sst.rt.interactive") ||
952-
(config.sigusr2() == "sst.rt.interactive")) {
952+
else if ( (interactive_start_ != "") || (config.sigusr1() == "sst.rt.interactive") ||
953+
(config.sigusr2() == "sst.rt.interactive") ) {
953954
// use default interactive console
954955
interactive_type_ = "sst.interactive.simpledebug";
955956
initialize_interactive_console(interactive_type_);
956957
}
957958

958-
if (interactive_start_ != "") {
959-
//std::cout << "skk: run: interactive start\n";
960-
if (nullptr == interactive_) { // Should never get here
959+
if ( interactive_start_ != "" ) {
960+
// std::cout << "skk: run: interactive start\n";
961+
if ( nullptr == interactive_ ) { // Should never get here
961962
sim_output.fatal(CALL_INFO, 1,
962963
"ERROR: Specified --interactive-start, but did not specify --interactive-mode to set the "
963964
"interactive action that should be used.\n");
@@ -966,24 +967,23 @@ Simulation_impl::setup_interactive_mode() {
966967
try {
967968
UnitAlgebra time(interactive_start_);
968969
printf("%s\n", time.toStringBestSI().c_str());
969-
970-
if (time.isValueZero()) {
970+
971+
if ( time.isValueZero() ) {
971972
offset = 0;
972973
}
973974
else {
974975
TimeConverter* tc = timeLord.getTimeConverter(time);
975-
offset = tc->getFactor();
976-
}
976+
offset = tc->getFactor();
977+
}
977978
}
978-
catch (std::exception& e) {
979+
catch ( std::exception& e ) {
979980
sim_output.fatal(CALL_INFO, 1, "Invalid format for time in interactive start: %s\n", e.what());
980981
}
981982

982983
// Special case, invoke interactive console now rather than wait for sync
983-
if (num_ranks.thread > 1 && offset == 0) {
984+
if ( num_ranks.thread > 1 && offset == 0 ) {
984985
enter_interactive_ = true;
985986
syncManager->handleInteractiveConsole();
986-
987987
}
988988
else {
989989
InteractiveAction* act =
@@ -1052,10 +1052,10 @@ Simulation_impl::run()
10521052
real_time_->notifySignal();
10531053
}
10541054
// If serial execution (1 rank, 1 thread)
1055-
if ((num_ranks.rank == 1) && (num_ranks.thread == 1)) {
1056-
if (enter_interactive_) {
1055+
if ( (num_ranks.rank == 1) && (num_ranks.thread == 1) ) {
1056+
if ( enter_interactive_ ) {
10571057
enter_interactive_ = false;
1058-
if (interactive_ != nullptr) interactive_->execute(interactive_msg_);
1058+
if ( interactive_ != nullptr ) interactive_->execute(interactive_msg_);
10591059
}
10601060
} // Otherwise handled in sync manager
10611061
}
@@ -1143,15 +1143,14 @@ Simulation_impl::signalShutdown(bool abnormal)
11431143
shutdown_mode_ = SHUTDOWN_CLEAN;
11441144
}
11451145

1146-
if (num_ranks.rank == 1 && num_ranks.thread == 1) {
1146+
if ( num_ranks.rank == 1 && num_ranks.thread == 1 ) {
11471147
// Set endsim right away if serial
11481148
endSim = true;
11491149
}
11501150
else {
11511151
// Otherwise handle shutdown in sync
11521152
enter_shutdown_ = true;
11531153
}
1154-
11551154
}
11561155

11571156
void
@@ -2179,9 +2178,9 @@ Simulation_impl::initialize_interactive_console(const std::string& type)
21792178
void
21802179
Simulation_impl::scheduleInteractiveConsole(const std::string& msg)
21812180
{
2182-
//std::cout << "skk: scheduleIC\n";
2181+
// std::cout << "skk: scheduleIC\n";
21832182
enter_interactive_ = true;
2184-
interactive_msg_ = msg;
2183+
interactive_msg_ = msg;
21852184
}
21862185

21872186

src/sst/core/simulation_impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ class Simulation_impl
481481
void signalShutdown(bool abnormal);
482482

483483
/** Set Shutdown
484-
* Called when action needs to terminate SST
485-
* sets a flag to trigger shutdown at sync, but doesn't endSim
486-
*/
484+
* Called when action needs to terminate SST
485+
* sets a flag to trigger shutdown at sync, but doesn't endSim
486+
*/
487487
void setEndSim();
488488

489489
/** Normal Shutdown

0 commit comments

Comments
 (0)