打印内存和cpu使用率

CodeProfiler的Python项目详细描述


轮廓仪

包含用于分析其他函数的代码的存储库

安装命令:

pip安装CodeProfiler

探查器

打印CPU和内存使用情况。 将输出记录到日志和csv文件中。在

#Code Sample for pythonfrombsortimportbsortfromprofilerimportprofilet=[0,10,3,41,2]profile(bsort,t)

示例输出:

^{pr2}$

比较器

比较模块内的函数

按名称模块写入与文件的完整比较_名称.csv位于子目录中,名为comp。 同时还将同一个缩小的输出以名称module\u name写入文件_最小.csv。在

#Code Sample for pythonfromprofilerimportComparerimportSortingComparer.comp([54,26,93,17,77,31,44,55,20],Sorting)

示例输出:

Function Name:BubbleSort
Input:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Output:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Execution Time:26000
create_time:2020-03-30 13:01:23
DateTime:2020-03-30 13:01:24.587903
Number of active threads:5
Machine:AMD64
Platform Version:10.0.18362
System:Windows
Processor:Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
RAM:8 GB
Process Priority:32
Memory Usage:0.0633392333984375
Cores:4
Cpu Usage:37.6
Virtual Memory:svmem(total=8459030528, available=2446028800, percent=71.1, used=6013001728, free=2446028800)
memory_usage:0
read_bytes:10824458
write_bytes:0
no. of threads:12
username:LEGION\Shreyas
LOG path: e:\Git\CodeLibrary\Shreyas\Python\log\
CSV path: e:\Git\CodeLibrary\Shreyas\Python\csv\



Function Name:InsertionSort
Input:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Output:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Execution Time:24400
create_time:2020-03-30 13:01:23
DateTime:2020-03-30 13:01:24.622781
Number of active threads:5
Machine:AMD64
Platform Version:10.0.18362
System:Windows
Processor:Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
RAM:8 GB
Process Priority:32
Memory Usage:0.06380844116210938
Cores:4
Cpu Usage:33.3
Virtual Memory:svmem(total=8459030528, available=2444365824, percent=71.1, used=6014664704, free=2444365824)
memory_usage:0
read_bytes:10824458
write_bytes:1196
no. of threads:12
username:LEGION\Shreyas
LOG path: e:\Git\CodeLibrary\Shreyas\Python\log\
CSV path: e:\Git\CodeLibrary\Shreyas\Python\csv\



Function Name:MergeSort
Input:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Output:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Execution Time:121400
create_time:2020-03-30 13:01:23
DateTime:2020-03-30 13:01:24.655694
Number of active threads:5
Machine:AMD64
Platform Version:10.0.18362
System:Windows
Processor:Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
RAM:8 GB
Process Priority:32
Memory Usage:0.06406402587890625
Cores:4
Cpu Usage:37.5
Virtual Memory:svmem(total=8459030528, available=2444148736, percent=71.1, used=6014881792, free=2444148736)
memory_usage:0
read_bytes:10824458
write_bytes:2403
no. of threads:12
username:LEGION\Shreyas
LOG path: e:\Git\CodeLibrary\Shreyas\Python\log\
CSV path: e:\Git\CodeLibrary\Shreyas\Python\csv\



Function Name:SelectionSort
Input:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Output:[17, 20, 26, 31, 44, 54, 55, 77, 93]
Execution Time:55300
create_time:2020-03-30 13:01:23
DateTime:2020-03-30 13:01:24.689604
Number of active threads:5
Machine:AMD64
Platform Version:10.0.18362
System:Windows
Processor:Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
RAM:8 GB
Process Priority:32
Memory Usage:0.06406784057617188
Cores:4
Cpu Usage:87.5
Virtual Memory:svmem(total=8459030528, available=2444124160, percent=71.1, used=6014906368, free=2444124160)
memory_usage:0
read_bytes:10824458
write_bytes:3608
no. of threads:12
username:LEGION\Shreyas
LOG path: e:\Git\CodeLibrary\Shreyas\Python\log\
CSV path: e:\Git\CodeLibrary\Shreyas\Python\csv\



   Function Name  Execution Time  memory_usage  Cpu Usage  write_bytes  read_bytes
1  InsertionSort           24400             0       33.3         1196    10824458
0     BubbleSort           26000             0       37.6            0    10824458
3  SelectionSort           55300             0       87.5         3608    10824458
2      MergeSort          121400             0       37.5         2403    10824458

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在保存信息时切换类的“标准”方式是什么?   java JConsole,用于在JBoss AS7独立模式下远程访问JMX   Maven中未识别java CMD   java做。。虽然带开关菜单   java Javax内容不可访问   从cmd验证日期的java方法   安卓应用程序正在缓存java JSON   java正在尝试使用用户输入的参数创建随机数生成器   java Prompt=在keydove和Spring安全Oauth2之间登录   http没有在java中接收的字节数   在命令行上运行java应用程序(JAR文件)的命令行有我不理解的错误   我需要重命名我在java中生成的json对象的键   java Eclipse重命名/重构会影响javadoc上的变量引用吗?   Java:寻找一个库来读取LDAP数据   包含子实体的参数和数据表的java详细信息