| author: | Giampaolo Rodola of psutil |
|---|---|
| descrition: | The class [Process] is back ported from python open-source project [psutil]. Guannan finished porting in early 2014. Here is the original license applied. |
| copyright: | Psutil. Copyright (c) 2009, Giampaolo Rodola’. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. |
Bases: cup.res.linux.CPUInfo
CPUInfo是在调用get_cpu_usage返回的python namedtuple. 返回值中的如下属性可以直接访问: usr, nice, system, idle, iowait, irq, softirq, steal, guest
I.g.
import cup
# 计算60内cpu的使用情况。
cpuinfo = cup.res.linux.get_cpu_usage(intvl_in_sec=60)
print cpuinfo.usr
Bases: cup.res.linux.vmem
E.g.:
import cup
meminfo = cup.res.linux.get_meminfo()
print meminfo.total
print meminfo.available
Bases: object
Linux中进程的抽象类, 可以进行进程的信息获取。
alias of mmap
alias of mmap
Bases: cup.res.linux.SwapInfo
get_swapinfo函数回返的数据结构信息。 total,free,used,sin,sout是她的属性
获得网卡在intvl_in_sec时间内的网络发包速度
E.g.
import cup
print cup.res.linux.get_net_transmit_speed('eth1', 5)
回返系统中每一个(包括回环lo)网络使用统计信息。 其中每个网卡list的信息包含 (bytes_sent, bytes_recv, packets_sent, packets_recv,
errin, errout, dropin, dropout)
回返信息示例
{
'lo':
(
235805206817, 235805206817, 315060887, 315060887, 0, 0, 0, 0
),
'eth1':
(
18508976300272, 8079464483699, 32776530804,
32719666038, 0, 0, 708015, 0
),
'eth0':
(
0, 0, 0, 0, 0, 0, 0, 0
)
}
| author: | Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
| descrition: | resource related module |