From 2240b25548167506fc981c4b820eb6ef483f937d Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Tue, 21 Jan 2025 03:09:36 +0800 Subject: [PATCH] 0.1.140 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 4 ++-- PyPI/src/guan/data_processing.py | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 053ccc1..2040e1a 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.139 +version = 0.1.140 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index a2dc387..aa2e796 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.2 Name: guan -Version: 0.1.139 +Version: 0.1.140 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/data_processing.py b/PyPI/src/guan/data_processing.py index 945635a..672b12b 100644 --- a/PyPI/src/guan/data_processing.py +++ b/PyPI/src/guan/data_processing.py @@ -744,8 +744,8 @@ def get_cpu_averaged_usage_for_non_zero_cores(interval=1): averaged_cpu_usage = sum(cpu_usage_array_per_core_new)/len(cpu_usage_array_per_core_new) return averaged_cpu_usage -# 在一定数量周期内得到CPU的使用率信息。默认为10秒钟收集一次,(interval+sleep_interval)*times 为收集的时间范围,范围默认为60秒,即1分钟后返回列表,总共得到6组数据。其中,数字第一列和第二列分别是平均值和最大值。 -def get_cpu_information_for_times(interval=1, sleep_interval=9, times=6): +# 在一定数量周期内得到CPU的使用率信息。默认为1秒钟收集一次,(interval+sleep_interval)*times 为收集的时间范围,范围默认为60秒,即1分钟后返回列表,总共得到60组数据。其中,数字第一列和第二列分别是平均值和最大值。 +def get_cpu_information_for_times(interval=1, sleep_interval=0, times=60): import guan import time cpu_information_array = [] @@ -764,8 +764,8 @@ def get_cpu_information_for_times(interval=1, sleep_interval=9, times=6): time.sleep(sleep_interval) return cpu_information_array -# 将得到的CPU的使用率信息写入文件。默认为半分钟收集一次,(interval+sleep_interval)*times 为收集的时间范围,范围默认为60分钟,即1小时写入文件一次,总共得到120组数据。其中,数字第一列和第二列分别是平均值和最大值。 -def write_cpu_information_to_file(filename='./cpu_usage', interval=1, sleep_interval=29, times=120): +# 将得到的CPU的使用率信息写入文件。默认为1分钟收集一次,(interval+sleep_interval)*times 为收集的时间范围,范围默认为60分钟,即1小时写入文件一次,总共得到60组数据。其中,数字第一列和第二列分别是平均值和最大值。 +def write_cpu_information_to_file(filename='./cpu_usage', interval=1, sleep_interval=59, times=60): import guan guan.make_file(filename+'.txt') while True: @@ -782,8 +782,8 @@ def write_cpu_information_to_file(filename='./cpu_usage', interval=1, sleep_inte f.write('\n') f.close() -# 画CPU的使用率图。默认为画最近的120个数据,以及不画CPU核心的最大使用率。 -def plot_cpu_information(filename='./cpu_usage', recent_num=120, max_cpu=0): +# 画CPU的使用率图。默认为画最近的60个数据,以及不画CPU核心的最大使用率。 +def plot_cpu_information(filename='./cpu_usage', recent_num=60, max_cpu=0): import guan from datetime import datetime with open(filename+".txt", "r") as file: @@ -816,7 +816,7 @@ def plot_cpu_information(filename='./cpu_usage', recent_num=120, max_cpu=0): plt.show() # 画详细的CPU的使用率图,分CPU核心画图。 -def plot_detailed_cpu_information(filename='./cpu_usage', recent_num=120): +def plot_detailed_cpu_information(filename='./cpu_usage', recent_num=60): import guan from datetime import datetime with open(filename+".txt", "r") as file: