python的pstuil模块总结
import psutil print(dir(psutil)) # 查看逻辑cpu的个数
print(psutil.cpu_count()) # 查看物理cpu的个数
print(psutil.cpu_count(logical=False)) # 查看cpu的用户时间,系统时间,空闲时间,中断时间
print(psutil.cpu_times()) # 统计每个cpu的使用率
print(psutil.cpu_percent(interval=2,percpu=True)) # 统计真个cpu的使用率
print(psutil.cpu_percent(interval=2,percpu=False)) # 统计内存的使用情况
print(psutil.virtual_memory()) # 统计某个磁盘的使用情况
print(psutil.disk_usage(path="d:")) # 统计磁盘的io情况
print(psutil.disk_io_counters()) # 统计系统的根目录的信息,包括device,挂载点,文件系统类型
print(psutil.disk_partitions()) # 网卡的io情况
print(psutil.net_io_counters()) # 网卡信息
print(psutil.net_if_addrs()) # 网卡状态
print(psutil.net_if_stats()) # 网卡的连接情况
print(psutil.net_connections()) # 系统中所有的进程
print(psutil.pids()) # 判断某个进程是否存在
print(psutil.pid_exists(0)) # 获取某个进程的对象
p = psutil.Process(436) # 打印该进程的名字
print(p.name()) # 打印该进程一些信息,比如进程名字,id,启动时间
print(p.cpu_times) # 打印这个进程的占用cpu的使用时间
print(p.cpu_times()) # 打印这个进程的内存使用情况
print(p.memory_info()) # 打印这个进程启动的线程的数量
print(p.num_threads()) # 打印这个进程开启的线程的信息
print(p.threads())
python的pstuil模块总结的更多相关文章
- python的库有多少个?python有多少个模块?
这里列举了大概500个左右的库: ! Chardet字符编码探测器,可以自动检测文本.网页.xml的编码. colorama主要用来给文本添加各种颜色,并且非常简单易用. Prettytable主 ...
- python之platform模块
python之platform模块 ^_^第三个模块从天而降喽!! 函数列表 platform.system() 获取操作系统类型,windows.linux等 platform.platform() ...
- python之OS模块详解
python之OS模块详解 ^_^,步入第二个模块世界----->OS 常见函数列表 os.sep:取代操作系统特定的路径分隔符 os.name:指示你正在使用的工作平台.比如对于Windows ...
- python之sys模块详解
python之sys模块详解 sys模块功能多,我们这里介绍一些比较实用的功能,相信你会喜欢的,和我一起走进python的模块吧! sys模块的常见函数列表 sys.argv: 实现从程序外部向程序传 ...
- 学习PYTHON之路, DAY 6 - PYTHON 基础 6 (模块)
一 安装,导入模块 安装: pip3 install 模块名称 导入: import module from module.xx.xx import xx from module.xx.xx impo ...
- linux下python调用c模块
在C调用Python模块时需要初始化Python解释器,导入模块等,但Python调用C模块却比较简单,下面还是以helloWorld.c 和 main.py 做一说明: (1)编写C代码,hel ...
- Python学习之模块进程函数详解
今天在看<Beginning Linux Programming>中的进程相关部分,讲到Linux几个进程相关的系统函数: system , exec , fork ,wait . Pyt ...
- python基础——第三方模块
python基础——第三方模块 在Python中,安装第三方模块,是通过包管理工具pip完成的. 如果你正在使用Mac或Linux,安装pip本身这个步骤就可以跳过了. 如果你正在使用Window ...
- python基础——使用模块
python基础——使用模块 Python本身就内置了很多非常有用的模块,只要安装完毕,这些模块就可以立刻使用. 我们以内建的sys模块为例,编写一个hello的模块: #!/usr/bin/env ...
随机推荐
- 【Eclipse】安装配置
[Eclipse]安装配置 官网:https://www.eclipse.org 全部版本下载:https://www.eclipse.org/downloads/packages/
- 人员简历管理系统-毕业设计(包括文档+源代码+答辩PPT)
1.开发环境 开发工具:Microsoft Visual Studio 2010操作系统:Windows7(推荐)或更高版本 数据库:sql server 2000 或者更高版本Web服务器:IIS ...
- Poco的介绍和入门教学
版权声明:该文章为AirtestProject原创文章:允许转载,但转载必须注明“转载”并保留原链接 前言 前面我们已经介绍了基于图像识别的测试框架Airtest,通过图像识别,已经可以编写大部分的测 ...
- SpringBoot2基础,进阶,数据库,中间件等系列文章目录分类
本文源码:GitHub·点这里 || GitEE·点这里 一.文章分类 1.入门基础 SpringBoot2:环境搭建和RestFul风格接口 2.日志管理 SpringBoot2:配置Log4j2, ...
- Java面试题_第一阶段(static、final、面向对象、多线程、集合、String、同步、接口、GC、JVM)
1.1 简述static和final的用法? static:修饰属性,方法,代码块 (1)静态属性:也可叫类变量 类名.属性名 来访问 (共有的类变量与对象无关,只和类有关) 注意:类中的实例变量 ...
- Distributed Systems: When you should build them, and how to scale. A step-by-step guide.
原文链接 https://medium.com/free-code-camp/distributed-systems-when-you-should-build-them-and-how-to-sca ...
- python--推倒式(列表、字典、集合)
python的各种推导式(列表推导式.字典推导式.集合推导式) 推导式comprehensions(又称解析式),是Python的一种独有特性.推导式是可以从一个数据序列构建另一个新的数据序列的结构体 ...
- CentOS 7 源代码安装Nginx
本篇简要介绍CentOS 7 源代码安装Nginx. Preface # yum install epel-release -y # yum group install "Developme ...
- Java继承之方法重写
目录 Java继承之方法重写 代码体现 概念 注意事项 "两同两小一大" 其他注意点 重写与重载 @Override注解 Java继承之方法重写 在Java继承中,子类可以获得父类 ...
- Add the Scheduler Module 添加计划程序模块
Important 重要 Scheduler requires the Event business class to be in your XAF application model. Follow ...