Browse Source

Test

etomic
jl777 7 years ago
parent
commit
bac171ae60
  1. 1
      crypto777/OS_portable.h
  2. 15
      iguana/exchanges/LP_nativeDEX.c
  3. 1
      iguana/exchanges/LP_utxo.c

1
crypto777/OS_portable.h

@ -276,6 +276,7 @@ void *queue_delete(queue_t *queue,struct queueitem *copy,int32_t copysize,int32_
void *queue_free(queue_t *queue);
void *queue_clone(queue_t *clone,queue_t *queue,int32_t size);
int32_t queue_size(queue_t *queue);
char *mbstr(char *str,double n);
void iguana_memreset(struct OS_memspace *mem);
void iguana_mempurge(struct OS_memspace *mem);

15
iguana/exchanges/LP_nativeDEX.c

@ -1225,18 +1225,25 @@ void *LP_realloc(void *ptr,uint64_t len)
void LP_free(void *ptr)
{
static uint32_t lasttime,unknown;
uint32_t now; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp;
uint32_t now; char str[65]; int32_t n,lagging; uint64_t total = 0; struct LP_memory_list *mp,*tmp;
if ( (now= (uint32_t)time(NULL)) > lasttime+6 )
{
n = lagging = 0;
portable_mutex_lock(&LP_cJSONmutex);
DL_FOREACH_SAFE(LP_memory_list,mp,tmp)
{
if ( now > mp->timestamp+60 )
lagging++;
total += mp->len;
n++;
if ( now > mp->timestamp+60 )
{
lagging++;
DL_DELETE(LP_memory_list,mp);
free(mp->ptr);
free(mp);
}
}
printf("total %d allocated total %llu unknown.%u lagging.%d\n",n,(long long)total,unknown,lagging);
portable_mutex_unlock(&LP_cJSONmutex);
printf("total %d allocated total %llu %s unknown.%u lagging.%d\n",n,(long long)total,mbstr(str,total),unknown,lagging);
lasttime = (uint32_t)time(NULL);
}
DL_FOREACH_SAFE(LP_memory_list,mp,tmp)

1
iguana/exchanges/LP_utxo.c

@ -47,7 +47,6 @@ void cJSON_register(cJSON *item)
portable_mutex_unlock(&LP_cJSONmutex);
}
char *mbstr(char *str,double n);
void cJSON_unregister(cJSON *item)
{
static uint32_t lasttime;

Loading…
Cancel
Save