Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
11e3ff56f4
  1. 2
      iguana/iguana777.c
  2. 5
      iguana/iguana777.h
  3. 22
      iguana/iguana_bundles.c

2
iguana/iguana777.c

@ -399,7 +399,7 @@ void iguana_helper(void *arg)
} }
myfree(ptr,ptr->allocsize); myfree(ptr,ptr->allocsize);
} }
else if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 ) if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
{ {
idle = 0; idle = 0;
if ( (bp= ptr->bp) != 0 && ptr->coin != 0 ) if ( (bp= ptr->bp) != 0 && ptr->coin != 0 )

5
iguana/iguana777.h

@ -395,7 +395,8 @@ struct iguana_peer
struct OS_memspace RAWMEM,TXDATA,HASHMEM; struct OS_memspace RAWMEM,TXDATA,HASHMEM;
struct iguana_ramchain ramchain; struct iguana_ramchain ramchain;
struct iguana_fileitem *filehash2; int32_t numfilehash2,maxfilehash2; struct iguana_fileitem *filehash2; int32_t numfilehash2,maxfilehash2;
struct iguana_bundle *bp; FILE *voutsfp,*vinsfp; //struct iguana_bundle *bp;
FILE *voutsfp,*vinsfp;
#ifdef IGUANA_PEERALLOC #ifdef IGUANA_PEERALLOC
struct OS_memspace *SEROUT[128]; struct OS_memspace *SEROUT[128];
#endif #endif
@ -419,7 +420,7 @@ struct iguana_bundle
struct queueitem DL; struct iguana_info *coin; struct iguana_bundle *nextbp; struct queueitem DL; struct iguana_info *coin; struct iguana_bundle *nextbp;
struct iguana_bloom16 bloom; uint32_t rawscriptspace; struct iguana_bloom16 bloom; uint32_t rawscriptspace;
uint32_t issuetime,hdrtime,emitfinish,mergefinish,purgetime,queued,startutxo,utxofinish,balancefinish,validated,lastspeculative,dirty,nexttime,currenttime; uint32_t issuetime,hdrtime,emitfinish,mergefinish,purgetime,queued,startutxo,utxofinish,balancefinish,validated,lastspeculative,dirty,nexttime,currenttime;
int32_t numhashes,numrecv,numsaved,numcached,rank,generrs,checkedtmp,currentflag; int32_t numhashes,numrecv,numsaved,numcached,generrs,checkedtmp,currentflag;
int32_t minrequests,n,hdrsi,bundleheight,numtxids,numspends,numunspents,numspec; int32_t minrequests,n,hdrsi,bundleheight,numtxids,numspends,numunspents,numspec;
double avetime,threshold,metric; uint64_t datasize,estsize; double avetime,threshold,metric; uint64_t datasize,estsize;
struct iguana_block *blocks[IGUANA_MAXBUNDLESIZE]; uint32_t issued[IGUANA_MAXBUNDLESIZE]; struct iguana_block *blocks[IGUANA_MAXBUNDLESIZE]; uint32_t issued[IGUANA_MAXBUNDLESIZE];

22
iguana/iguana_bundles.c

@ -746,7 +746,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru
lasti = lastbp == 0 ? coin->bundlescount-1 : lastbp->hdrsi; lasti = lastbp == 0 ? coin->bundlescount-1 : lastbp->hdrsi;
coin->numbundlesQ--; coin->numbundlesQ--;
iguana_bundlecalcs(coin,bp); iguana_bundlecalcs(coin,bp);
printf("ITER.%-4d now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",bp->rank,(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount); printf("ITER now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount);
bp->nexttime = (uint32_t)(time(NULL) + 3);//(bp->hdrsi - starti) + 1); bp->nexttime = (uint32_t)(time(NULL) + 3);//(bp->hdrsi - starti) + 1);
if ( bp->numhashes < bp->n && bp->bundleheight < coin->longestchain-coin->chain->bundlesize ) if ( bp->numhashes < bp->n && bp->bundleheight < coin->longestchain-coin->chain->bundlesize )
iguana_bundlehdr(coin,bp,starti); iguana_bundlehdr(coin,bp,starti);
@ -795,13 +795,13 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru
max = bp->n; max = bp->n;
counter = iguana_bundleissue(coin,bp,max,timelimit); counter = iguana_bundleissue(coin,bp,max,timelimit);
if ( 0 && counter > 0 ) if ( 0 && counter > 0 )
printf("ITER.%-4d now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",bp->rank,(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount); printf("ITER now.%u spec.%-4d bundle.%-4d h.%-4d r.%-4d s.%-4d F.%d T.%d issued.%d mb.%d/%d\n",(uint32_t)time(NULL),bp->numspec,bp->bundleheight/coin->chain->bundlesize,bp->numhashes,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit,counter,coin->MAXBUNDLES,coin->bundlescount);
} }
iguana_bundleQ(coin,bp,1000); iguana_bundleQ(coin,bp,1000);
return(retval); return(retval);
} }
static int _decreasing_double(const void *a,const void *b) /*static int _decreasing_double(const void *a,const void *b)
{ {
#define double_a (*(double *)a) #define double_a (*(double *)a)
#define double_b (*(double *)b) #define double_b (*(double *)b)
@ -818,18 +818,18 @@ static int32_t revsortds(double *buf,uint32_t num,int32_t size)
{ {
qsort(buf,num,size,_decreasing_double); qsort(buf,num,size,_decreasing_double);
return(0); return(0);
} }*/
void iguana_bundlestats(struct iguana_info *coin,char *str) void iguana_bundlestats(struct iguana_info *coin,char *str)
{ {
static uint32_t lastdisp; static uint32_t lastdisp;
int32_t i,n,m,j,numv,count,pending,dispflag,numutxo,numbalances,numrecv,done,numhashes,numcached,numsaved,numemit; int32_t i,n,m,j,numv,count,pending,dispflag,numutxo,numbalances,numrecv,done,numhashes,numcached,numsaved,numemit;
int64_t spaceused=0,estsize = 0; struct iguana_bundle *bp,*lastpending = 0,*firstgap = 0; double *sortbuf; struct iguana_peer *addr; struct iguana_block *block,*prev; uint32_t now; int64_t spaceused=0,estsize = 0; struct iguana_bundle *bp,*lastpending = 0,*firstgap = 0; struct iguana_block *block,*prev; uint32_t now;
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
dispflag = (rand() % 1000) == 0; dispflag = (rand() % 1000) == 0;
numrecv = numhashes = numcached = numsaved = numemit = done = numutxo = numbalances = 0; numrecv = numhashes = numcached = numsaved = numemit = done = numutxo = numbalances = 0;
count = coin->bundlescount; count = coin->bundlescount;
sortbuf = calloc(count,sizeof(*sortbuf)*2); //sortbuf = calloc(count,sizeof(*sortbuf)*2);
for (i=n=m=numv=pending=0; i<count; i++) for (i=n=m=numv=pending=0; i<count; i++)
{ {
if ( (bp= coin->bundles[i]) != 0 ) if ( (bp= coin->bundles[i]) != 0 )
@ -875,7 +875,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
} // else break; } // else break;
} }
} }
bp->rank = 0; //bp->rank = 0;
estsize += bp->estsize;//iguana_bundlecalcs(coin,bp,done); estsize += bp->estsize;//iguana_bundlecalcs(coin,bp,done);
//bp->metric = bp->numhashes; //bp->metric = bp->numhashes;
bp->metric = coin->bundlescount - bp->hdrsi; bp->metric = coin->bundlescount - bp->hdrsi;
@ -909,14 +909,14 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
if ( bp->emitfinish == 0 ) if ( bp->emitfinish == 0 )
{ {
spaceused += bp->estsize; spaceused += bp->estsize;
sortbuf[m*2] = bp->metric; //sortbuf[m*2] = bp->metric;
sortbuf[m*2 + 1] = i; //sortbuf[m*2 + 1] = i;
m++; m++;
} }
} }
} }
} }
if ( m > 0 ) /*if ( m > 0 )
{ {
revsortds(sortbuf,m,sizeof(*sortbuf)*2); revsortds(sortbuf,m,sizeof(*sortbuf)*2);
for (i=0; i<m; i++) for (i=0; i<m; i++)
@ -929,7 +929,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
} }
} }
} }
free(sortbuf); free(sortbuf);*/
coin->numremain = n; coin->numremain = n;
coin->blocksrecv = numrecv; coin->blocksrecv = numrecv;
char str2[65]; uint64_t tmp; int32_t diff,p = 0; struct tai difft,t = tai_now(); char str2[65]; uint64_t tmp; int32_t diff,p = 0; struct tai difft,t = tai_now();

Loading…
Cancel
Save