v3.12.4.6

This commit is contained in:
Jay D Dee
2020-02-28 18:20:32 -05:00
parent cedcf4d070
commit 720610cce5
6 changed files with 113 additions and 73 deletions

View File

@@ -65,6 +65,18 @@ If not what makes it happen or not happen?
Change Log
----------
v3.12.4.6
Issue #246: fixed getwork repeated new block logs with same height. New work
for the same block is now reported as "New work" instead of New block".
Also added a check that work is new before generating "New work" log.
Added target diff to getwork new block log.
Changed share ratio in share result log to simple fraction, no longer %.
Added debug log to display mininginfo, use -D.
v3.12.4.5
Issue #246: better stale share detection for getwork, and enhanced logging

View File

@@ -709,8 +709,7 @@ extern int scanhash_scrypt( struct work *work, uint32_t max_nonce,
if ( unlikely( valid_hash( hash + i * 8, ptarget ) ) )
{
pdata[19] = data[i * 20 + 19];
test_hash_and_submit( work, hash, mythr );
// submit_lane_solution( work, hash, mythr, i );
submit_lane_solution( work, hash, mythr, i );
}
}
} while ( likely( ( n < ( max_nonce - throughput ) ) && !(*restart) ) );

20
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.4.5.
# Generated by GNU Autoconf 2.69 for cpuminer-opt 3.12.4.6.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cpuminer-opt'
PACKAGE_TARNAME='cpuminer-opt'
PACKAGE_VERSION='3.12.4.5'
PACKAGE_STRING='cpuminer-opt 3.12.4.5'
PACKAGE_VERSION='3.12.4.6'
PACKAGE_STRING='cpuminer-opt 3.12.4.6'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures cpuminer-opt 3.12.4.5 to adapt to many kinds of systems.
\`configure' configures cpuminer-opt 3.12.4.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1404,7 +1404,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cpuminer-opt 3.12.4.5:";;
short | recursive ) echo "Configuration of cpuminer-opt 3.12.4.6:";;
esac
cat <<\_ACEOF
@@ -1509,7 +1509,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cpuminer-opt configure 3.12.4.5
cpuminer-opt configure 3.12.4.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2012,7 +2012,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by cpuminer-opt $as_me 3.12.4.5, which was
It was created by cpuminer-opt $as_me 3.12.4.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2993,7 +2993,7 @@ fi
# Define the identity of the package.
PACKAGE='cpuminer-opt'
VERSION='3.12.4.5'
VERSION='3.12.4.6'
cat >>confdefs.h <<_ACEOF
@@ -6690,7 +6690,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by cpuminer-opt $as_me 3.12.4.5, which was
This file was extended by cpuminer-opt $as_me 3.12.4.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6756,7 +6756,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
cpuminer-opt config.status 3.12.4.5
cpuminer-opt config.status 3.12.4.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,4 +1,4 @@
AC_INIT([cpuminer-opt], [3.12.4.5])
AC_INIT([cpuminer-opt], [3.12.4.6])
AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM

View File

@@ -489,6 +489,10 @@ static bool get_mininginfo( CURL *curl, struct work *work )
if ( key && json_is_integer( key ) )
net_blocks = json_integer_value( key );
if ( opt_debug )
applog(LOG_INFO," Mining info: diff %.5g, net_hashrate %f, height %d",
net_diff, net_hashrate, net_blocks );
if ( !work->height )
{
// complete missing data from getwork
@@ -1053,7 +1057,7 @@ static int share_result( int result, struct work *work,
}
share_ratio = my_stats.net_diff == 0. ? 0. : my_stats.share_diff /
my_stats.net_diff * 100.;
my_stats.net_diff;
// check result
if ( likely( result ) )
{
@@ -1138,11 +1142,11 @@ static int share_result( int result, struct work *work,
if ( !opt_quiet )
{
if ( have_stratum )
applog2( LOG_INFO, "Diff %.5g (%.3g%), %sBlock %d, %sJob %s",
applog2( LOG_INFO, "Diff %.5g (%.3g), %sBlock %d" CL_N ", %sJob %s",
my_stats.share_diff, share_ratio, bcol, stratum.block_height,
scol, my_stats.job_id );
else
applog2( LOG_INFO, "Diff %.5g (%.3g%), %sBlock %d",
applog2( LOG_INFO, "Diff %.5g (%.3g), %sBlock %d",
my_stats.share_diff, share_ratio, bcol, stratum.block_height );
}
@@ -1462,47 +1466,78 @@ start:
else
rc = work_decode( json_object_get( val, "result" ), work );
if ( opt_protocol && rc )
if ( rc )
{
timeval_subtract( &diff, &tv_end, &tv_start );
applog( LOG_DEBUG, "got new work in %.2f ms",
( 1000.0 * diff.tv_sec ) + ( 0.001 * diff.tv_usec ) );
}
json_decref( val );
// store work height in solo
get_mininginfo(curl, work);
applog( LOG_BLUE, "New block %d, diff %.5g", work->height, net_diff );
if ( !opt_quiet && net_diff && net_hashrate )
{
double miner_hr = 0.;
pthread_mutex_lock( &stats_lock );
for ( int i = 0; i < opt_n_threads; i++ )
miner_hr += thr_hashrates[i];
global_hashrate = miner_hr;
pthread_mutex_unlock( &stats_lock );
if ( miner_hr )
if ( opt_protocol )
{
double net_hr = net_hashrate;
char net_hr_units[4] = {0};
char miner_hr_units[4] = {0};
char net_ttf[32];
char miner_ttf[32];
sprintf_et( net_ttf, net_diff * exp32 / net_hr );
sprintf_et( miner_ttf, net_diff * exp32 / miner_hr );
scale_hash_for_display ( &miner_hr, miner_hr_units );
scale_hash_for_display ( &net_hr, net_hr_units );
applog2(LOG_INFO, "Miner TTF @ %.2f %sh/s %s, net TTF @ %.2f %sh/s %s",
miner_hr, miner_hr_units, miner_ttf,
net_hr, net_hr_units, net_ttf );
timeval_subtract( &diff, &tv_end, &tv_start );
applog( LOG_DEBUG, "got new work in %.2f ms",
( 1000.0 * diff.tv_sec ) + ( 0.001 * diff.tv_usec ) );
}
}
json_decref( val );
// store work height in solo
get_mininginfo(curl, work);
if ( work->height > last_block_height )
{
last_block_height = work->height;
applog( LOG_BLUE, "New block %d, net diff %.5g, target diff %.5g",
work->height, net_diff, work->targetdiff );
if ( !opt_quiet && net_diff && net_hashrate )
{
double miner_hr = 0.;
pthread_mutex_lock( &stats_lock );
for ( int i = 0; i < opt_n_threads; i++ )
miner_hr += thr_hashrates[i];
global_hashrate = miner_hr;
pthread_mutex_unlock( &stats_lock );
if ( miner_hr )
{
double net_hr = net_hashrate;
char net_hr_units[4] = {0};
char miner_hr_units[4] = {0};
char net_ttf[32];
char miner_ttf[32];
sprintf_et( net_ttf, ( work->targetdiff * exp32 ) / net_hr );
sprintf_et( miner_ttf, ( work->targetdiff * exp32 ) / miner_hr );
scale_hash_for_display ( &miner_hr, miner_hr_units );
scale_hash_for_display ( &net_hr, net_hr_units );
applog2( LOG_INFO,
"Miner TTF @ %.2f %sh/s %s, net TTF @ %.2f %sh/s %s",
miner_hr, miner_hr_units, miner_ttf,
net_hr, net_hr_units, net_ttf );
}
}
} // work->height > last_block_height
else if ( memcmp( &work->data[1], &g_work.data[1], 32 ) )
{
applog( LOG_BLUE, "New work" );
if ( opt_debug )
{
uint32_t *old = g_work.data;
uint32_t *new = work->data;
printf("old: %08x %08x %08x %08x %08x %08x %08x %08x/n",
old[0],old[1],old[2],old[3],old[4],old[5],old[6],old[7]);
printf(" %08x %08x %08x %08x %08x %08x %08x %08x/n",
old[8],old[9],old[10],old[11],old[12],old[13],old[14],old[15]);
printf(" %08x %08x %08x %08x/n",
old[16],old[17],old[18],old[19]);
printf("new: %08x %08x %08x %08x %08x %08x %08x %08x/n",
new[0],new[1],new[2],new[3],new[4],new[5],new[6],new[7]);
printf(" %08x %08x %08x %08x %08x %08x %08x %08x/n",
new[8],new[9],new[10],new[11],new[12],new[13],new[14],new[15]);
printf(" %08x %08x %08x %08x/n",
new[16],new[17],new[18],new[19]);
}
}
} // rc
return rc;
}
@@ -1704,6 +1739,11 @@ static inline double u256_to_double( const uint64_t *u )
static void update_submit_stats( struct work *work, const void *hash )
{
// Workaround until problems with target_to_diff are resolved.
work->sharediff = work->targetdiff * (double)( ((uint64_t*)hash)[3] )
/ (double)( ((uint64_t*)work->target)[3] );
// work->sharediff = likely( hash ) ? target_to_diff( (uint32_t*)hash ) : 0.;
pthread_mutex_lock( &stats_lock );
submitted_share_count++;
@@ -1752,12 +1792,7 @@ bool submit_solution( struct work *work, const void *hash,
{
if ( likely( submit_work( thr, work ) ) )
{
work->sharediff = work->targetdiff * (double)( ((uint64_t*)hash)[3] )
/ (double)( ((uint64_t*)work->target)[3] );
// work->sharediff = likely( hash ) ? target_to_diff( (uint32_t*)hash ) : 0.;
update_submit_stats( work, hash );
// submitted_share_count++;
// work_set_target_ratio( work, hash );
if ( !opt_quiet )
{
@@ -1770,7 +1805,7 @@ bool submit_solution( struct work *work, const void *hash,
submitted_share_count, work->sharediff, work->height );
}
if ( lowdiff_debug )
if ( unlikely( lowdiff_debug ) )
{
uint32_t* h = (uint32_t*)hash;
uint32_t* t = (uint32_t*)work->target;
@@ -1782,22 +1817,17 @@ bool submit_solution( struct work *work, const void *hash,
return true;
}
else
applog( LOG_WARNING, "%d failed to submit share, thread %d",
submitted_share_count, thr->id );
applog( LOG_WARNING, "%d failed to submit share", submitted_share_count );
return false;
}
// deprecated, use submit_solution
bool submit_lane_solution( struct work *work, const void *hash,
struct thr_info *thr, const int lane )
{
if ( likely( submit_work( thr, work ) ) )
{
work->sharediff = work->targetdiff * (double)( ((uint64_t*)hash)[3] )
/ (double)( ((uint64_t*)work->target)[3] );
// work->sharediff = likely( hash ) ? target_to_diff( (uint32_t*)hash ) : 0.;
update_submit_stats( work, hash );
// submitted_share_count++;
// work_set_target_ratio( work, hash );
if ( !opt_quiet )
{
@@ -1822,8 +1852,8 @@ bool submit_lane_solution( struct work *work, const void *hash,
return true;
}
else
applog( LOG_WARNING, "%d failed to submit share, thread %d, lane %d",
submitted_share_count, thr->id, lane );
applog( LOG_WARNING, "%d failed to submit share", submitted_share_count );
return false;
}
@@ -1835,7 +1865,6 @@ bool test_hash_and_submit( struct work *work, const void *hash,
work->sharediff = work->targetdiff * (double)( ((uint64_t*)hash)[3] )
/ (double)( ((uint64_t*)work->target)[3] );
// work->sharediff = likely( hash ) ? target_to_diff( (uint32_t*)hash ) : 0.;
if ( work->sharediff >= work->targetdiff )
{
if ( likely( submit_work( thr, work ) ) )
@@ -2656,7 +2685,7 @@ void std_stratum_gen_work( struct stratum_ctx *sctx, struct work *g_work )
char block_ttf[32];
char share_ttf[32];
sprintf_et( block_ttf, net_diff * exp32 / hr );
sprintf_et( block_ttf, ( net_diff * exp32 ) / hr );
sprintf_et( share_ttf, last_targetdiff * exp32 / hr );
scale_hash_for_display ( &hr, hr_units );
applog2( LOG_INFO, "TTF @ %.2f %sh/s: block %s, share %s",

4
util.c
View File

@@ -983,6 +983,7 @@ int timeval_subtract(struct timeval *result, struct timeval *x,
return x->tv_sec < y->tv_sec;
}
// deprecated, use test_hash_and_submit
// Use this when deinterleaved
// do 64 bit test 4 iterations
inline bool valid_hash( const void *hash, const void *target )
@@ -999,6 +1000,7 @@ inline bool valid_hash( const void *hash, const void *target )
return true;
}
// deprecated, use test_hash_and_submit
bool fulltest( const uint32_t *hash, const uint32_t *target )
{
int i;
@@ -1067,7 +1069,6 @@ void diff_to_target(uint32_t *target, double diff)
uint64_t m;
int k;
// static const double exp64 = (double)0xffffffffffffffff + 1.;
for ( k = 3; k > 0 && diff > 1.0; k-- )
diff /= exp64;
@@ -1082,7 +1083,6 @@ void diff_to_target(uint32_t *target, double diff)
}
}
// deprecated
void work_set_target(struct work* work, double diff)
{