コード例 #1
0
    def __init__(self, iocg):
        ioc = iocg.ioc
        blkg = iocg.pd.blkg

        self.is_active = not list_empty(iocg.active_list.address_of_())
        self.weight = iocg.weight.value_() / WEIGHT_ONE
        self.active = iocg.active.value_() / WEIGHT_ONE
        self.inuse = iocg.inuse.value_() / WEIGHT_ONE
        self.hwa_pct = iocg.hweight_active.value_() * 100 / WEIGHT_ONE
        self.hwi_pct = iocg.hweight_inuse.value_() * 100 / WEIGHT_ONE
        self.address = iocg.value_()

        vdone = iocg.done_vtime.counter.value_()
        vtime = iocg.vtime.counter.value_()
        vrate = ioc.vtime_rate.counter.value_()
        period_vtime = ioc.period_us.value_() * vrate
        if period_vtime:
            self.inflight_pct = (vtime - vdone) * 100 / period_vtime
        else:
            self.inflight_pct = 0

        self.usage = (100 * iocg.usage_delta_us.value_() /
                      ioc.period_us.value_()) if self.active else 0
        self.debt_ms = iocg.abs_vdebt.value_() / VTIME_PER_USEC / 1000
        if blkg.use_delay.counter.value_() != 0:
            self.delay_ms = blkg.delay_nsec.counter.value_() / 1_000_000
        else:
            self.delay_ms = 0
コード例 #2
0
    def __init__(self, iocg):
        ioc = iocg.ioc
        blkg = iocg.pd.blkg

        self.is_active = not list_empty(iocg.active_list.address_of_())
        self.weight = iocg.weight.value_()
        self.active = iocg.active.value_()
        self.inuse = iocg.inuse.value_()
        self.hwa_pct = iocg.hweight_active.value_() * 100 / HWEIGHT_WHOLE
        self.hwi_pct = iocg.hweight_inuse.value_() * 100 / HWEIGHT_WHOLE
        self.address = iocg.value_()

        vdone = iocg.done_vtime.counter.value_()
        vtime = iocg.vtime.counter.value_()
        vrate = ioc.vtime_rate.counter.value_()
        period_vtime = ioc.period_us.value_() * vrate
        if period_vtime:
            self.inflight_pct = (vtime - vdone) * 100 / period_vtime
        else:
            self.inflight_pct = 0

        self.debt_ms = iocg.abs_vdebt.counter.value_() / VTIME_PER_USEC / 1000
        self.use_delay = blkg.use_delay.counter.value_()
        self.delay_ms = blkg.delay_nsec.counter.value_() / 1_000_000

        usage_idx = iocg.usage_idx.value_()
        self.usages = []
        self.usage = 0
        for i in range(NR_USAGE_SLOTS):
            usage = iocg.usages[(usage_idx + i) % NR_USAGE_SLOTS].value_()
            upct = usage * 100 / HWEIGHT_WHOLE
            self.usages.append(upct)
            self.usage = max(self.usage, upct)
コード例 #3
0
ファイル: test_list.py プロジェクト: osandov/drgn
 def test_list_empty(self):
     self.assertTrue(list_empty(self.empty))
     self.assertFalse(list_empty(self.full))
     self.assertFalse(list_empty(self.singular))