From 39c99e94d0b45c5488e3850610184c8b7ebdb683 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 23 Mar 2016 14:41:35 -0300 Subject: [PATCH] test --- iguana/iguana_ramchain.c | 44 ++++++++++++++++++++++++++++++++++++++-- iguana/iguana_unspents.c | 26 +++--------------------- iguana/main.c | 4 +++- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 3ec936f50..89b12fa5a 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -805,6 +805,46 @@ void *iguana_ramchain_offset(void *dest,uint8_t *lhash,FILE *fp,uint64_t fpos,vo return((void *)(long)((long)destptr + fpos)); } +void iguana_ramchain_prefetch(struct iguana_info *coin,struct iguana_ramchain *ramchain) +{ + struct iguana_pkhash *P,p; struct iguana_unspent *U,u; struct iguana_txid *T,txid; uint32_t i,numpkinds,numtxids,numunspents,tlen,plen,nonz=0; uint8_t *PKbits,*TXbits,*ptr; + if ( ramchain->H.data != 0 ) + { + ptr = ramchain->fileptr; + for (i=0; ifilesize; i++) + if ( ptr[i] != 0 ) + nonz++; + printf("nonz.%d of %d\n",nonz,(int32_t)ramchain->filesize); + return; + U = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Uoffset); + T = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Toffset); + P = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Poffset); + TXbits = (void *)(long)((long)ramchain->H.data + ramchain->H.data->TXoffset); + PKbits = (void *)(long)((long)ramchain->H.data + ramchain->H.data->PKoffset); + numpkinds = ramchain->H.data->numpkinds; + numunspents = ramchain->H.data->numunspents; + numtxids = ramchain->H.data->numtxids; + tlen = ramchain->H.data->numtxsparse * ramchain->H.data->txsparsebits; + plen = ramchain->H.data->numpksparse * ramchain->H.data->pksparsebits; + if ( 0 ) + { + for (i=1; iH.ROflag = 1; ramchain->expanded = expanded; ramchain->numblocks = (bp == 0) ? 1 : bp->n; - printf("ptr.%p %p mapped P[%d] fpos.%d + %ld -> %ld vs %ld offset.%u:%u stack.%u:%u\n",ptr,ramchain->H.data,(int32_t)ramchain->H.data->Poffset,(int32_t)fpos,(long)ramchain->H.data->allocsize,(long)(fpos + ramchain->H.data->allocsize),ramchain->filesize,ramchain->H.scriptoffset,ramchain->H.data->scriptspace,ramchain->H.stacksize,ramchain->H.data->stackspace); + printf("ptr.%p exp.%d extra.%d %p mapped P[%d] fpos.%d + %ld -> %ld vs %ld offset.%u:%u stack.%u:%u\n",ptr,expanded,allocextras,ramchain->H.data,(int32_t)ramchain->H.data->Poffset,(int32_t)fpos,(long)ramchain->H.data->allocsize,(long)(fpos + ramchain->H.data->allocsize),ramchain->filesize,ramchain->H.scriptoffset,ramchain->H.data->scriptspace,ramchain->H.stacksize,ramchain->H.data->stackspace); if ( 0 && bp != 0 ) { /*blocksRO = (struct iguana_blockRO *)ramchain->H.data; @@ -1504,7 +1544,7 @@ struct iguana_ramchain *iguana_ramchain_map(struct iguana_info *coin,char *fname { bp->balancefinish = (uint32_t)time(NULL); printf("found balances for %d\n",bp->hdrsi); - } + } else printf("error with extras\n"); } } if ( B != 0 && bp != 0 ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index e475d7c1d..9b0ab8cfb 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -224,26 +224,6 @@ int32_t iguana_pkhasharray(struct iguana_info *coin,cJSON *array,int32_t minconf return(n); } -void iguana_ramchain_prefetch(struct iguana_info *coin,struct iguana_ramchain *ramchain) -{ - struct iguana_pkhash *P,p; struct iguana_unspent *U,u; struct iguana_txid *T,txid; uint32_t i,numpkinds,numtxids,numunspents; - if ( ramchain->H.data != 0 ) - { - U = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Uoffset); - T = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Toffset); - P = (void *)(long)((long)ramchain->H.data + ramchain->H.data->Poffset); - numpkinds = ramchain->H.data->numpkinds; - numunspents = ramchain->H.data->numunspents; - numtxids = ramchain->H.data->numtxids; - for (i=1; i 0 && unspentind < spentbp->ramchain.H.data->numunspents ) { - if ( spentbp->dirty++ == 100 ) + if ( spentbp->dirty++ == 3 ) { printf("prefetch.[%d]\n",spentbp->hdrsi); iguana_ramchain_prefetch(coin,&spentbp->ramchain); @@ -479,12 +459,12 @@ int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp,int3 { if ( spentbp->ramchain.Uextras == 0 ) { - //printf("alloc Uextras.[%d]\n",spentbp->hdrsi); + printf("unspent alloc Uextras.[%d]\n",spentbp->hdrsi); spentbp->ramchain.Uextras = calloc(sizeof(*spentbp->ramchain.Uextras),spentbp->ramchain.H.data->numunspents + 16); } if ( spentbp->ramchain.A == 0 ) { - //printf("alloc A2.[%d]\n",spentbp->hdrsi); + printf("unspent alloc A2.[%d]\n",spentbp->hdrsi); spentbp->ramchain.A = calloc(sizeof(*spentbp->ramchain.A),spentbp->ramchain.H.data->numpkinds + 16); } } diff --git a/iguana/main.c b/iguana/main.c index 348d4d1a5..cbe73a9df 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -329,7 +329,9 @@ void sigcontinue_func() { printf("\nSIGCONT\n"); signal(SIGCONT,sigcontinue_func // mksquashfs DB/BTC BTC.xz1m -b 1048576 -comp xz -Xdict-size 1024K -> takes a long time -> /* mksquashfs DB/BTC BTC.xz -comp xz -mksquashfs DB/BTC BTC.xz1m -b 1048576 -comp xz -Xdict-size 1024K + mksquashfs DB/BTC BTC.xzs -b 16384 -comp xz -Xdict-size 8K + mksquashfs DB/BTC BTC.xz1m -b 1048576 -comp xz -Xdict-size 1024K + mksquashfs DB/BTC BTC.xz8k -comp xz -Xdict-size 8K mksquashfs DB/BTC BTC.lzo -comp lzo mksquashfs DB/BTC BTC.lzo1m -comp lzo -b 1048576 mksquashfs DB/BTC BTC.squash