Somewhere between ifhp 3.3.13 and 3.3.18, progress reporting using
progress_k stopped working....  now it appears that the threshhold for
reporting is progress_k *squared* kbytes.  In the reporting test,
i is set to the amount of stuff printed as a multiple of progress_k
kbytes; but then the next-time-to-report is incremented by progress_k
times that.  With progress_k = 40:

transferring 7377185 bytes at 20:30:35.222
40 Kbytes done at 20:30:39.589
1680 Kbytes done at 20:31:26.782
3320 Kbytes done at 20:31:53.883
4960 Kbytes done at 20:33:07.548
6600 Kbytes done at 20:33:42.910

Also, I'd like to use both progress_pc and progress_k so that reporting
is done if either threshhold is exceeded.  Right now progress_k is
ignored if progress_pc is set.  If it's of any interest, a patch is
enclosed that allows both.  One side effect is that if both progress_pc
and progress_k are defined, progress is always reported as a percentage
even if it's due to the progress_k threshold being exceeded.  (From 
experience, this is better than switching between display formats based
on the file size.)

Patch also fixes the first problem.

*** src/ifhp.c.orig     Fri Jul 14 20:39:00 2000
--- src/ifhp.c  Fri Jul 14 20:50:52 2000
***************
*** 2819,2826 ****
        char *language;
        char *file_util;
        struct stat statb;
!       int progress_last, progress_pc, progress_k;
!       double total_size, progress_total;
        char file_result[SMALLBUFFER];
  
        Init_line_list( &l );
--- 2819,2826 ----
        char *language;
        char *file_util;
        struct stat statb;
!       int progress_pc, progress_k;
!       double total_size, progress_last, progress_total;
        char file_result[SMALLBUFFER];
  
        Init_line_list( &l );
***************
*** 3109,3116 ****
                LOGERR_DIE("Send_job: lseek failed");
        }
  
!       progress_total = 0;
!       progress_last =  progress_pc = progress_k = 0;
        if( (s = Find_str_value(&Model,"progress_pc",Value_sep)) ){
                progress_pc = atoi(s);
        }
--- 3109,3116 ----
                LOGERR_DIE("Send_job: lseek failed");
        }
  
!       progress_last = progress_total = 0;
!       progress_pc = progress_k = 0;
        if( (s = Find_str_value(&Model,"progress_pc",Value_sep)) ){
                progress_pc = atoi(s);
        }
***************
*** 3247,3265 ****
                /*
                 * now we do progress report
                 */
!               if( progress_pc ){
!                       i = ((double)(progress_total)/total_size)*100;
!                       DEBUG1("Send_job: pc total %0.0f, new %d", progress_total, i );
!                       if( i > progress_last ){
!                               LOGMSG("Send_job: %d percent done", i);
!                               progress_last = i + progress_pc;
!                       }
                } else if( progress_k ){
!                       i = ((double)(progress_total)/(1024 * (double)progress_k));
!                       DEBUG1("Send_job: k total %0.0f, new %d", progress_total, i );
!                       if( i > progress_last ){
!                               LOGMSG("Send_job: %d Kbytes done", 
(int)(progress_total/1024));
!                               progress_last = i + progress_k;
                        }
                }
                if( Outlen == 0 && !done ){
--- 3247,3268 ----
                /*
                 * now we do progress report
                 */
!               i = (progress_total - progress_last)/total_size*100;
!               if( progress_pc && (i >= progress_pc) ){
!                       DEBUG1("Send_job: pc total %0.0f, change %d%%", 
progress_total, i );
!                       i = progress_total/total_size*100;
!                       LOGMSG("Send_job: %d percent done", i);
!                       progress_last = progress_total;
                } else if( progress_k ){
!                       i = (progress_total - progress_last)/1024;
!                       DEBUG1("Send_job: k total %0.0f, change %d", progress_total, i 
);
!                       if( i >= progress_k ){
!                               if( progress_pc ){
!                                       i = progress_total/total_size*100;
!                                       LOGMSG("Send_job: %d percent done", i);
!                               } else
!                                       LOGMSG("Send_job: %d Kbytes done", 
(int)(progress_total/1024));
!                               progress_last = progress_total;
                        }
                }
                if( Outlen == 0 && !done ){




-----------------------------------------------------------------------------
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to