mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-18 10:01:06 +00:00
Added command line option --export-topology.
This commit is contained in:
parent
6b3b1c3fc4
commit
bd739d217b
3 changed files with 51 additions and 2 deletions
|
@ -41,6 +41,9 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace xmrig {
|
||||||
|
|
||||||
|
|
||||||
static int showVersion()
|
static int showVersion()
|
||||||
{
|
{
|
||||||
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
|
||||||
|
@ -92,6 +95,36 @@ static int showVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
static int exportTopology(const Process &process)
|
||||||
|
{
|
||||||
|
const String path = process.location(Process::ExeLocation, "topology.xml");
|
||||||
|
|
||||||
|
hwloc_topology_t topology;
|
||||||
|
hwloc_topology_init(&topology);
|
||||||
|
hwloc_topology_load(topology);
|
||||||
|
|
||||||
|
# if HWLOC_API_VERSION >= 0x20000
|
||||||
|
if (hwloc_topology_export_xml(topology, path, 0) == -1) {
|
||||||
|
# else
|
||||||
|
if (hwloc_topology_export_xml(topology, path) == -1) {
|
||||||
|
# endif
|
||||||
|
printf("failed to export hwloc topology.\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("hwloc topology successfully exported to \"%s\"\n", path.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
hwloc_topology_destroy(topology);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace xmrig
|
||||||
|
|
||||||
|
|
||||||
xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
||||||
{
|
{
|
||||||
const Arguments &args = process.arguments();
|
const Arguments &args = process.arguments();
|
||||||
|
@ -103,11 +136,17 @@ xmrig::Entry::Id xmrig::Entry::get(const Process &process)
|
||||||
return Version;
|
return Version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
if (args.hasArg("--export-topology")) {
|
||||||
|
return Topo;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int xmrig::Entry::exec(const Process &, Id id)
|
int xmrig::Entry::exec(const Process &process, Id id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case Usage:
|
case Usage:
|
||||||
|
@ -117,6 +156,11 @@ int xmrig::Entry::exec(const Process &, Id id)
|
||||||
case Version:
|
case Version:
|
||||||
return showVersion();
|
return showVersion();
|
||||||
|
|
||||||
|
# ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
case Topo:
|
||||||
|
return exportTopology(process);
|
||||||
|
# endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ public:
|
||||||
enum Id {
|
enum Id {
|
||||||
Default,
|
Default,
|
||||||
Usage,
|
Usage,
|
||||||
Version
|
Version,
|
||||||
|
Topo
|
||||||
};
|
};
|
||||||
|
|
||||||
static Id get(const Process &process);
|
static Id get(const Process &process);
|
||||||
|
|
|
@ -113,6 +113,10 @@ Options:\n\
|
||||||
--randomx-init=N threads count to initialize RandomX dataset\n\
|
--randomx-init=N threads count to initialize RandomX dataset\n\
|
||||||
--randomx-no-numa disable NUMA support for RandomX\n"
|
--randomx-no-numa disable NUMA support for RandomX\n"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XMRIG_FEATURE_HWLOC
|
||||||
|
"\
|
||||||
|
--export-topology export hwloc topology to a XML file and exit\n"
|
||||||
|
#endif
|
||||||
"\
|
"\
|
||||||
--dry-run test configuration and exit\n\
|
--dry-run test configuration and exit\n\
|
||||||
-h, --help display this help and exit\n\
|
-h, --help display this help and exit\n\
|
||||||
|
|
Loading…
Reference in a new issue