LCOV - code coverage report
Current view: top level - include/linux/sunrpc - timer.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 9 0.0 %
Date: 2014-04-07 Functions: 0 0 -
Branches: 0 10 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  *  linux/include/linux/sunrpc/timer.h
       3                 :            :  *
       4                 :            :  *  Declarations for the RPC transport timer.
       5                 :            :  *
       6                 :            :  *  Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
       7                 :            :  */
       8                 :            : 
       9                 :            : #ifndef _LINUX_SUNRPC_TIMER_H
      10                 :            : #define _LINUX_SUNRPC_TIMER_H
      11                 :            : 
      12                 :            : #include <linux/atomic.h>
      13                 :            : 
      14                 :            : struct rpc_rtt {
      15                 :            :         unsigned long timeo;    /* default timeout value */
      16                 :            :         unsigned long srtt[5];  /* smoothed round trip time << 3 */
      17                 :            :         unsigned long sdrtt[5]; /* smoothed medium deviation of RTT */
      18                 :            :         int ntimeouts[5];       /* Number of timeouts for the last request */
      19                 :            : };
      20                 :            : 
      21                 :            : 
      22                 :            : extern void rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo);
      23                 :            : extern void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m);
      24                 :            : extern unsigned long rpc_calc_rto(struct rpc_rtt *rt, unsigned timer);
      25                 :            : 
      26                 :            : static inline void rpc_set_timeo(struct rpc_rtt *rt, int timer, int ntimeo)
      27                 :            : {
      28                 :            :         int *t;
      29         [ #  # ]:          0 :         if (!timer)
      30                 :            :                 return;
      31                 :          0 :         t = &rt->ntimeouts[timer-1];
      32         [ #  # ]:          0 :         if (ntimeo < *t) {
      33         [ #  # ]:          0 :                 if (*t > 0)
      34                 :          0 :                         (*t)--;
      35                 :            :         } else {
      36         [ #  # ]:          0 :                 if (ntimeo > 8)
      37                 :            :                         ntimeo = 8;
      38                 :          0 :                 *t = ntimeo;
      39                 :            :         }
      40                 :            : }
      41                 :            : 
      42                 :            : static inline int rpc_ntimeo(struct rpc_rtt *rt, int timer)
      43                 :            : {
      44         [ #  # ]:          0 :         if (!timer)
      45                 :            :                 return 0;
      46                 :          0 :         return rt->ntimeouts[timer-1];
      47                 :            : }
      48                 :            : 
      49                 :            : #endif /* _LINUX_SUNRPC_TIMER_H */

Generated by: LCOV version 1.9