Bug 361 - The time.elapsed variable is reset also with stats_noreset
The time.elapsed variable is reset also with stats_noreset
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
1.4.6
All All
: P5 minor
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-23 12:25 CET by SergioC
Modified: 2011-02-24 13:31 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SergioC 2011-02-23 12:25:19 CET
The time.elapsed variable must not be reset is other variables aren't.

Here a quick patch I'm applied to my production server:

Regards,
Sergioc.

*** orig/unbound-1.4.8/daemon/remote.c  2010-10-29 12:20:40.000000000 +0200
--- unbound-1.4.8/daemon/remote.c       2011-02-23 12:04:13.000000000 +0100
***************
*** 702,714 ****
  
  /** print uptime stats */
  static int
! print_uptime(SSL* ssl, struct worker* worker)
  {
        struct timeval now = *worker->env.now_tv;
        struct timeval up, dt;
        timeval_subtract(&up, &now, &worker->daemon->time_boot);
        timeval_subtract(&dt, &now, &worker->daemon->time_last_stat);
!       worker->daemon->time_last_stat = now;
        if(!ssl_printf(ssl, "time.now"SQ"%d.%6.6d\n", 
                (unsigned)now.tv_sec, (unsigned)now.tv_usec)) return 0;
        if(!ssl_printf(ssl, "time.up"SQ"%d.%6.6d\n", 
--- 702,715 ----
  
  /** print uptime stats */
  static int
! print_uptime(SSL* ssl, struct worker* worker, int reset)
  {
        struct timeval now = *worker->env.now_tv;
        struct timeval up, dt;
        timeval_subtract(&up, &now, &worker->daemon->time_boot);
        timeval_subtract(&dt, &now, &worker->daemon->time_last_stat);
!       if (reset)
!               worker->daemon->time_last_stat = now;
        if(!ssl_printf(ssl, "time.now"SQ"%d.%6.6d\n", 
                (unsigned)now.tv_sec, (unsigned)now.tv_usec)) return 0;
        if(!ssl_printf(ssl, "time.up"SQ"%d.%6.6d\n", 
***************
*** 892,898 ****
        total.mesh_time_median /= (double)daemon->num;
        if(!print_stats(ssl, "total", &total)) 
                return;
!       if(!print_uptime(ssl, rc->worker))
                return;
        if(daemon->cfg->stat_extended) {
                if(!print_mem(ssl, rc->worker, daemon)) 
--- 893,899 ----
        total.mesh_time_median /= (double)daemon->num;
        if(!print_stats(ssl, "total", &total)) 
                return;
!       if(!print_uptime(ssl, rc->worker, reset))
                return;
        if(daemon->cfg->stat_extended) {
                if(!print_mem(ssl, rc->worker, daemon))
Comment 1 Wouter Wijngaards 2011-02-24 13:31:07 CET
Hi Sergio,

Thank you for the patch, applied to svn trunk of unbound.

Best regards, Wouter