python psutil模块_Python2.7 psutil模块

psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, memory, disks, network, users) in a portable way by using Python

实验环境:ubuntu12.10

psutil版本:0.6.1

包含类:

class AccessDenied(Error)

class Error(exceptions.Exception)

class NoSuchProcess(Error)

class Popen(Process)

class Process(__builtin__.object)

class TimeoutExpired(Error)

方法:

cpu_percent(interval=0.1, percpu=False)

返回一个浮点数,表示整个系统CPU的利用率,百分比。

When interval is > 0.0 compares system CPU times elapsed before

and after the interval (blocking).

When interval is 0.0 or None compares system CPU times elapsed

since last call or module import, returning immediately.

In this case is recommended for accuracy that this function be

called with at least 0.1 seconds between calls.

如果percpu为True,则返回每个cpu的利用率,百分比。

cpu_times(percpu=False)

返回系统cpu的运行时间,每个cpu的时间代表在给定的模式下每个cpu运行的时间

disk_io_counters(perdisk=False)

返回系统磁盘的I/O统计数据,如果为True,则返回每一个物理磁盘的统计数据。

get_pid_list()

返回一个PID的列表

get_process_list(*args, **kwargs)

返回一个所有运行的进程类的列表

network_io_counters(pernic=False)

返回network的统计信息

pid_exists(pid)

检测一个pid是否存在

process_iter()

Return a generator yielding a Process class instance for all

running processes on the local machine.

Every new Process instance is only created once and then cached

into an internal table which is updated every time this is used.

The sorting order in which processes are yielded is based on

their PIDs.

swap_memory()

返回系统的swap统计信息

test()

效果如同ps aux

virtual_memory()

返回系统关于内存使用的统计信息

项目地址:https://code.google.com/p/psutil/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值