31int main(
int argc,
const char *argv[]) {
33 cli.description(
"Query an ESI system for information from the manifest.");
35 CLI::App *versionSub =
36 cli.add_subcommand(
"version",
"Print ESI system version");
38 cli.add_subcommand(
"info",
"Print ESI system information");
39 CLI::App *hierSub = cli.add_subcommand(
"hier",
"Print ESI system hierarchy");
40 CLI::App *telemetrySub =
41 cli.add_subcommand(
"telemetry",
"Print ESI system telemetry information");
43 if (
int rc = cli.
esiParse(argc, argv))
45 if (!cli.get_help_ptr()->empty())
50 std::unique_ptr<AcceleratorConnection> acc = cli.
connect();
54 std::cout << info.getEsiVersion() << std::endl;
59 else if (*telemetrySub)
62 }
catch (std::exception &e) {
63 ctxt.getLogger().error(
"esiquery", e.what());
31int main(
int argc,
const char *argv[]) {
…}
69 std::string jsonManifest =
72 os <<
"API version: " << m.
getApiVersion() << std::endl << std::endl;
73 os <<
"********************************" << std::endl;
74 os <<
"* Module information" << std::endl;
75 os <<
"********************************" << std::endl;
81 os <<
"********************************" << std::endl;
82 os <<
"* Type table" << std::endl;
83 os <<
"********************************" << std::endl;
87 os <<
" " << i++ <<
": " << t->getID() << std::endl;
91 std::string indent =
"") {
92 os << indent <<
" " << port.
getID() <<
":";
94 if (
auto svcPortStr = svcPort->toString()) {
95 os <<
" " << *svcPortStr << std::endl;
100 os << indent <<
" " << name <<
": " << chan.getType()->getID()
105 std::string indent =
"") {
106 os << indent <<
"* Instance:";
107 if (
auto inst =
dynamic_cast<const Instance *
>(d))
108 os << inst->getID() << std::endl;
110 os <<
"top" << std::endl;
111 os << indent <<
"* Ports:" << std::endl;
115 if (!children.empty()) {
116 os << indent <<
"* Children:" << std::endl;
127 os <<
"********************************" << std::endl;
128 os <<
"* Design hierarchy" << std::endl;
129 os <<
"********************************" << std::endl;
142 os <<
"No telemetry service found" << std::endl;
145 os <<
"********************************" << std::endl;
146 os <<
"* Telemetry" << std::endl;
147 os <<
"********************************" << std::endl;
150 const std::map<AppIDPath, services::TelemetryService::Telemetry *>
152 for (
const auto &[
id, port] : telemetryPorts) {
156 uint64_t value = *port->read().get().as<uint64_t>();
157 os << value << std::endl;
Abstract class representing a connection to an accelerator.
ServiceClass * getService(AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
Get a typed reference to a particular service type.
Context & getCtxt() const
AcceleratorServiceThread * getServiceThread()
Return a pointer to the accelerator 'service' thread (or threads).
void addPoll(HWModule &module)
Poll this module.
Top level accelerator class.
Services provide connections to 'bundles' – collections of named, unidirectional communication channe...
const PortMap & getChannels() const
AppID getID() const
Get the ID of the port.
Common options and code for ESI runtime tools.
Context & getContext()
Get the context.
std::unique_ptr< AcceleratorConnection > connect()
Connect to the accelerator using the specified backend and connection.
int esiParse(int argc, const char **argv)
Run the parser.
AcceleratorConnections, Accelerators, and Manifests must all share a context.
Represents either the top level or an instance of a hardware module.
std::vector< std::reference_wrapper< BundlePort > > getPortsOrdered() const
Get the module's ports in a deterministic order.
std::vector< const Instance * > getChildrenOrdered() const
Get a vector of the module's children in a deterministic order.
Subclass of HWModule which represents a submodule instance.
Class to parse a manifest.
uint32_t getApiVersion() const
Accelerator * buildAccelerator(AcceleratorConnection &acc) const
const std::vector< const Type * > & getTypeTable() const
The Type Table is an ordered list of types.
std::vector< ModuleInfo > getModuleInfos() const
Root class of the ESI type system.
Add a custom interface to a service client at a particular point in the design hierarchy.
Information about the Accelerator system.
virtual std::string getJsonManifest() const
Return the JSON-formatted system manifest.
Service for retrieving telemetry data from the accelerator.
const std::map< AppIDPath, Telemetry * > & getTelemetryPorts()
void printHier(std::ostream &os, AcceleratorConnection &acc)
void printTelemetry(std::ostream &os, AcceleratorConnection &acc)
void printInfo(std::ostream &os, AcceleratorConnection &acc)
void printInstance(std::ostream &os, const HWModule *d, std::string indent="")
int main(int argc, const char *argv[])
void printPort(std::ostream &os, const BundlePort &port, std::string indent="")