45#if defined(_MSC_VER) && defined(_DEBUG)
46 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
47 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
48 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
49 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
50 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
51 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
52 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
57inline int runProbes(
int argc,
const char *argv[],
const char *name,
58 const char *description,
59 const std::vector<ProbeEntry> &probes) {
61 cli.description(description);
62 std::string probeName;
63 cli.add_option(
"--probe", probeName,
64 "Run only the named probe. Without this flag, every probe "
66 if (
int rc = cli.
esiParse(argc, argv))
68 if (!cli.get_help_ptr()->empty())
78 conn->getServiceThread()->addPoll(*accel);
81 if (probeName.empty()) {
82 for (
const auto &[pname, fn] : probes) {
89 for (
const auto &[pname, candidate] : probes) {
90 if (pname == probeName) {
96 std::cerr << name <<
": unknown probe '" << probeName <<
"'\n";
105 }
catch (std::exception &e) {
116#define ESI_PROBE_REGISTRY(name, description, ...) \
117 int main(int argc, const char *argv[]) { \
118 esi_test::configureMsvcDebugReports(); \
119 static const std::vector<esi_test::ProbeEntry> kProbes = {__VA_ARGS__}; \
120 return esi_test::runProbes(argc, argv, name, description, kProbes); \
Abstract class representing a connection to an accelerator.
Top level accelerator class.
Common options and code for ESI runtime tools.
Context & getContext()
Get the context.
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.
virtual void error(const std::string &subsystem, const std::string &msg, const std::map< std::string, std::any > *details=nullptr)
Report an error.
Class to parse a manifest.
Information about the Accelerator system.
int runProbes(int argc, const char *argv[], const char *name, const char *description, const std::vector< ProbeEntry > &probes)
Run the probe-runner main loop. Returns 0 on success, nonzero on failure.
void configureMsvcDebugReports()
std::pair< std::string, ProbeFn > ProbeEntry
int(*)(esi::Accelerator *) ProbeFn
esi::AcceleratorConnection * probeConnection
The connection the probes are running against, for probes which need connection-level services (e....