benchmark.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:telegram-bot-framework 作者: alvarogzp 项目源码 文件源码
def _get_system_status(self):
        system_uptime_value = TimeFormatter.format(self.__get_elapsed_seconds_since(psutil.boot_time()))
        system_uptime = FormattedText()\
            .normal("Uptime: {system_uptime}").start_format().bold(system_uptime=system_uptime_value).end_format()

        cpu_usage_value = str(psutil.cpu_percent(interval=self.cpu_usage_sample_seconds)) + " %"
        cpu_usage = FormattedText()\
            .normal("CPU usage: {cpu_usage} ({sample_interval} sec. sample)").start_format()\
            .bold(cpu_usage=cpu_usage_value).normal(sample_interval=self.cpu_usage_sample_seconds).end_format()

        return FormattedText().newline().join((
            FormattedText().bold("System status"),
            system_uptime,
            cpu_usage
        ))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号