mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
Tweaks to make the application more Windows-friendly
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
bin/
|
||||
obj/
|
||||
xmr-stak-cpu.layout
|
||||
xmr-stak-cpu.depend
|
||||
+44
-7
@@ -21,30 +21,67 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
//Do a press any key for the windows folk. *insert any key joke here*
|
||||
#ifdef _WIN32
|
||||
void win_exit()
|
||||
{
|
||||
|
||||
printer::inst()->print_str("Press any key to exit.");
|
||||
get_key();
|
||||
return;
|
||||
}
|
||||
|
||||
#define strcasecmp _stricmp
|
||||
|
||||
#else
|
||||
void win_exit() { return; }
|
||||
#endif // _WIN32
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(argc != 2 || strcmp(argv[1], "-h") == 0)
|
||||
const char* sFilename = "config.txt";
|
||||
|
||||
if(argc >= 2)
|
||||
{
|
||||
printer::inst()->print_msg(L0, "Usage %s [CONFIG FILE]", argv[0]);
|
||||
return 0;
|
||||
if(strcmp(argv[1], "-h") == 0)
|
||||
{
|
||||
printer::inst()->print_msg(L0, "Usage %s [CONFIG FILE]", argv[0]);
|
||||
win_exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(argc >= 3 && strcasecmp(argv[1], "-c") == 0)
|
||||
sFilename = argv[2];
|
||||
else
|
||||
sFilename = argv[1];
|
||||
}
|
||||
|
||||
if(!jconf::inst()->parse_config(argv[1]))
|
||||
if(!jconf::inst()->parse_config(sFilename))
|
||||
{
|
||||
win_exit();
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
printer::inst()->print_str("-------------------------------------------------------------------\n");
|
||||
printer::inst()->print_str("XMR-Stak-CPU mining software, CPU Version.\n");
|
||||
printer::inst()->print_str("Based on CPU mining code by wolf9466 (heavily optimized by myself).\n");
|
||||
printer::inst()->print_str("Brought to you by fireice_uk under GPLv3.\n");
|
||||
printer::inst()->print_str("Brought to you by fireice_uk under GPLv3.\n\n");
|
||||
char buffer[64];
|
||||
snprintf(buffer, sizeof(buffer), "Configurable dev donation level is set to %.1f %%\n", fDevDonationLevel * 100.0);
|
||||
snprintf(buffer, sizeof(buffer), "Configurable dev donation level is set to %.1f %%\n\n", fDevDonationLevel * 100.0);
|
||||
printer::inst()->print_str(buffer);
|
||||
printer::inst()->print_str("You can use following keys to display reports:\n");
|
||||
printer::inst()->print_str("'h' - hashrate\n");
|
||||
printer::inst()->print_str("'r' - results\n");
|
||||
printer::inst()->print_str("'c' - connection\n");
|
||||
printer::inst()->print_str("-------------------------------------------------------------------\n");
|
||||
|
||||
if (!minethd::self_test())
|
||||
{
|
||||
win_exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
executor::inst()->ex_start();
|
||||
|
||||
|
||||
+87
-87
@@ -1,87 +1,87 @@
|
||||
/*
|
||||
* Number of threads. You can configure them below. Cryptonight uses 2MB of memory, so the optimal setting
|
||||
* here is the size of your L3 cache divided by 2. Intel mid-to-high end desktop processors have 2MB of L3
|
||||
* cache per physical core. Low end cpus can have 1.5 or 1 MB while Xeons can have 2, 2.5 or 3MB per core.
|
||||
*/
|
||||
"cpu_thread_num" : 2,
|
||||
|
||||
/*
|
||||
* Thread configuration for each thread. Make sure it matches the number above.
|
||||
* low_power_mode will double the cache usage, and double the single thread performance. It will consume much
|
||||
* less power (as less cores are working), but will max out at around 80-85% of the maximum performance.
|
||||
* affine_to_cpu can be either false (no affinity), or the CPU core number. Note that on hyperthreading systems
|
||||
* it is better to assign threads to physical cores. On Windows this usually means selecting even or odd numbered
|
||||
* cpu numbers. For Linux it will be usually the lower CPU numbers, so for a 4 physical core CPU you should select
|
||||
* cpu numbers 0-3.
|
||||
*/
|
||||
"cpu_threads_conf" : [
|
||||
{ "low_power_mode" : false, "affine_to_cpu" : 0 },
|
||||
{ "low_power_mode" : false, "affine_to_cpu" : 1 },
|
||||
],
|
||||
|
||||
/*
|
||||
* LARGE PAGE SUPPORT
|
||||
* By default we will try to allocate large pages. This means you need to "Run As Administrator" on Windows.
|
||||
* On Linux you will need to configure large page support "sudo sysctl -w vm.nr_hugepages=128" and increase your
|
||||
* ulimit -l. To do do this you need to add following lines to /etc/security/limits.conf - "* soft memlock 262144"
|
||||
* and "* hard memlock 262144". You can also do it Windows-style and simply run-as-root, but this is NOT
|
||||
* recommended for security reasons.
|
||||
*
|
||||
* Memory locking means that the kernel can't swap out the page to disk - something that is unlikey to happen on a
|
||||
* command line system that isn't starved of memory. I haven't observed any difference on a CLI Linux system between
|
||||
* locked and unlocked memory. If that is your setup see option "no_mlck".
|
||||
*/
|
||||
|
||||
/*
|
||||
* use_slow_memory defines our behaviour with regards to large pages. There are three possible options here:
|
||||
* always - Don't even try to use large pages. Always use slow memory.
|
||||
* warn - We will try to use large pages, but fall back to slow memory if that fails.
|
||||
* no_mlck - This option is only relevant on Linux, where we can use large pages without locking memory.
|
||||
* It will never use slow memory, but it won't attempt to mlock
|
||||
* never - If we fail to allocate large pages we will print an error and exit.
|
||||
*/
|
||||
"use_slow_memory" : "warn",
|
||||
|
||||
/*
|
||||
* pool_address - Pool address should be in the form "pool.supportxmr.com:3333". Only stratum pools are supported.
|
||||
* wallet_address - Your wallet, or pool login.
|
||||
* pool_password - Can be empty in most cases or "x".
|
||||
*/
|
||||
"pool_address" : "pool.supportxmr.com:3333",
|
||||
"wallet_address" : "",
|
||||
"pool_password" : "",
|
||||
|
||||
/*
|
||||
* Network timeouts.
|
||||
* Because of the way this client is written it doesn't need to constantly talk (keep-alive) to the server to make
|
||||
* sure it is there. We detect a buggy / overloaded server by the call timeout. The default values will be ok for
|
||||
* nearly all cases. If they aren't the pool has most likely overload issues. Low call timeout values are preferable -
|
||||
* long timeouts mean that we waste hashes on potentially stale jobs. Connection report will tell you how long the
|
||||
* server usually takes to process our calls.
|
||||
*
|
||||
* call_timeout - How long should we wait for a response from the server before we assume it is dead and drop the connection.
|
||||
* retry_time - How long should we wait before another connection attempt.
|
||||
* Both values are in seconds.
|
||||
*/
|
||||
"call_timeout" : 10,
|
||||
"retry_time" : 10,
|
||||
|
||||
/*
|
||||
* Output control.
|
||||
* Since most people are used to miners printing all the time, that's what we do by default too. This is suboptimal
|
||||
* really, since you cannot see errors under pages and pages of text and performance stats. Given that we have internal
|
||||
* performance monitors, there is very little reason to spew out pages of text instead of concise reports.
|
||||
* Press 'h' (hashrate), 'r' (results) or 'c' (connection) to print reports.
|
||||
*
|
||||
* verbose_level - 0 - Don't print anything.
|
||||
* 1 - Print intro, connection event, disconnect event
|
||||
* 2 - All of level 1, and new job (block) event if the difficulty is different from the last job
|
||||
* 3 - All of level 1, and new job (block) event in all cases, result submission event.
|
||||
*/
|
||||
"verbose_level" : 3,
|
||||
|
||||
/*
|
||||
* prefer_ipv4 - IPv6 preference. If the host is available on both IPv4 and IPv6 net, which one should be choose?
|
||||
* This setting will only be needed in 2020's. No need to worry about it now.
|
||||
*/
|
||||
"prefer_ipv4" : true,
|
||||
/*
|
||||
* Number of threads. You can configure them below. Cryptonight uses 2MB of memory, so the optimal setting
|
||||
* here is the size of your L3 cache divided by 2. Intel mid-to-high end desktop processors have 2MB of L3
|
||||
* cache per physical core. Low end cpus can have 1.5 or 1 MB while Xeons can have 2, 2.5 or 3MB per core.
|
||||
*/
|
||||
"cpu_thread_num" : 2,
|
||||
|
||||
/*
|
||||
* Thread configuration for each thread. Make sure it matches the number above.
|
||||
* low_power_mode will double the cache usage, and double the single thread performance. It will consume much
|
||||
* less power (as less cores are working), but will max out at around 80-85% of the maximum performance.
|
||||
* affine_to_cpu can be either false (no affinity), or the CPU core number. Note that on hyperthreading systems
|
||||
* it is better to assign threads to physical cores. On Windows this usually means selecting even or odd numbered
|
||||
* cpu numbers. For Linux it will be usually the lower CPU numbers, so for a 4 physical core CPU you should select
|
||||
* cpu numbers 0-3.
|
||||
*/
|
||||
"cpu_threads_conf" : [
|
||||
{ "low_power_mode" : false, "affine_to_cpu" : 0 },
|
||||
{ "low_power_mode" : false, "affine_to_cpu" : 1 },
|
||||
],
|
||||
|
||||
/*
|
||||
* LARGE PAGE SUPPORT
|
||||
* By default we will try to allocate large pages. This means you need to "Run As Administrator" on Windows.
|
||||
* On Linux you will need to configure large page support "sudo sysctl -w vm.nr_hugepages=128" and increase your
|
||||
* ulimit -l. To do do this you need to add following lines to /etc/security/limits.conf - "* soft memlock 262144"
|
||||
* and "* hard memlock 262144". You can also do it Windows-style and simply run-as-root, but this is NOT
|
||||
* recommended for security reasons.
|
||||
*
|
||||
* Memory locking means that the kernel can't swap out the page to disk - something that is unlikey to happen on a
|
||||
* command line system that isn't starved of memory. I haven't observed any difference on a CLI Linux system between
|
||||
* locked and unlocked memory. If that is your setup see option "no_mlck".
|
||||
*/
|
||||
|
||||
/*
|
||||
* use_slow_memory defines our behaviour with regards to large pages. There are three possible options here:
|
||||
* always - Don't even try to use large pages. Always use slow memory.
|
||||
* warn - We will try to use large pages, but fall back to slow memory if that fails.
|
||||
* no_mlck - This option is only relevant on Linux, where we can use large pages without locking memory.
|
||||
* It will never use slow memory, but it won't attempt to mlock
|
||||
* never - If we fail to allocate large pages we will print an error and exit.
|
||||
*/
|
||||
"use_slow_memory" : "warn",
|
||||
|
||||
/*
|
||||
* pool_address - Pool address should be in the form "pool.supportxmr.com:3333". Only stratum pools are supported.
|
||||
* wallet_address - Your wallet, or pool login.
|
||||
* pool_password - Can be empty in most cases or "x".
|
||||
*/
|
||||
"pool_address" : "pool.supportxmr.com:3333",
|
||||
"wallet_address" : "",
|
||||
"pool_password" : "",
|
||||
|
||||
/*
|
||||
* Network timeouts.
|
||||
* Because of the way this client is written it doesn't need to constantly talk (keep-alive) to the server to make
|
||||
* sure it is there. We detect a buggy / overloaded server by the call timeout. The default values will be ok for
|
||||
* nearly all cases. If they aren't the pool has most likely overload issues. Low call timeout values are preferable -
|
||||
* long timeouts mean that we waste hashes on potentially stale jobs. Connection report will tell you how long the
|
||||
* server usually takes to process our calls.
|
||||
*
|
||||
* call_timeout - How long should we wait for a response from the server before we assume it is dead and drop the connection.
|
||||
* retry_time - How long should we wait before another connection attempt.
|
||||
* Both values are in seconds.
|
||||
*/
|
||||
"call_timeout" : 10,
|
||||
"retry_time" : 10,
|
||||
|
||||
/*
|
||||
* Output control.
|
||||
* Since most people are used to miners printing all the time, that's what we do by default too. This is suboptimal
|
||||
* really, since you cannot see errors under pages and pages of text and performance stats. Given that we have internal
|
||||
* performance monitors, there is very little reason to spew out pages of text instead of concise reports.
|
||||
* Press 'h' (hashrate), 'r' (results) or 'c' (connection) to print reports.
|
||||
*
|
||||
* verbose_level - 0 - Don't print anything.
|
||||
* 1 - Print intro, connection event, disconnect event
|
||||
* 2 - All of level 1, and new job (block) event if the difficulty is different from the last job
|
||||
* 3 - All of level 1, and new job (block) event in all cases, result submission event.
|
||||
*/
|
||||
"verbose_level" : 3,
|
||||
|
||||
/*
|
||||
* prefer_ipv4 - IPv6 preference. If the host is available on both IPv4 and IPv6 net, which one should be choose?
|
||||
* This setting will only be needed in 2020's. No need to worry about it now.
|
||||
*/
|
||||
"prefer_ipv4" : true,
|
||||
Reference in New Issue
Block a user