Mercurial > hg > dmlib
changeset 2274:a4c1fafd442a
Add a progress indicator when "slow" matching is expected.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 17 Jun 2019 12:54:33 +0300 |
parents | 6878aad714ce |
children | ba696835f66d 519c8726b235 |
files | tools/fanalyze.c |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/fanalyze.c Mon Jun 17 11:50:33 2019 +0300 +++ b/tools/fanalyze.c Mon Jun 17 12:54:33 2019 +0300 @@ -928,7 +928,9 @@ // // Attempt to find matching sequences of N+ // - dmPrint(0, "Attempting to find matching sequences of %" DM_PRIu_SIZE_T" bytes or more\n", + BOOL slow = FALSE; + int ss = 0; + dmPrint(0, "Attempting to find matching sequences of %" DM_PRIu_SIZE_T" bytes or more.\n", optMinMatchLen); if (totalSize > 32*1024) @@ -936,6 +938,7 @@ dmPrint(0, "WARNING! Total data size is large, and the matching \"algorithm\"\n" "used is horribly inefficient. This will be quite slow ...\n"); + slow = TRUE; } for (int nfile1 = 0; nfile1 < nsrcFiles; nfile1++) @@ -947,6 +950,13 @@ { DMSourceFile *file2 = &srcFiles[nfile2]; + if (slow) + { + dmPrint(0, + "Processing .. %1.1f%%\r", + (float) ss * 100.0f / (float) (nsrcFiles * (nsrcFiles - 1))); + ss++; + } // Find longest possible matching sequence in file2, if any for (size_t moffs1 = 0; moffs1 + optMinMatchLen < file1->size;) { @@ -980,6 +990,9 @@ done: + if (slow) + dmPrint(0, "\n\n"); + for (int nmatch = 0; nmatch < ndmSequences; nmatch++) { DMMatchSeq *seq = &dmSequences[nmatch];