本文整理汇总了Python中score.Score.update_score方法的典型用法代码示例。如果您正苦于以下问题:Python Score.update_score方法的具体用法?Python Score.update_score怎么用?Python Score.update_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类score.Score
的用法示例。
在下文中一共展示了Score.update_score方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: score_me
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import update_score [as 别名]
def score_me(self, iowait_threshold=20):
old_score = Score.get_score()
iowait_pct = self.iowait/(self.uptime+0.0) * 100
idle_pct = self.idle/(self.uptime+0.0) * 100
busy_pct = (self.user+self.nice+self.system)/(self.uptime+0.0) * 100
if iowait_pct >= busy_pct:
Score.update_score(20)
elif busy_pct >= idle_pct:
Score.update_score(10)
if iowait_pct >= (iowait_threshold/100.0) * self.uptime:
Score.update_score(10)
self.score_deducted = old_score - Score.get_score()
示例2: score_me
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import update_score [as 别名]
def score_me(self, mem_threshold=70.0, swap_threshold=20.0):
old_score = Score.get_score()
mem_pct = self.MemUsed/(self.MemTotal+0.0) * 100
if 90 > mem_pct >= mem_threshold:
Score.update_score(10)
elif mem_pct >= 90:
Score.update_score(15)
else:
Score.update_score(5)
swap_pct = self.SwapUsed/(self.SwapTotal+0.0) * 100
if 50 > swap_pct >= swap_threshold:
Score.update_score(10)
elif swap_pct >= 50:
Score.update_score(15)
elif 0 < swap_pct <= 10:
Score.update_score(5)
self.score_deducted = old_score - Score.get_score()