本文整理匯總了Python中psutil.disk_partitions方法的典型用法代碼示例。如果您正苦於以下問題:Python psutil.disk_partitions方法的具體用法?Python psutil.disk_partitions怎麽用?Python psutil.disk_partitions使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在模塊psutil的用法示例。
在下文中一共展示了psutil.disk_partitions方法的28個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1: __init__
點讚 6
# 需要導入模塊: import psutil [as 別名]
# 或者: from psutil import disk_partitions [as 別名]
def __init__(self):
self.timestamp = time.time()
self.cpu_load = []
self.mem = dict(total = 0,
available = 0,
free = 0,
cached = 0,
buffers = 0)
self.disk_partitions = {}
self.network = {}
partitions = psutil.disk_partitions()
for p in partitions:
if p.mountpoint in self.INCLUDED_PARTITIONS:
usage = psutil.disk_usage(p.mountpoint)
self.disk_partitions[p.mountpoint] = {
'total': usage.total,
'used': usage.used
}
開發者ID:ParadropLabs,項目名稱:Paradrop,代碼行數:21,
示例2: getStatus
點讚 6
# 需要導入模塊: import psutil [as 別名]
# 或者: from psutil import disk_partitions [as 別名]
def getStatus(self, max_age=0.8):
"""
Get current system status.
max_age: maximum tolerable age of cached status information. Set to
None to force a refresh regardless of cache age.
Returns a dictionary with fields 'cpu_load', 'mem', 'disk', and
'network'.
"""
timestamp = time.time()
if (max_age is None or timestamp > self.timestamp + max_age):
self.timestamp = timestamp
self.refreshCpuLoad()
self.refreshMemoryInfo()
self.refreshDiskInfo()
self.refreshNetworkTraffic()
result = {
'cpu_load': self.cpu_load,
'mem': self.mem,
'disk': self.disk_partitions,
'network': self.network
}
return result
開發者ID:ParadropLabs,項目名稱:Paradrop,代碼行數:27,
示例3: getSystemInfo
點讚 6
# 需要導入模塊: import psutil [as 別名]
# 或者: from psutil import disk_partitions [as 別名]
def getSystemInfo(cls):
system = {
'boot_time': psutil.boot_time(),
'cpu_count': psutil.cpu_count(),
'cpu_stats': psutil.cpu_stats().__dict__,
'cpu_times': [k.__dict__ for k in psutil.cpu_times(percpu=True)],
'disk_io_counters': psutil.disk_io_counters().__dict__,
'disk_usage': [],
'net_io_counters': psutil.net_io_counters().__dict__,
'swap_memory': psutil.swap_memory().__dict__,
'virtual_memory': psutil.virtual_memory().__dict__
}
partitions = psutil.disk_partitions()
for p in partitions:
if p.mountpoint in cls.INCLUDED_PARTITIONS:
usage = psutil.disk_usage(p.mountpoint)
system['disk_usage'].append({
'mountpoint': p.mountpoint,
'total': usage.total,
'used': usage.used
})
return system
開發者ID:ParadropLabs,項目名稱:Paradrop,代碼行數:26,
示例4: getMountPath
點讚 6
# 需要導入模塊: import psutil [as 別名]
# 或者: from psutil import disk_partitions [as 別名]
def getMountPath(device):
"""
Checks if the partition is mounted if not it return ""
:param device: Target device being string "OP1" or "OPZ"
:return: "" is not found
"""
mountpath = getmountpath(device)
# mountPoint = ""
for i, disk in enumerate(disk_partitions()):
print(disk)
if disk.device == mountpath:
mountPoint = disk.mountpoint
if device == "OP1":
config["OP_1_Mounted_Dir"] = mountPoint
print(config["OP_1_Mounted_Dir"])
elif device == "OPZ":
config["OP_Z_Mounted_Dir"] = mountPoint
print(config["OP_Z_Mounted_Dir"])
return mountPoint
return ""
開發者ID:adwuard,項目名稱:OP_Manager,代碼行數:22,
示例5: prepare
點讚 6
# 需要導入模塊: import psutil [as 別名]
# 或者: from psutil import disk_partitions [as 別名]
def prepare(cls, profile):
ret = super().prepare(profile)
if not ret["ok"]:
return ret
else:
ret["ok"] = False # Set back to false, so we can do our own checks here.
ret["active_mount_points"] = []
partitions = psutil.disk_partitions(all=True)
for p in partitions:
if p.device == "resticfs"