-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0f5ee5
commit 962363d
Showing
6 changed files
with
147 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
#include <JANA/JApplication.h> | ||
#include <JANA/Engine/JArrowProcessingController.h> | ||
|
||
|
||
void PrintMenu() { | ||
std::cout << " -----------------------------------------" << std::endl; | ||
std::cout << " Available commands" << std::endl; | ||
std::cout << " -----------------------------------------" << std::endl; | ||
std::cout << " ic InspectComponents" << std::endl; | ||
std::cout << " it InspectTopology" << std::endl; | ||
std::cout << " ip InspectPlace arrow_id place_id" << std::endl; | ||
std::cout << " ie InspectEvent arrow_id place_id slot_id" << std::endl; | ||
std::cout << " f Fire arrow_id" << std::endl; | ||
std::cout << " r Resume" << std::endl; | ||
std::cout << " s Scale nthreads" << std::endl; | ||
std::cout << " q Quit" << std::endl; | ||
std::cout << " h Help" << std::endl; | ||
std::cout << " -----------------------------------------" << std::endl; | ||
} | ||
|
||
void InspectApplication(JApplication* app) { | ||
auto engine = app->GetService<JArrowProcessingController>(); | ||
engine->request_pause(); | ||
engine->wait_until_paused(); | ||
app->SetTimeoutEnabled(false); | ||
PrintMenu(); | ||
|
||
while (true) { | ||
|
||
std::string user_input; | ||
std::cout << std::endl << "JANA: "; std::cout.flush(); | ||
// obtain a single line | ||
std::getline(std::cin, user_input); | ||
// split into tokens | ||
std::stringstream ss(user_input); | ||
std::string token; | ||
ss >> token; | ||
std::vector<int> args; | ||
std::string arg; | ||
try { | ||
while (ss >> arg) { | ||
args.push_back(std::stoi(arg)); | ||
} | ||
if (token == "InspectComponents" || token == "ic") { | ||
// InspectComponents(); | ||
} | ||
else if ((token == "InspectTopology" || token == "it") && args.empty()) { | ||
// InspectTopology(0); | ||
} | ||
else if ((token == "InspectPlace" || token == "ip") && args.size() == 2) { | ||
// InspectPlace(std::stoi(args[0]), std::stoi(args[1])); | ||
} | ||
else if ((token == "InspectEvent" || token == "ie") && (args.size() == 3)) { | ||
// InspectEvent(std::stoi(args[0]) | ||
} | ||
else if ((token == "Fire" || token == "f") && (args.size() == 1)) { | ||
// Fire(args[0]); | ||
} | ||
else if (token == "Resume" || token == "r") { | ||
app->Run(false); | ||
break; | ||
} | ||
else if ((token == "Scale" || token == "s") && (args.size() == 1)) { | ||
app->Scale(args[0]); | ||
break; | ||
} | ||
else if (token == "Quit" || token == "q") { | ||
app->Quit(true); | ||
break; | ||
} | ||
else if (token == "Help" || token == "h") { | ||
PrintMenu(); | ||
} | ||
else if (token == "") { | ||
// Do nothing | ||
} | ||
else { | ||
std::cout << "(Error: Unrecognized command, or wrong argument count)" << std::endl; | ||
} | ||
} | ||
catch (JException& ex) { | ||
std::cout << "(JException: " << ex.GetMessage() << ")" << std::endl; | ||
} | ||
catch (std::invalid_argument&) { | ||
std::cout << "(Parse error: Maybe an argument needs to be an int)" << std::endl; | ||
} | ||
catch (...) { | ||
std::cout << "(Unknown error)" << std::endl; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright 2024, Jefferson Science Associates, LLC. | ||
// Subject to the terms in the LICENSE file found in the top-level directory. | ||
|
||
#pragma once | ||
|
||
class JApplication; | ||
void InspectApplication(JApplication* app); | ||
|
||
|