Skip to content

Commit

Permalink
Fix up some stuff for miner monitor, based on wienerdog's setup
Browse files Browse the repository at this point in the history
  • Loading branch information
fireworm71 committed Jan 4, 2018
1 parent 240633b commit 64cf7ba
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ veriumMiner
This is a multi-threaded CPU miner for Verium using scrypt²,
fork of [tpruvot](//github.com/tpruvot)'s cpuminer-multi (see AUTHORS for list of contributors).

[Latest Binaries here](https://github.com/fireworm71/veriumMiner/releases/latest)

#### Table of contents

* [Dependencies](#dependencies)
Expand Down Expand Up @@ -98,7 +100,7 @@ https://netix.dl.sourceforge.net/project/ezwinports/make-4.2.1-without-guile-w32

* Copy everything in C:\msys64\mingw64 without replacing anything
* Download and extract the Miner from Git, place it in C:\msys64
* Open MSYS2 MinGW64 Shell.
* Open MSYS2 MinGW64 Shell:
```
cd /veriumMiner-main
./mingw64.sh
Expand Down
6 changes: 3 additions & 3 deletions api.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int bye = 0;
extern char *opt_api_allow;
extern int opt_api_listen; /* port */
extern int opt_api_remote;
extern uint64_t global_hashrate;
extern double global_hashrate;
extern uint32_t solved_count;
extern uint32_t accepted_count;
extern uint32_t rejected_count;
Expand Down Expand Up @@ -149,11 +149,11 @@ static char *getsummary(char *params)

*buffer = '\0';
sprintf(buffer, "NAME=%s;VER=%s;API=%s;"
"ALGO=%s;CPUS=%d;KHS=%.2f;SOLV=%d;ACC=%d;REJ=%d;"
"ALGO=%s;CPUS=%d;KHS=%.5f;SOLV=%d;ACC=%d;REJ=%d;"
"ACCMN=%.3f;DIFF=%.6f;TEMP=%.1f;FAN=%d;FREQ=%d;"
"UPTIME=%.0f;TS=%u|",
PACKAGE_NAME, PACKAGE_VERSION, APIVERSION,
algo, opt_n_total_threads, (double)global_hashrate / 1000.0,
algo, opt_n_total_threads, global_hashrate / 1000.0,
solved_count, accepted_count, rejected_count, accps, net_diff > 0. ? net_diff : stratum_diff,
cpu.cpu_temp, cpu.cpu_fan, cpu.cpu_clock,
uptime, (uint32_t) ts);
Expand Down
8 changes: 4 additions & 4 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ uint32_t solved_count = 0L;
uint32_t accepted_count = 0L;
uint32_t rejected_count = 0L;
double *thr_hashrates;
uint64_t global_hashrate = 0;
double global_hashrate = 0;
double stratum_diff = 0.;
double net_diff = 0.;
double net_hashrate = 0.;
Expand Down Expand Up @@ -859,7 +859,7 @@ static int share_result(int result, struct work *work, const char *reason)
result ? accepted_count++ : rejected_count++;
pthread_mutex_unlock(&stats_lock);

global_hashrate = (uint64_t) hashrate;
global_hashrate = hashrate;

if (!net_diff || sharediff < net_diff) {
flag = use_colors ?
Expand Down Expand Up @@ -1780,7 +1780,7 @@ static void *miner_thread(void *userdata)
}
if (opt_benchmark) {
char rate[32];
format_hashrate((double)global_hashrate, rate);
format_hashrate(global_hashrate, rate);
applog(LOG_NOTICE, "Benchmark: %s", rate);
fprintf(stderr, "%llu\n", (long long unsigned int) global_hashrate);
} else {
Expand Down Expand Up @@ -1847,7 +1847,7 @@ static void *miner_thread(void *userdata)
applog(LOG_NOTICE, "Total: %s H/m", s);
break;
}
global_hashrate = (uint64_t) hashrate;
global_hashrate = hashrate;
}
}

Expand Down
2 changes: 1 addition & 1 deletion miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ extern int num_cpus;
extern struct work_restart *work_restart;
extern uint32_t opt_work_size;
extern double *thr_hashrates;
extern uint64_t global_hashrate;
extern double global_hashrate;
extern double stratum_diff;
extern double net_diff;
extern double net_hashrate;
Expand Down
2 changes: 1 addition & 1 deletion mingw64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CFLAGS="-DCURL_STATICLIB -DOPENSSL_NO_ASM -DUSE_ASM -static-libgcc $extracflags"
windres res/icon.rc icon.o

./configure --build=x86_64-w64-mingw32 --with-crypto=$SSL_PREFIX --with-curl=$CURL_PREFIX \
CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="icon.o"
CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="icon.o" --with-mbedtls --without-ssl --without-libssh2 --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-ldaps --disable-pop3 --disable-rtsp --disable-smtp --disable-telnet --disable-tftp --disable-verbose --disable-shared --enable-static --disable-manual

make

Expand Down
22 changes: 16 additions & 6 deletions sysinfos.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@
#ifndef WIN32

#define HWMON_PATH \
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input"
"/sys/devices/virtual/thermal/thermal_zone3/temp"
#define HWMON_ALT \
"/sys/class/hwmon/hwmon1/temp1_input"
"/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input"
#define HWMON_ALT2 \
"/sys/class/hwmon/hwmon0/temp1_input"
"/sys/class/hwmon/hwmon1/temp1_input"
#define HWMON_ALT3 \
"/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input"
"/sys/class/hwmon/hwmon0/temp1_input"
#define HWMON_ALT4 \
"/sys/class/hwmon/hwmon0/temp2_input"
"/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input"
#define HWMON_ALT5 \
"/sys/class/hwmon/hwmon0/temp2_input"
#define HWMON_ALT6 \
"/sys/class/hwmon/hwmon0/device/temp1_input"


static float linux_cputemp(int core)
{
float tc = 0.0;
Expand Down Expand Up @@ -58,14 +61,21 @@ static float linux_cputemp(int core)
}

#define CPUFREQ_PATH \
"/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq"
#define CPUFREQ_PATH_ALT \
"/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq"

static uint32_t linux_cpufreq(int core)
{
FILE *fd = fopen(CPUFREQ_PATH, "r");
uint32_t freq = 0;

if (!fd)
return freq;
{
fd = fopen(CPUFREQ_PATH_ALT, "r");
if (!fd)
return freq;
}

if (!fscanf(fd, "%d", &freq))
return freq;
Expand Down
2 changes: 1 addition & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ static bool stratum_benchdata(json_t *result, json_t *params, int thr_id)
json_object_set_new(val, "freq", json_integer((uint64_t)cpufreq));
json_object_set_new(val, "memf", json_integer(0));
json_object_set_new(val, "power", json_integer(0));
json_object_set_new(val, "khashes", json_real((double)global_hashrate / 1000.0));
json_object_set_new(val, "khashes", json_real(global_hashrate / 1000.0));
json_object_set_new(val, "intensity", json_real(opt_default_priority));
json_object_set_new(val, "throughput", json_integer(opt_n_total_threads));
json_object_set_new(val, "client", json_string(PACKAGE_NAME "/" PACKAGE_VERSION));
Expand Down

0 comments on commit 64cf7ba

Please sign in to comment.