diff --git a/tools/hitag2crack/crack5opencl/queue.c b/tools/hitag2crack/crack5opencl/queue.c index bce67520f..18661209d 100644 --- a/tools/hitag2crack/crack5opencl/queue.c +++ b/tools/hitag2crack/crack5opencl/queue.c @@ -371,8 +371,6 @@ int wu_queue_destroy(wu_queue_ctx_t *ctx) { if (!ctx) return ERROR_CTX_NULL; if (!ctx->init) return ERROR_CTX_IS_NOT_INIT; - pthread_mutex_lock(&ctx->queue_mutex); - int ret = -1; // unload the queue @@ -398,8 +396,6 @@ int wu_queue_destroy(wu_queue_ctx_t *ctx) { ctx->queue_tail = 0; //NULL; ctx->init = 0; - pthread_mutex_unlock(&ctx->queue_mutex); - pthread_mutex_destroy(&ctx->queue_mutex); pthread_mutexattr_destroy(&ctx->queue_mutex_attr); diff --git a/tools/hitag2crack/crack5opencl/threads.c b/tools/hitag2crack/crack5opencl/threads.c index 0f402a665..16785fa16 100644 --- a/tools/hitag2crack/crack5opencl/threads.c +++ b/tools/hitag2crack/crack5opencl/threads.c @@ -504,15 +504,15 @@ void *computing_process(void *arg) { off = wu.off; a->slice = wu.id + 1; - float progress = (((wu.id + 1) * 100.0) / wu.max); if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) { - + float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max); #if DEBUGME > 0 printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); #else printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); #endif // DEBUGME } else { + float progress = (((wu.id + 1) * 100.0) / wu.max); #if DEBUGME > 0 printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off); #else @@ -659,14 +659,15 @@ void *computing_process_async(void *arg) { uint32_t off = wu.off; a->slice = wu.id + 1; - float progress = (((wu.id + 1) * 100.0) / wu.max); if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) { + float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max); #if DEBUGME > 0 printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); #else - printf("[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); + printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); #endif // DEBUGME } else { + float progress = (((wu.id + 1) * 100.0) / wu.max); #if DEBUGME > 0 printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off); #else