妫€鏌ョ郴缁熺鐩樺拰鍐呭瓨浣跨敤鎯呭喌
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了妫€鏌ョ郴缁熺鐩樺拰鍐呭瓨浣跨敤鎯呭喌相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/col' title='col'>col
python eve memory fmb pre *** inf pytho#!/usr/bin/python2.7 # -*- coding: utf-8 -*- # @Time: 2019骞?鏈?4鏃?/span> # @Author: trent # 瀹夎浠ヤ笅渚濊禆宸ュ叿 # python 2.7.5 # python-devel # psutil-2.1.3 import psutil def memissue(): print(鈥?/span>memory info: 鈥?/span>) mem = psutil.virtual_memory() # 鍗曚綅鎹㈢畻涓篗B memtotal = float(mem.total/1024/1024) memused = float(mem.used/1024/1024) membaifen = memused/memtotal*100 print(鈥?/span>%.2fMB鈥?/span> % memused) print(鈥?/span>%.2fMB鈥?/span> % memtotal) print(鈥?/span>memory usage percent: %.2f鈥?/span> % membaifen + 鈥?/span>%鈥?/span>) def disklist(): print(鈥?/span>disk info: 鈥?/span>) disk = psutil.disk_partitions() diskuse = psutil.disk_usage(鈥?/span>/鈥?/span>) #鍗曚綅鎹㈢畻涓篏B diskused = float(diskuse.used / 1024 / 1024 / 1024) disktotal = float(diskuse.total / 1024 / 1024 / 1024) diskbaifen = diskused / disktotal * 100 print(鈥?/span>%.2fGB鈥?/span> % diskused) print(鈥?/span>%.2fGB鈥?/span> % disktotal) print(鈥?/span>disk usage percent: %.2f鈥?/span> % diskbaifen + 鈥?/span>%鈥?/span>) memissue() print(鈥?/span>*******************鈥?/span>) disklist()
以上是关于妫€鏌ョ郴缁熺鐩樺拰鍐呭瓨浣跨敤鎯呭喌的主要内容,如果未能解决你的问题,请参考以下文章
Android浣跨敤娉ㄨВ浠f浛鏋氫妇浠庤€岃妭鐪佺郴缁熶娇鐢ㄧ殑鍐呭瓨寮€閿€