@@ -42,20 +42,39 @@ const AGENT = "Meta Miner " + VERSION;
4242// the multiplier is for supporting hashrate prints in different units
4343// the nr benchmark prints is to make sure hashrate has stabilized before snapping the benchmark value
4444const hashrate_regexes = [
45- [ 1 , 1 , / \[ [ ^ \] ] + \] s p e e d 2 .5 s \/ 6 0 s \/ 1 5 m [ \d \. ] + ( [ \d \. ] + ) \s / ] , // for old xmrig
46- [ 1 , 1 , / \[ [ ^ \] ] + \] s p e e d 1 0 s \/ 6 0 s \/ 1 5 m [ \d \. n / a ] + ( [ \d \. ] + ) \s / ] , // for new xmrig
47- [ 1 , 1 , / \s + m i n e r \s + s p e e d 1 0 s \/ 6 0 s \/ 1 5 m [ \d \. n / a ] + ( [ \d \. ] + ) \s / ] , // for xmrig v6+
48- [ 1 , 1 , / T o t a l s \( A L L \) : \s + [ \d \. ] + \s + ( [ 1 - 9 ] \d * \. \d + | 0 \. [ 1 - 9 ] \d * ) \s / ] , // xmr-stak
49- [ 1 , 1 , / T o t a l S p e e d : ( [ \d \. ] + ) H \/ s , / ] , // claymore
50- [ 1 , 1 , / \( A v r ( [ \d \. ] + ) H \/ s \) / ] , // CryptoDredge
51- [ 1e3 , 3 , / T o t a l [ ^ : ] + : \s * ( [ \d \. ] + ) \s * k h \/ s / ] , // TeamRedMiner variant 1 (kh/s)
52- [ 1 , 3 , / T o t a l [ ^ : ] + : \s * ( [ \d \. ] + ) \s * h \/ s / ] , // TeamRedMiner variant 2 (h/s)
53- [ 1 , 1 , / M i n i n g a t \s + ( [ \d \. ] + ) g p s / ] , // tube4referenceMiner (use mode=rolling command line option)
54- [ 1 , 1 , / m i n i n g a t \s + ( [ \d \. ] + ) g p s / ] , // SwapReferenceMiner (use mode=rolling command line option)
55- [ 1 , 2 , / T o t a l \s + : \s + ( [ \d \. ] + ) g p s / ] , // MoneroVMiner
56- [ 1 , 2 , / ( [ \d \. ] + ) G \/ s / ] , // gminer
57- [ 1000000 , 2 , / ( [ \d \. ] + ) M H \/ s / ] , // gminer
45+ [ 1 , 2 , / ^ \| .* [ ^ \d \. ] ( [ \d \. ] + ) G \/ s .* \| $ / , 'gminer (gh/s)' ] ,
46+ [ 1e6 , 2 , / ^ \| .* [ ^ \d \. ] ( [ \d \. ] + ) M \/ s .* \| $ / , 'gminer (mh/s)' ] ,
47+ [ 1 , 3 , / ^ \[ [ ^ \] ] + \] T o t a l [ ^ : ] + : \s * ( [ \d \. ] + ) \s * [ H h ] \/ s / , 'TeamRedMiner (h/s)' ] ,
48+ [ 1e3 , 3 , / ^ \[ [ ^ \] ] + \] T o t a l [ ^ : ] + : \s * ( [ \d \. ] + ) \s * [ K k ] h \/ s / , 'TeamRedMiner (kh/s)' ] ,
49+ [ 1e6 , 3 , / ^ \[ [ ^ \] ] + \] T o t a l [ ^ : ] + : \s * ( [ \d \. ] + ) \s * [ M m ] h \/ s , / , 'TeamRedMiner (mh/s)' ] ,
50+ [ 1e9 , 3 , / ^ \[ [ ^ \] ] + \] T o t a l [ ^ : ] + : \s * ( [ \d \. ] + ) \s * [ G g ] h \/ s , / , 'TeamRedMiner (gh/s)' ] ,
51+ [ 1 , 2 , / ^ e t h m i n e r .* ( [ \d \. ] + ) h - / , 'ethminer (h/s)' ] ,
52+ [ 1e3 , 2 , / ^ e t h m i n e r .* ( [ \d \. ] + ) K h - / , 'ethminer (kh/s)' ] ,
53+ [ 1e6 , 2 , / ^ e t h m i n e r .* ( [ \d \. ] + ) M h - / , 'ethminer (mh/s)' ] ,
54+ [ 1e9 , 2 , / ^ e t h m i n e r .* ( [ \d \. ] + ) G h - / , 'ethminer (gh/s)' ] ,
55+ [ 1 , 2 , / ^ G P U # ( \d + ) : .* - ( [ \d \. ] + ) H \/ s / , 'T-Rex (h/s)' ] ,
56+ [ 1e3 , 2 , / ^ G P U # ( \d + ) : .* - ( [ \d \. ] + ) K H \/ s / , 'T-Rex (kh/s)' ] ,
57+ [ 1e6 , 2 , / ^ G P U # ( \d + ) : .* - ( [ \d \. ] + ) M H \/ s / , 'T-Rex (mh/s)' ] ,
58+ [ 1e9 , 2 , / ^ G P U # ( \d + ) : .* - ( [ \d \. ] + ) G H \/ s / , 'T-Rex (gh/s)' ] ,
59+ [ 1 , 2 , / ^ A v e r a g e s p e e d \( 3 0 s \) : ( [ \d \. ] + ) h \/ s / , 'lolMiner (h/s)' ] ,
60+ [ 1e3 , 2 , / ^ A v e r a g e s p e e d \( 3 0 s \) : ( [ \d \. ] + ) k h \/ s / , 'lolMiner (kh/s)' ] ,
61+ [ 1e6 , 2 , / ^ A v e r a g e s p e e d \( 3 0 s \) : ( [ \d \. ] + ) m h \/ s / , 'lolMiner (mh/s)' ] ,
62+ [ 1e9 , 2 , / ^ A v e r a g e s p e e d \( 3 0 s \) : ( [ \d \. ] + ) g h \/ s / , 'lolMiner (gh/s)' ] ,
63+ [ 1 , 2 , / ^ E t h s p e e d : ( [ \d \. ] + ) H \/ s , s h a r e s : .* t i m e : / , 'PhoenixMiner (h/s)' ] ,
64+ [ 1e3 , 2 , / ^ E t h s p e e d : ( [ \d \. ] + ) K H \/ s , s h a r e s : .* t i m e : / , 'PhoenixMiner (kh/s)' ] ,
65+ [ 1e6 , 2 , / ^ E t h s p e e d : ( [ \d \. ] + ) M H \/ s , s h a r e s : .* t i m e : / , 'PhoenixMiner (mh/s)' ] ,
66+ [ 1e9 , 2 , / ^ E t h s p e e d : ( [ \d \. ] + ) G H \/ s , s h a r e s : .* t i m e : / , 'PhoenixMiner (gh/s)' ] ,
67+ [ 1 , 1 , / \[ [ ^ \] ] + \] s p e e d 2 .5 s \/ 6 0 s \/ 1 5 m [ \d \. ] + ( [ \d \. ] + ) \s / , 'xmrig old' ] ,
68+ [ 1 , 1 , / \[ [ ^ \] ] + \] s p e e d 1 0 s \/ 6 0 s \/ 1 5 m [ \d \. n / a ] + ( [ \d \. ] + ) \s / , 'xmrig new' ] ,
69+ [ 1 , 1 , / \s + m i n e r \s + s p e e d 1 0 s \/ 6 0 s \/ 1 5 m [ \d \. n / a ] + ( [ \d \. ] + ) \s / , 'xmrig v6+' ] ,
70+ [ 1 , 1 , / T o t a l s \( A L L \) : \s + [ \d \. ] + \s + ( [ 1 - 9 ] \d * \. \d + | 0 \. [ 1 - 9 ] \d * ) \s / , 'xmr-stak' ] ,
71+ [ 1 , 1 , / T o t a l S p e e d : ( [ \d \. ] + ) H \/ s , / , 'claymore' ] ,
72+ [ 1 , 1 , / \( A v r ( [ \d \. ] + ) H \/ s \) / , 'CryptoDredge' ] ,
73+ [ 1 , 1 , / M i n i n g a t \s + ( [ \d \. ] + ) g p s / , 'tube4referenceMiner (use mode=rolling command line option)' ] ,
74+ [ 1 , 1 , / m i n i n g a t \s + ( [ \d \. ] + ) g p s / , 'SwapReferenceMiner (use mode=rolling command line option)' ] ,
75+ [ 1 , 2 , / T o t a l \s + : \s + ( [ \d \. ] + ) g p s / , 'MoneroVMiner' ] ,
5876] ;
77+ const hashrate_per_gpu = [ ]
5978
6079function algo_hashrate_factor ( algo ) {
6180 switch ( algo ) {
@@ -452,10 +471,10 @@ function start_miner_raw(exe, args, out_cb) {
452471 let proc = child_process . spawn ( exe , args , is_miner_stdin ? { stdio : [ 'inherit' , 'pipe' , 'pipe' ] } : { } ) ;
453472
454473 proc . stdout . on ( 'data' , ( data ) => {
455- if ( out_cb ) out_cb ( ` ${ data } ` ) ;
474+ if ( out_cb ) out_cb ( data . toString ( ) ) ;
456475 } ) ;
457476 proc . stderr . on ( 'data' , ( data ) => {
458- if ( out_cb ) out_cb ( ` ${ data } ` ) ;
477+ if ( out_cb ) out_cb ( data . toString ( ) ) ;
459478 } ) ;
460479 proc . on ( 'close' , ( code ) => {
461480 if ( is_verbose_mode ) {
@@ -841,15 +860,15 @@ function do_miner_perf_runs(cb) {
841860 jsonrpc : "2.0" ,
842861 method : "mining.set_difficulty" ,
843862 params : [
844- 1000000
863+ 10.24
845864 ] ,
846865 } ) + "\n" + JSON . stringify ( {
847866 jsonrpc : "2.0" ,
848867 method : "mining.notify" ,
849868 params : [
850869 "benchmark1" , // job_id
851- "e79f0f63030bf691445c2b9d0266b24a9619e355194067f2ad2c73a8e0a26c65 " , // seed hash
852- "feb4243b885cd1af5337979f5d81849335cab197b4993e5c61ea4b43b43dbbc6 " , // hash
870+ "ffaad0781cfec93fee66657ef8a9f132f422becba3626b5d936ad3cb1f8228d4 " , // seed hash
871+ "a917c993b27e4a15c6ed3611bcaa7e5eee5c9b984053f6c1270032c0c4d6dc83 " , // hash
853872 true ,
854873 ]
855874 } ) + "\n" ) ;
@@ -900,27 +919,71 @@ function do_miner_perf_runs(cb) {
900919 } ;
901920 let nr_prints_needed = - 1 ;
902921 let nr_prints_found = 0 ;
903- miner_proc = start_miner ( cmd , function ( str ) {
904- print_messages ( str ) ;
905- str = str . replace ( / \x1b \[ [ 0 - 9 ; ] * m / g, "" ) ; // remove all colors
906- for ( let i in hashrate_regexes ) {
907- const hashrate_regex = hashrate_regexes [ i ] ;
908- const m = str . match ( hashrate_regex [ 2 ] ) ;
909- if ( m ) {
910- if ( nr_prints_needed < 0 ) nr_prints_needed = hashrate_regex [ 1 ] ;
911- const hashrate = parseFloat ( m [ 1 ] ) * hashrate_regex [ 0 ] * algo_hashrate_factor ( algo ) ;
912- if ( ++ nr_prints_found >= nr_prints_needed ) {
913- const algo_deps = bench_algo_deps ( algo , hashrate ) ;
914- for ( let algo_dep in algo_deps ) {
915- log ( "Setting performance for " + algo_dep + " algo to " + algo_deps [ algo_dep ] ) ;
916- c . algo_perf [ algo_dep ] = algo_deps [ algo_dep ] ;
922+ let chunk_leftover = '' ;
923+ miner_proc = start_miner ( cmd , function ( chunk ) {
924+ chunk = [ chunk_leftover , chunk ] . join ( '' ) ;
925+ const buf_size = chunk . lastIndexOf ( '\n' ) ;
926+ chunk_leftover = chunk . slice ( chunk , buf_size ) ;
927+ const eol = `\x1b[0m\n` ;
928+ let gpu_max = - 1 ;
929+ let gpu_max_valid = false ;
930+ const variance = [ ] ;
931+ const hashrate_raw = [ ] ;
932+ const hashrate_prev = [ ] ;
933+ let line = 0 ;
934+ processing:
935+ for ( let str of chunk . split ( '\n' ) ) {
936+ print_messages ( str + eol ) ;
937+ str = str . replace ( / \x1b \[ [ 0 - 9 ; ] * m / g, "" ) ; // remove all colors
938+ for ( let i in hashrate_regexes ) {
939+ const hashrate_regex = hashrate_regexes [ i ] ;
940+ const m = str . match ( hashrate_regex [ 2 ] ) ;
941+ if ( m ) {
942+ if ( nr_prints_needed < 0 ) nr_prints_needed = hashrate_regex [ 1 ] ;
943+ let gpu = ( m . length === 3 ) ? m [ 1 ] : 0 ;
944+ if ( gpu_max > - 1 && gpu <= gpu_max ) gpu_max_valid = true ;
945+ if ( gpu > gpu_max ) gpu_max = gpu ;
946+ if ( m . length === 3 ) {
947+ m [ 1 ] = m [ 2 ] ;
948+ m . length = 2 ;
949+ }
950+ hashrate_raw [ gpu ] = parseFloat ( m [ 1 ] ) ;
951+ if ( ! gpu_max_valid ) {
952+ hashrate_prev [ gpu ] = hashrate_raw [ gpu ] ;
953+ } else if ( hashrate_raw [ gpu ] > 0 ) {
954+ if ( hashrate_prev . length < gpu ) hashrate_prev [ gpu ] = hashrate_raw [ gpu ] ;
955+ variance [ gpu ] = hashrate_prev [ gpu ] / hashrate_raw [ gpu ] ;
956+ let variance_good = true ;
957+ for ( const j in variance ) {
958+ if ( ! ( variance [ j ] > 0.98 && variance [ j ] < 1.02 ) ) {
959+ variance_good = false ;
960+ }
961+ }
962+ if ( gpu === gpu_max ) {
963+ let hashrate = 0 ;
964+ for ( const j in hashrate_raw ) {
965+ hashrate += hashrate_raw [ j ] * hashrate_regex [ 0 ] * algo_hashrate_factor ( algo ) ;
966+ }
967+ if ( variance_good && ++ nr_prints_found >= nr_prints_needed ) {
968+ const algo_deps = bench_algo_deps ( algo , hashrate ) ;
969+ for ( let algo_dep in algo_deps ) {
970+ log ( "Setting performance for " + algo_dep + " algo to " + algo_deps [ algo_dep ] ) ;
971+ c . algo_perf [ algo_dep ] = algo_deps [ algo_dep ] ;
972+ }
973+ miner_proc . on ( 'close' , ( code ) => { clearTimeout ( timeout ) ; resolve ( ) ; } ) ;
974+ tree_kill ( miner_proc . pid ) ;
975+ break processing;
976+ } else {
977+ let msg = "Read" ;
978+ if ( ! variance_good ) {
979+ msg = "Skip" ;
980+ }
981+ log ( msg + " performance for " + algo + " algo of " + hashrate + ", waiting for " +
982+ ( nr_prints_needed - nr_prints_found ) + " more print(s)." ) ;
983+ }
984+ }
985+ hashrate_prev [ gpu ] = hashrate_raw [ gpu ] ;
917986 }
918- miner_proc . on ( 'close' , ( code ) => { clearTimeout ( timeout ) ; resolve ( ) ; } ) ;
919- tree_kill ( miner_proc . pid ) ;
920- break ;
921- } else {
922- log ( "Read performance for " + algo + " algo to " + hashrate + ", waiting for " +
923- ( nr_prints_needed - nr_prints_found ) + " more print(s)." ) ;
924987 }
925988 }
926989 }
0 commit comments