def tick()

in senpai.py [0:0]


    def tick(self):
        total = self.cgroup.total()
        delta = total - self.last_total
        self.last_total = total
        self.integral += delta
        log('limit=%s pressure=%f time_to_probe=%2d total=%d delta=%d integral=%d' %
            (h(self.cgroup.read_limit()), self.cgroup.pressure(),
             self.grace_ticks, total, delta, self.integral))
        if self.integral > self.conf.pressure:
            # Back off exponentially as we deviate from the target
            # pressure. The backoff coefficient defines how sensitive
            # we are to fluctuations around the target pressure: when
            # the coefficient is 10, the curve reaches the adjustment
            # limit when pressure is ten times the target pressure.
            err = self.integral / self.conf.pressure
            adj = (err / self.conf.coeff_backoff) ** 2
            adj = min(adj * self.conf.max_backoff, self.conf.max_backoff)
            self.adjust(adj)
            self.grace_ticks = self.conf.interval - 1
            return
        if self.grace_ticks:
            self.grace_ticks -= 1
            return
        # Tighten the limit. Like when backing off, the adjustment
        # becomes exponentially more aggressive as observed pressure
        # falls below the target pressure and reaches the adjustment
        # limit when pressure is 1/COEFF_PROBE of target pressure.
        err = self.conf.pressure / max(self.integral, 1)
        adj = (err / self.conf.coeff_probe) ** 2
        adj = min(adj * self.conf.max_probe, self.conf.max_probe)
        self.adjust(-adj)
        self.grace_ticks = self.conf.interval - 1