增加监控文件夹下的python进程和前端的图表展示

This commit is contained in:
wanjia 2025-02-25 15:23:41 +08:00
parent ccf1f45fe1
commit 2713cba136
41 changed files with 4527 additions and 581 deletions

BIN
.gitignore vendored Normal file

Binary file not shown.

56
.idea/.gitignore generated vendored
View File

@ -1,11 +1,45 @@
echo "*.pyc
__pycache__/
.env
*.log
logs/
.idea/
.vscode/
*.sqlite3
db.sqlite3
venv/
.venv/" > .gitignore
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Django
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
media
# IDE
.idea/
.vscode/
*.swp
*.swo
*~
# Virtual Environment
venv/
.venv/
ENV/
# Project specific
logs/
.env

View File

@ -1,30 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="automated_task_monitor/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../automated_task_monitor\templates" />
</list>
</option>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="automated_task_monitor/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../automated_task_monitor\templates" />
</list>
</option>
</component>
</module>

12
.idea/misc.xml generated
View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.10 (automated_task_monitor)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (automated_task_monitor)" project-jdk-type="Python SDK" />
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.10 (automated_task_monitor)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (automated_task_monitor)" project-jdk-type="Python SDK" />
</project>

14
.idea/modules.xml generated
View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/automated_task_monitor.iml" filepath="$PROJECT_DIR$/.idea/automated_task_monitor.iml" />
</modules>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/automated_task_monitor.iml" filepath="$PROJECT_DIR$/.idea/automated_task_monitor.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

34
.idea/workspace.xml generated
View File

@ -4,7 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="12eb891e-5234-4edf-9697-982a38ae2f63" name="更改" comment="" />
<list default="true" id="12eb891e-5234-4edf-9697-982a38ae2f63" name="更改" comment="">
<change beforePath="$PROJECT_DIR$/automated_task_monitor/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/automated_task_monitor/settings.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -17,6 +19,9 @@
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 6
@ -26,20 +31,20 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenDjangoStructureViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/pythonProject/myproject/.venv/Scripts&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenDjangoStructureViewOnStart": "true",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"last_opened_file_path": "D:/pythonProject/ecosscloud-cloud-services-frontend",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
}
}</component>
}]]></component>
<component name="RunManager">
<configuration name="automated_task_monitor" type="Python.DjangoServer" factoryName="Django server">
<module name="automated_task_monitor" />
@ -87,6 +92,7 @@
<workItem from="1739775058347" duration="988000" />
<workItem from="1739864902383" duration="147000" />
<workItem from="1739869240489" duration="361000" />
<workItem from="1739945870599" duration="439000" />
</task>
<servers />
</component>

View File

@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
from pathlib import Path
import os
import time
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -33,7 +34,10 @@ ALLOWED_HOSTS = [
]
# 监控配置
MONITOR_INTERVAL = 60 # 监控间隔(秒)
MONITOR_INTERVAL = 5 # 缩短为5秒
# 日志写入间隔(秒)
LOG_INTERVAL = 60 # 每60秒写入一次日志
# Application definition
@ -128,16 +132,48 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = 'static/'
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
# 如果是生产环境,还需要设置
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# 修改日志路径为项目根目录下的 logs 文件夹
LOG_DIR = os.path.join(BASE_DIR, 'logs', 'process_monitor')
# 日志配置
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'simple',
},
},
'formatters': {
'simple': {
'format': '{asctime} {message}',
'style': '{',
'datefmt': '%Y-%m-%d %H:%M:%S',
},
},
'loggers': {
'django.server': {
'handlers': ['console'],
'level': 'INFO',
},
},
}
# 确保日志目录存在
os.makedirs(LOG_DIR, exist_ok=True)
os.makedirs('logs', exist_ok=True)
# 添加版本号,防止缓存
STATIC_VERSION = int(time.time())

View File

@ -16,8 +16,12 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.shortcuts import redirect
urlpatterns = [
path('admin/', admin.site.urls),
path('monitor/', include('monitor.urls')),
]
path('', lambda request: redirect('monitor/')), # 将根路径重定向到 monitor/
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@ -0,0 +1,23 @@
=== 2025-02-25 13:44:25 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 14/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.0%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,184 @@
=== 2025-02-25 13:47:34 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 13/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.1%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:50:09 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 7/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 71.8%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:50:57 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 7/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.2%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:57:53 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 71.6%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:58:54 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 7/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.2%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:00:19 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 7/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 71.4%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:00:56 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 7/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.0%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:05:30 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 7/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 71.9%
└─ 交换空间使用: 2.7%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,184 @@
=== 2025-02-25 13:47:34 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 117/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.1%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 837次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:50:09 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 285/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 71.8%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 914次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:50:57 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 340/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.2%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 937次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:57:53 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 797/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 71.6%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1147次
进程状态: running
--------------------------------------------------
=== 2025-02-25 13:58:54 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 871/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.2%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1177次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:00:20 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 982/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 71.4%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1220次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:00:56 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1029/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1238次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:05:30 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1344/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 71.7%
└─ 交换空间使用: 2.7%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1374次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,92 @@
=== 2025-02-25 14:11:01 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 98/0
内存信息:
├─ 物理内存: 9.4MB (0.1%)
├─ 虚拟内存: 5.3MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.3%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 832次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:14:03 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 309/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.6%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 923次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:16:50 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 508/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.0%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1007次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:17:16 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 541/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.7%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1020次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,483 @@
=== 2025-02-25 14:42:27 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 93/0
内存信息:
├─ 物理内存: 9.4MB (0.1%)
├─ 虚拟内存: 5.3MB
├─ 内存映射: 25个
├─ 系统内存使用: 75.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 831次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:43:29 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 152/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 75.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 862次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:44:29 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 227/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 75.4%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 892次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:48:04 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 476/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 75.4%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1000次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:48:52 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 540/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.2MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.7%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1024次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:49:56 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 623/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.4%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1056次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:50:42 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 683/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.7%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1079次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:56:17 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1068/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1247次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:57:22 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1147/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1279次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:59:48 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1317/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1351次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:00:49 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1393/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.5%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1382次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:03:18 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1571/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1456次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:04:20 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1650/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.8%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1487次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:05:22 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1722/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.1%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1518次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:05:24 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1724/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.2%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1519次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:06:04 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1781/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 74.2%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1539次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:06:52 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1847/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.4%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1562次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:07:09 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1870/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1571次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:07:29 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 1893/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.6%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1581次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:09:16 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 2030/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 1.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1634次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:10:17 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 2106/0
内存信息:
├─ 物理内存: 9.3MB (0.1%)
├─ 虚拟内存: 5.1MB
├─ 内存映射: 25个
├─ 系统内存使用: 73.5%
└─ 交换空间使用: 1.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 1665次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,92 @@
=== 2025-02-25 14:11:01 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 14/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.3%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:14:03 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 8/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.6%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:16:50 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 12/0
内存信息:
├─ 物理内存: 3.6MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.0%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 42次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:17:16 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 12/0
内存信息:
├─ 物理内存: 3.6MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.8%
└─ 交换空间使用: 2.8%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 42次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,460 @@
=== 2025-02-25 14:42:27 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 15/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 75.3%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:43:29 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 75.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:44:29 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 75.4%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 40次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:48:04 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 13/0
内存信息:
├─ 物理内存: 3.6MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 75.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 42次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:48:52 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 13/0
内存信息:
├─ 物理内存: 3.6MB (0.0%)
├─ 虚拟内存: 0.8MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.7%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 42次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:49:56 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.5%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 42次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:50:42 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.7%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 42次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:56:17 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:57:22 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 14:59:48 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.5%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:00:49 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.5%
└─ 交换空间使用: 2.0%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:03:18 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:04:20 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.8%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:05:23 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.2%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:05:25 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.3%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:06:04 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 74.3%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:06:53 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.4%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:07:29 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 72.7%
└─ 交换空间使用: 2.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:09:16 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.1%
└─ 交换空间使用: 1.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------
=== 2025-02-25 15:10:17 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 9/0
内存信息:
├─ 物理内存: 3.5MB (0.0%)
├─ 虚拟内存: 0.7MB
├─ 内存映射: 11个
├─ 系统内存使用: 73.5%
└─ 交换空间使用: 1.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (2次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 43次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,23 @@
=== 2025-02-25 13:44:25 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 93/0
内存信息:
├─ 物理内存: 9.4MB (0.1%)
├─ 虚拟内存: 5.3MB
├─ 内存映射: 25个
├─ 系统内存使用: 72.0%
└─ 交换空间使用: 2.9%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.3MB (69次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 832次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,46 @@
=== 2025-02-25 10:12:46 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 4.7s
├─ 内核态时间: 2.6s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 392063/0
内存信息:
├─ 物理内存: 296.9MB (1.9%)
├─ 虚拟内存: 177.0MB
├─ 内存映射: 325个
├─ 系统内存使用: 78.2%
└─ 交换空间使用: 0.7%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 3906.9MB (303763次)
├─ 写入: 49.0MB (5023次)
└─ 其他IO: 108714次
进程状态: running
--------------------------------------------------
=== 2025-02-25 10:13:46 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 4.7s
├─ 内核态时间: 2.6s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 413451/0
内存信息:
├─ 物理内存: 234.0MB (1.5%)
├─ 虚拟内存: 177.0MB
├─ 内存映射: 327个
├─ 系统内存使用: 73.3%
└─ 交换空间使用: 0.7%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 3906.9MB (303770次)
├─ 写入: 49.0MB (5032次)
└─ 其他IO: 112589次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,138 @@
=== 2025-02-20 12:25:46 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 86/0
内存信息:
├─ 物理内存: 9.0MB (0.1%)
├─ 虚拟内存: 1.8MB
├─ 内存映射: 0个
├─ 系统内存使用: 72.2%
└─ 交换空间使用: 5.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (0次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 74次
进程状态: running
--------------------------------------------------
=== 2025-02-20 12:25:46 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 86/0
内存信息:
├─ 物理内存: 9.0MB (0.1%)
├─ 虚拟内存: 1.8MB
├─ 内存映射: 0个
├─ 系统内存使用: 72.2%
└─ 交换空间使用: 5.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (0次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 74次
进程状态: running
--------------------------------------------------
=== 2025-02-20 12:27:32 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 86/0
内存信息:
├─ 物理内存: 9.0MB (0.1%)
├─ 虚拟内存: 1.8MB
├─ 内存映射: 0个
├─ 系统内存使用: 72.3%
└─ 交换空间使用: 5.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (0次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 74次
进程状态: running
--------------------------------------------------
=== 2025-02-20 12:27:32 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 86/0
内存信息:
├─ 物理内存: 9.0MB (0.1%)
├─ 虚拟内存: 1.8MB
├─ 内存映射: 0个
├─ 系统内存使用: 72.3%
└─ 交换空间使用: 5.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (0次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 74次
进程状态: running
--------------------------------------------------
=== 2025-02-20 20:30:34 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 86/0
内存信息:
├─ 物理内存: 9.0MB (0.1%)
├─ 虚拟内存: 1.8MB
├─ 内存映射: 0个
├─ 系统内存使用: 73.3%
└─ 交换空间使用: 5.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (0次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 74次
进程状态: running
--------------------------------------------------
=== 2025-02-20 20:30:34 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 86/0
内存信息:
├─ 物理内存: 9.0MB (0.1%)
├─ 虚拟内存: 1.8MB
├─ 内存映射: 0个
├─ 系统内存使用: 73.2%
└─ 交换空间使用: 5.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (0次)
├─ 写入: 0.0MB (0次)
└─ 其他IO: 74次
进程状态: running
--------------------------------------------------

View File

@ -0,0 +1,23 @@
=== 2025-02-22 10:43:55 ===
CPU信息:
├─ 使用率: 0.0%
├─ 用户态时间: 0.0s
├─ 内核态时间: 0.0s
├─ CPU核心数: 16
├─ CPU频率: 4001.0MHz
└─ 上下文切换: 717/0
内存信息:
├─ 物理内存: 13.3MB (0.1%)
├─ 虚拟内存: 4.4MB
├─ 内存映射: 0个
├─ 系统内存使用: 72.5%
└─ 交换空间使用: 0.1%
GPU信息:
├─ 使用率: 0.0%
└─ 显存使用: 0.0MB
IO信息:
├─ 读取: 0.0MB (3次)
├─ 写入: 0.0MB (1次)
└─ 其他IO: 275次
进程状态: running
--------------------------------------------------

View File

@ -1,67 +0,0 @@
2025-02-18 17:35:58,750 - INFO - 开始监控进程:
├─ 进程名称: Lark.exe
├─ 进程ID: 22572
├─ 监控类型: gpu
├─ 监控间隔: 60秒
└─ 开始时间: 2025-02-18 17:35:58
2025-02-18 17:35:58,755 - INFO - 创建新的监控记录
2025-02-18 17:35:58,765 - INFO - 进程状态:
├─ 状态码: 1
├─ 状态描述: running
├─ 监控状态: 活跃
└─ 运行时长: 7:43:55.278315
2025-02-18 17:35:59,119 - INFO - GPU信息
├─ 状态: 正常
├─ 使用率: 19.0%
└─ 显存使用: 1499.0MB
2025-02-18 17:35:59,134 - INFO - 资源使用情况 - 2025-02-18 17:35:59:
├─ CPU信息
│ ├─ 使用率: 0.0%
│ ├─ 用户态时间: 4.9s
│ ├─ 内核态时间: 5.2s
│ ├─ CPU核心数: 16
│ ├─ CPU频率: 4001.0MHz
│ └─ 上下文切换: 1470919/0
├─ 内存信息
│ ├─ 物理内存: 145.8MB (0.9%)
│ ├─ 虚拟内存: 138.7MB
│ ├─ 内存映射: 99个
│ ├─ 系统内存使用: 79.8%
│ └─ 交换空间使用: 10.0%
├─ GPU信息
│ ├─ 状态: 正常
│ ├─ 使用率: 19.0%
│ └─ 显存使用: 1499.0MB
├─ IO信息
│ ├─ 读取: 112.8MB (135217次)
2025-02-18 17:36:59,149 - INFO - 进程状态:
├─ 状态码: 1
├─ 状态描述: running
├─ 监控状态: 活跃
└─ 运行时长: 7:44:55.662074
2025-02-18 17:36:59,272 - INFO - GPU信息
├─ 状态: 正常
├─ 使用率: 1.0%
└─ 显存使用: 1486.0MB
2025-02-18 17:36:59,284 - INFO - 资源使用情况 - 2025-02-18 17:36:59:
├─ CPU信息
│ ├─ 使用率: 0.0%
│ ├─ 用户态时间: 4.9s
│ ├─ 内核态时间: 5.2s
│ ├─ CPU核心数: 16
│ ├─ CPU频率: 4001.0MHz
│ └─ 上下文切换: 1473027/0
├─ 内存信息
│ ├─ 物理内存: 145.8MB (0.9%)
│ ├─ 虚拟内存: 138.5MB
│ ├─ 内存映射: 99个
│ ├─ 系统内存使用: 80.1%
│ └─ 交换空间使用: 10.0%
├─ GPU信息
│ ├─ 状态: 正常
│ ├─ 使用率: 1.0%
│ └─ 显存使用: 1486.0MB
├─ IO信息
│ ├─ 读取: 112.9MB (135263次)

View File

@ -1,15 +0,0 @@
2025-02-18 15:49:36,173 - INFO - 开始监控memory进程 pycharm64.exe (PID: 40128)
2025-02-18 15:49:37,621 - INFO - 内存使用情况:
- 物理内存: 2.05GB
- 虚拟内存: 1.87GB
- 交换空间: 1.45GB
- CPU: 1.5%
- GPU: 0.0%
2025-02-18 15:50:38,966 - INFO - 内存使用情况:
- 物理内存: 2.03GB
- 虚拟内存: 1.85GB
- 交换空间: 1.45GB
- CPU: 0.0%
- GPU: 0.0%
2025-02-18 15:51:38,972 - ERROR - 进程 40128 已终止
2025-02-18 15:51:38,975 - INFO - 监控已结束

View File

@ -0,0 +1,132 @@
# Generated by Django 5.1.6 on 2025-02-20 07:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('monitor', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='highcpuprocess',
options={'verbose_name': 'CPU高占用进程', 'verbose_name_plural': 'CPU高占用进程'},
),
migrations.AlterModelOptions(
name='highgpuprocess',
options={'verbose_name': 'GPU高占用进程', 'verbose_name_plural': 'GPU高占用进程'},
),
migrations.AlterModelOptions(
name='highmemoryprocess',
options={'verbose_name': '内存高占用进程', 'verbose_name_plural': '内存高占用进程'},
),
migrations.RemoveField(
model_name='highcpuprocess',
name='gpu_memory',
),
migrations.RemoveField(
model_name='highcpuprocess',
name='gpu_usage',
),
migrations.RemoveField(
model_name='highcpuprocess',
name='log_path',
),
migrations.RemoveField(
model_name='highcpuprocess',
name='memory_usage',
),
migrations.RemoveField(
model_name='highcpuprocess',
name='virtual_memory',
),
migrations.RemoveField(
model_name='highgpuprocess',
name='cpu_usage',
),
migrations.RemoveField(
model_name='highgpuprocess',
name='log_path',
),
migrations.RemoveField(
model_name='highgpuprocess',
name='memory_usage',
),
migrations.RemoveField(
model_name='highgpuprocess',
name='virtual_memory',
),
migrations.RemoveField(
model_name='highmemoryprocess',
name='cpu_usage',
),
migrations.RemoveField(
model_name='highmemoryprocess',
name='gpu_memory',
),
migrations.RemoveField(
model_name='highmemoryprocess',
name='gpu_usage',
),
migrations.RemoveField(
model_name='highmemoryprocess',
name='log_path',
),
migrations.AddField(
model_name='highcpuprocess',
name='log_file',
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='日志文件路径'),
),
migrations.AddField(
model_name='highgpuprocess',
name='log_file',
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='日志文件路径'),
),
migrations.AddField(
model_name='highmemoryprocess',
name='log_file',
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='日志文件路径'),
),
migrations.AddField(
model_name='highmemoryprocess',
name='memory_percent',
field=models.FloatField(default=0, verbose_name='内存使用率'),
),
migrations.AlterField(
model_name='highcpuprocess',
name='cpu_cores',
field=models.IntegerField(default=0, verbose_name='CPU核心数'),
),
migrations.AlterField(
model_name='highcpuprocess',
name='cpu_usage',
field=models.FloatField(default=0, verbose_name='CPU使用率'),
),
migrations.AlterField(
model_name='highcpuprocess',
name='status',
field=models.IntegerField(default=1, verbose_name='进程状态'),
),
migrations.AlterField(
model_name='highgpuprocess',
name='gpu_usage',
field=models.FloatField(default=0, verbose_name='GPU使用率'),
),
migrations.AlterField(
model_name='highgpuprocess',
name='status',
field=models.IntegerField(default=1, verbose_name='进程状态'),
),
migrations.AlterField(
model_name='highmemoryprocess',
name='status',
field=models.IntegerField(default=1, verbose_name='进程状态'),
),
migrations.AlterField(
model_name='highmemoryprocess',
name='swap_usage',
field=models.FloatField(default=0, verbose_name='交换内存使用量(GB)'),
),
]

View File

@ -0,0 +1,41 @@
# Generated by Django 5.1.6 on 2025-02-25 03:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('monitor', '0002_alter_highcpuprocess_options_and_more'),
]
operations = [
migrations.CreateModel(
name='AllResourceProcess',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('pid', models.IntegerField(verbose_name='进程ID')),
('process_name', models.CharField(max_length=100, verbose_name='进程名称')),
('cpu_usage', models.FloatField(default=0, verbose_name='CPU使用率')),
('cpu_user_time', models.FloatField(default=0, verbose_name='用户态CPU时间')),
('cpu_system_time', models.FloatField(default=0, verbose_name='系统态CPU时间')),
('memory_usage', models.FloatField(default=0, verbose_name='内存使用量(MB)')),
('memory_percent', models.FloatField(default=0, verbose_name='内存使用率')),
('virtual_memory', models.FloatField(default=0, verbose_name='虚拟内存(MB)')),
('gpu_usage', models.FloatField(default=0, verbose_name='GPU使用率')),
('gpu_memory', models.FloatField(default=0, verbose_name='GPU内存使用量(MB)')),
('net_io_sent', models.FloatField(default=0, verbose_name='网络发送量(MB)')),
('net_io_recv', models.FloatField(default=0, verbose_name='网络接收量(MB)')),
('is_active', models.BooleanField(default=True, verbose_name='是否活跃')),
('status', models.IntegerField(default=1, verbose_name='状态')),
('log_file', models.CharField(max_length=255, null=True, verbose_name='日志文件路径')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
],
options={
'verbose_name': '全资源监控',
'verbose_name_plural': '全资源监控',
'db_table': 'all_resource_process',
},
),
]

View File

@ -1,45 +1,75 @@
from django.db import models
from django.utils import timezone
class BaseProcessMonitor(models.Model):
"""进程监控基类"""
pid = models.IntegerField(verbose_name="进程ID")
process_name = models.CharField(max_length=255, verbose_name="进程名称")
log_path = models.CharField(max_length=255, verbose_name="日志路径")
is_active = models.BooleanField(default=True, verbose_name="是否活跃")
created_at = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
updated_at = models.DateTimeField(auto_now=True, verbose_name="更新时间")
status = models.IntegerField(default=1, verbose_name="进程状态", help_text="1:运行中, 0:已停止")
# 基本资源信息
cpu_usage = models.FloatField(default=0, verbose_name="CPU使用率(%)")
memory_usage = models.FloatField(default=0, verbose_name="内存使用量(GB)")
gpu_usage = models.FloatField(default=0, verbose_name="GPU使用率(%)")
gpu_memory = models.FloatField(default=0, verbose_name="GPU显存使用量(MB)")
virtual_memory = models.FloatField(default=0, verbose_name="虚拟内存使用量(GB)")
"""基础进程监控模型"""
pid = models.IntegerField(verbose_name='进程ID')
process_name = models.CharField(max_length=255, verbose_name='进程名称')
is_active = models.BooleanField(default=True, verbose_name='是否活跃')
status = models.IntegerField(default=1, verbose_name='进程状态') # 1: 运行中, 0: 已终止
created_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
updated_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')
log_file = models.CharField(max_length=255, null=True, blank=True, verbose_name='日志文件路径')
class Meta:
abstract = True
class HighCPUProcess(BaseProcessMonitor):
"""高CPU使用进程监控"""
cpu_cores = models.IntegerField(default=0, verbose_name="使用的CPU核心数")
"""CPU高占用进程监控"""
cpu_usage = models.FloatField(default=0, verbose_name='CPU使用率')
cpu_cores = models.IntegerField(default=0, verbose_name='CPU核心数')
class Meta:
verbose_name = "高CPU进程"
verbose_name_plural = "高CPU进程"
verbose_name = 'CPU高占用进程'
verbose_name_plural = verbose_name
class HighGPUProcess(BaseProcessMonitor):
"""高GPU使用进程监控"""
gpu_index = models.IntegerField(default=0, verbose_name="GPU设备索引")
"""GPU高占用进程监控"""
gpu_usage = models.FloatField(default=0, verbose_name='GPU使用率')
gpu_memory = models.FloatField(default=0, verbose_name='GPU显存使用量(MB)')
gpu_index = models.IntegerField(default=0, verbose_name='GPU设备索引')
class Meta:
verbose_name = "高GPU进程"
verbose_name_plural = "高GPU进程"
verbose_name = 'GPU高占用进程'
verbose_name_plural = verbose_name
class HighMemoryProcess(BaseProcessMonitor):
"""高内存使用进程监控"""
swap_usage = models.FloatField(default=0, verbose_name="交换空间使用量(GB)")
"""内存高占用进程监控"""
memory_usage = models.FloatField(default=0, verbose_name='内存使用量(GB)')
memory_percent = models.FloatField(default=0, verbose_name='内存使用率')
virtual_memory = models.FloatField(default=0, verbose_name='虚拟内存使用量(GB)')
swap_usage = models.FloatField(default=0, verbose_name='交换内存使用量(GB)')
class Meta:
verbose_name = "高内存进程"
verbose_name_plural = "高内存进程"
verbose_name = '内存高占用进程'
verbose_name_plural = verbose_name
class AllResourceProcess(models.Model):
"""所有资源统计"""
pid = models.IntegerField('进程ID')
process_name = models.CharField('进程名称', max_length=100)
# CPU 相关
cpu_usage = models.FloatField('CPU使用率', default=0)
cpu_user_time = models.FloatField('用户态CPU时间', default=0)
cpu_system_time = models.FloatField('系统态CPU时间', default=0)
# 内存相关
memory_usage = models.FloatField('内存使用量(MB)', default=0)
memory_percent = models.FloatField('内存使用率', default=0)
virtual_memory = models.FloatField('虚拟内存(MB)', default=0)
# GPU 相关
gpu_usage = models.FloatField('GPU使用率', default=0)
gpu_memory = models.FloatField('GPU内存使用量(MB)', default=0)
# 网络相关
net_io_sent = models.FloatField('网络发送量(MB)', default=0)
net_io_recv = models.FloatField('网络接收量(MB)', default=0)
# 状态相关
is_active = models.BooleanField('是否活跃', default=True)
status = models.IntegerField('状态', default=1) # 1:运行中, 0:已终止
log_file = models.CharField('日志文件路径', max_length=255, null=True)
created_at = models.DateTimeField('创建时间', auto_now_add=True)
updated_at = models.DateTimeField('更新时间', auto_now=True)
class Meta:
db_table = 'all_resource_process'
verbose_name = '全资源监控'
verbose_name_plural = verbose_name

View File

@ -0,0 +1,17 @@
.status-badge {
min-width: 80px;
text-align: center;
}
.monitor-card {
height: 100%;
margin-bottom: 20px;
}
.resource-table {
margin-bottom: 0;
}
.resource-table td:first-child {
width: 40%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,928 @@
// 在文件开头添加调试日志
console.log('monitor.js 加载完成');
// 全局变量声明
let currentDirectory = null;
let selectedPid = null;
let updateInterval = null;
let cpuChart = null;
let memoryChart = null;
let gpuChart = null;
// 更新监控数据
function updateMonitorData(pid) {
// 使用保存的监控类型
const type = currentMonitorType;
console.log('正在更新数据,类型:', type); // 调试日志
// 构建 URL确保包含 type 参数
const url = new URL(`${window.location.origin}/api/process/${pid}/status/`);
url.searchParams.append('type', type);
console.log('请求 URL:', url.toString()); // 调试日志
fetch(url)
.then(response => response.json())
.then(response => {
if (response.status === 'success') {
const data = response.data;
updateUI(data, type);
}
})
.catch(error => handleError(error, '获取监控数据失败'));
}
// 获取所有监控按钮和停止按钮
const monitorButtons = document.querySelectorAll('[data-type]');
const stopBtn = document.getElementById('stopMonitor');
const pidInput = document.getElementById('pidInput');
// 保存当前监控类型的全局变量
let currentMonitorType = null;
// 开始监控
function startMonitoring(pid) {
console.log('开始监控,类型:', currentMonitorType); // 调试日志
updateMonitorData(pid); // 立即执行一次更新
monitorInterval = setInterval(() => {
updateMonitorData(pid);
}, 60000);
}
// 停止监控
function stopMonitoring() {
if (!currentDirectory) {
console.error('没有正在监控的目录');
showMessage('没有正在监控的目录', 'error');
return;
}
const stopBtn = document.getElementById('stopDirectoryMonitor');
if (!stopBtn) return;
stopBtn.disabled = true;
stopBtn.textContent = '正在停止...';
// 先清理定时器
if (updateInterval) {
clearInterval(updateInterval);
updateInterval = null;
}
const directoryToStop = currentDirectory;
fetch('/monitor/stop-directory-monitor/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': getCSRFToken(),
},
body: JSON.stringify({ directory: directoryToStop })
})
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
cleanupMonitoringState();
showMessage('监控已停止', 'success');
} else {
throw new Error(data.message || '停止监控失败');
}
})
.catch(error => {
console.error('停止监控失败:', error);
showMessage(error.message || '停止监控失败', 'error');
stopBtn.disabled = false;
})
.finally(() => {
stopBtn.textContent = '停止监控';
});
}
// 初始化图表
function initCharts() {
console.log('初始化图表');
cpuChart = echarts.init(document.getElementById('cpuChart'));
memoryChart = echarts.init(document.getElementById('memoryChart'));
gpuChart = echarts.init(document.getElementById('gpuChart'));
const baseOption = {
tooltip: {
trigger: 'axis',
formatter: function(params) {
const time = new Date(params[0].value[0]).toLocaleTimeString();
return `${time}<br/>${params[0].seriesName}: ${params[0].value[1].toFixed(2)}%`;
}
},
xAxis: {
type: 'time',
splitLine: { show: false }
},
yAxis: {
type: 'value',
min: 0,
max: 100,
splitLine: { show: true }
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
series: [{
type: 'line',
showSymbol: false,
data: [],
smooth: true,
areaStyle: {
opacity: 0.1
}
}]
};
cpuChart.setOption({
...baseOption,
series: [{
...baseOption.series[0],
name: 'CPU使用率',
itemStyle: { color: '#2196F3' }
}]
});
memoryChart.setOption({
...baseOption,
series: [{
...baseOption.series[0],
name: '内存使用量',
itemStyle: { color: '#4CAF50' }
}]
});
gpuChart.setOption({
...baseOption,
series: [{
...baseOption.series[0],
name: 'GPU使用率',
itemStyle: { color: '#FF5722' }
}]
});
}
// 更新图表数据
function updateCharts(process) {
console.log('更新图表:', process);
const now = new Date();
// 更新CPU图表
if (cpuChart) {
updateChartData(cpuChart, now, process.cpu_usage);
}
// 更新内存图表
if (memoryChart) {
updateChartData(memoryChart, now, process.memory_usage);
}
// 更新GPU图表
if (gpuChart && process.gpu_info) {
updateChartData(gpuChart, now, process.gpu_info.usage);
}
}
// 辅助函数:更新图表数据
function updateChartData(chart, time, value) {
if (!chart) return;
try {
const option = chart.getOption();
const data = option.series[0].data || [];
data.push([time, value]);
// 保持最近60个数据点
if (data.length > 60) {
data.shift();
}
chart.setOption({
series: [{
data: data
}]
});
} catch (error) {
console.error('更新图表数据失败:', error);
}
}
// 修改更新进程表格函数
function updateProcessTable(processes) {
console.log('更新进程表格:', processes); // 调试日志
const table = document.getElementById('processTable');
if (!table) {
console.error('找不到进程表格元素');
return;
}
if (!processes || processes.length === 0) {
table.innerHTML = `
<tr>
<td colspan="7" class="text-center">暂无进程数据</td>
</tr>
`;
return;
}
table.innerHTML = processes.map(proc => `
<tr class="${selectedPid && selectedPid == proc.pid ? 'table-primary' : ''}">
<td>${proc.pid}</td>
<td>${proc.name}</td>
<td>
<div class="d-flex align-items-center">
<div class="progress flex-grow-1" style="height: 6px;">
<div class="progress-bar" role="progressbar"
style="width: ${proc.cpu_usage}%;"
aria-valuenow="${proc.cpu_usage}"
aria-valuemin="0"
aria-valuemax="100">
</div>
</div>
<span class="ms-2">${proc.cpu_usage.toFixed(1)}%</span>
</div>
</td>
<td>
<div class="d-flex align-items-center">
<div class="progress flex-grow-1" style="height: 6px;">
<div class="progress-bar bg-success" role="progressbar"
style="width: ${(proc.memory_usage/1000)*100}%;"
aria-valuenow="${proc.memory_usage}"
aria-valuemin="0"
aria-valuemax="100">
</div>
</div>
<span class="ms-2">${proc.memory_usage.toFixed(1)} MB</span>
</div>
</td>
<td>
<div class="d-flex align-items-center">
<div class="progress flex-grow-1" style="height: 6px;">
<div class="progress-bar bg-warning" role="progressbar"
style="width: ${proc.gpu_info.usage}%;"
aria-valuenow="${proc.gpu_info.usage}"
aria-valuemin="0"
aria-valuemax="100">
</div>
</div>
<span class="ms-2">${proc.gpu_info.usage}%</span>
</div>
</td>
<td>${proc.gpu_info.memory.toFixed(1)} MB</td>
<td>
<span class="badge bg-success">运行中</span>
<button class="btn btn-sm btn-outline-primary ms-2"
onclick="selectProcess(${proc.pid})">
查看详情
</button>
</td>
</tr>
`).join('');
}
// 修改选择进程的函数
function selectProcess(pid) {
console.log('选择进程:', pid);
selectedPid = pid.toString(); // 确保转换为字符串
// 更新选择器
const selector = document.getElementById('processSelector');
if (selector) {
selector.value = selectedPid;
}
// 更新表格中的选中状态
const rows = document.querySelectorAll('#processTable tr');
rows.forEach(row => {
if (row.cells && row.cells[0] && row.cells[0].textContent === selectedPid) {
row.classList.add('table-primary');
} else {
row.classList.remove('table-primary');
}
});
// 获取最新数据并更新图表
if (currentDirectory) {
fetch(`/monitor/directory-status/?directory=${encodeURIComponent(currentDirectory)}`)
.then(response => response.json())
.then(data => {
if (data.status === 'success' && data.processes) {
const selectedProcess = data.processes.find(p => p.pid.toString() === selectedPid);
if (selectedProcess) {
// 更新图表
updateCharts(selectedProcess);
// 更新详细信息
updateProcessDetails(selectedProcess);
}
}
})
.catch(error => console.error('获取进程详情失败:', error));
}
}
// 修改进程选择器更新函数
function updateProcessSelector(processes) {
console.log('更新进程选择器,进程列表:', processes); // 调试日志
const selector = document.getElementById('processSelector');
const processInfo = document.getElementById('selectedProcessInfo');
if (!selector) {
console.error('找不到进程选择器元素');
return;
}
// 启用选择器
selector.disabled = false;
// 获取当前的进程列表
const currentPids = processes.map(p => p.pid.toString());
console.log('当前PID列表:', currentPids); // 调试日志
// 如果当前选中的进程不在列表中,清除选择
if (selectedPid && !currentPids.includes(selectedPid.toString())) {
console.log('选中的进程不再存在,清除选择'); // 调试日志
selectedPid = null;
clearCharts();
}
// 移除旧的事件监听器
const newSelector = selector.cloneNode(true);
selector.parentNode.replaceChild(newSelector, selector);
// 更新选择器选项
newSelector.innerHTML = `
<option value="">选择要监控的进程</option>
${processes.map(proc => `
<option value="${proc.pid}" ${proc.pid.toString() === selectedPid ? 'selected' : ''}>
PID: ${proc.pid} - ${proc.name} (CPU: ${proc.cpu_usage.toFixed(2)}%)
</option>
`).join('')}
`;
// 添加新的事件监听器
newSelector.addEventListener('change', function() {
console.log('进程选择变更:', this.value);
selectedPid = this.value;
if (selectedPid) {
const selected = processes.find(p => p.pid === parseInt(selectedPid));
if (selected) {
processInfo.textContent = `监控中: PID ${selected.pid} - ${selected.name}`;
updateProcessDetails(selected); // 更新详细信息
clearCharts();
}
} else {
processInfo.textContent = '未选择进程';
clearCharts();
// 清空详细信息
['basicInfo', 'resourceInfo', 'networkInfo', 'fileInfo'].forEach(id => {
document.getElementById(id).innerHTML = '<p>选择进程查看详细信息</p>';
});
}
});
console.log('进程选择器更新完成'); // 调试日志
}
// 添加清除图表数据函数
function clearCharts() {
const emptyOption = {
series: [{
data: []
}]
};
cpuChart.setOption(emptyOption);
memoryChart.setOption(emptyOption);
gpuChart.setOption(emptyOption);
}
document.addEventListener('DOMContentLoaded', function() {
console.log('DOM加载完成开始初始化');
const startBtn = document.getElementById('startDirectoryMonitor');
const stopBtn = document.getElementById('stopDirectoryMonitor');
if (!startBtn || !stopBtn) {
console.error('找不到监控按钮元素');
return;
}
// 初始化图表
initCharts();
// 开始监控按钮事件
startBtn.addEventListener('click', function() {
console.log('点击了开始监控按钮');
const directory = document.getElementById('directoryInput').value;
const statusDiv = document.getElementById('directoryMonitorStatus');
if (!directory) {
statusDiv.style.display = 'block';
statusDiv.className = 'alert alert-warning';
statusDiv.textContent = '请输入目录路径';
return;
}
// 显示加载状态
startBtn.disabled = true;
startBtn.textContent = '启动中...';
statusDiv.style.display = 'block';
statusDiv.className = 'alert alert-info';
statusDiv.textContent = '正在启动监控...';
console.log('开始监控目录:', directory);
// 清除旧的选择
selectedPid = null;
clearCharts();
fetch('/monitor/scan-directory/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ directory: directory })
})
.then(response => response.json())
.then(data => {
console.log('接口返回:', data);
if (data.status === 'success') {
currentDirectory = directory;
statusDiv.className = 'alert alert-success';
statusDiv.textContent = data.message;
startBtn.disabled = true;
stopBtn.disabled = false;
// 开始定期获取详细信息
if (updateInterval) {
clearInterval(updateInterval);
}
currentDirectory = directory;
getProcessDetails(directory); // 立即获取一次
updateInterval = setInterval(() => getProcessDetails(directory), 5000); // 每5秒更新一次
} else {
statusDiv.className = 'alert alert-danger';
statusDiv.textContent = data.message;
startBtn.disabled = false;
}
})
.catch(error => {
console.error('监控启动失败:', error);
statusDiv.className = 'alert alert-danger';
statusDiv.textContent = '启动监控失败: ' + error.message;
startBtn.disabled = false;
})
.finally(() => {
startBtn.textContent = '开始监控';
});
});
// 停止监控按钮事件
if (stopBtn) {
stopBtn.addEventListener('click', function() {
console.log('停止监控,当前目录:', currentDirectory);
// 检查是否有当前目录
if (!currentDirectory) {
console.error('没有正在监控的目录');
showMessage('没有正在监控的目录', 'error');
return;
}
// 禁用按钮,防止重复点击
stopBtn.disabled = true;
stopBtn.textContent = '正在停止...';
// 先清理定时器,防止继续发送请求
if (updateInterval) {
clearInterval(updateInterval);
updateInterval = null;
}
// 保存当前目录的副本
const directoryToStop = currentDirectory;
// 发送停止监控请求到服务器
fetch('/monitor/stop-directory-monitor/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': getCSRFToken(),
},
body: JSON.stringify({
directory: directoryToStop,
timestamp: new Date().getTime() // 添加时间戳防止缓存
})
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log('停止监控响应:', data);
if (data.status === 'success') {
// 清理前端状态
cleanupMonitoringState();
// 显示成功消息
showMessage('监控已停止', 'success');
} else {
throw new Error(data.message || '停止监控失败');
}
})
.catch(error => {
console.error('停止监控失败:', error);
showMessage(error.message || '停止监控请求失败', 'error');
// 恢复按钮状态
stopBtn.disabled = false;
stopBtn.textContent = '停止监控';
});
});
}
// 初始状态设置
stopBtn.disabled = true; // 初始状态下停止按钮禁用
console.log('初始化完成');
// 为每个监控按钮添加点击事件
monitorButtons.forEach(button => {
button.addEventListener('click', function() {
const pid = pidInput.value.trim();
const type = this.dataset.type; // 从按钮的 data-type 属性获取类型
if (!pid) {
alert('请输入进程ID');
return;
}
// 保存当前选择的监控类型
currentMonitorType = type;
console.log('设置监控类型为:', currentMonitorType);
fetch(`/monitor/start/?pid=${pid}&type=${type}`)
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
startMonitoring(pid);
// 禁用所有监控按钮
monitorButtons.forEach(btn => btn.disabled = true);
stopBtn.disabled = false;
pidInput.disabled = true;
} else {
alert(data.message);
}
})
.catch(error => {
console.error('启动监控失败:', error);
alert('启动监控失败');
});
});
});
// 获取自动检测按钮
const startAutoDetectBtn = document.getElementById('startAutoDetectBtn');
const stopAutoDetectBtn = document.getElementById('stopAutoDetectBtn');
// 获取CSRF Token
function getCSRFToken() {
const name = 'csrftoken';
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
// 添加自动检测开始按钮事件
startAutoDetectBtn.addEventListener('click', function() {
fetch('/auto_detect/', {
method: 'POST',
headers: {
'X-CSRFToken': getCSRFToken(),
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
alert('已开始自动检测高资源进程');
startAutoDetectBtn.disabled = true;
stopAutoDetectBtn.disabled = false;
} else {
alert(data.message);
}
})
.catch(error => {
console.error('启动自动检测失败:', error);
alert('启动自动检测失败');
});
});
// 添加自动检测停止按钮事件
stopAutoDetectBtn.addEventListener('click', function() {
fetch('/stop_auto_detect/', {
method: 'POST',
headers: {
'X-CSRFToken': getCSRFToken(),
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
alert('已停止自动检测');
startAutoDetectBtn.disabled = false;
stopAutoDetectBtn.disabled = true;
} else {
alert(data.message);
}
})
.catch(error => {
console.error('停止自动检测失败:', error);
alert('停止自动检测失败');
});
});
});
// 更新 UI 的函数
function updateUI(data, type) {
// 根据监控类型更新对应的表格
if (type === 'all' || type === 'cpu') {
document.getElementById('cpuTable').innerHTML = `
<tr><td>使用率</td><td>${data.cpu.usage}</td></tr>
<tr><td>用户态时间</td><td>${data.cpu.user_time}</td></tr>
<tr><td>内核态时间</td><td>${data.cpu.system_time}</td></tr>
<tr><td>CPU核心数</td><td>${data.cpu.cores}</td></tr>
<tr><td>CPU频率</td><td>${data.cpu.frequency}</td></tr>
<tr><td>上下文切换</td><td>${data.cpu.context_switches}</td></tr>
`;
document.getElementById('cpuStatus').className = 'badge bg-success status-badge';
document.getElementById('cpuStatus').textContent = '监控中';
}
if (type === 'all' || type === 'memory') {
document.getElementById('memoryTable').innerHTML = `
<tr><td>物理内存</td><td>${data.memory.physical}</td></tr>
<tr><td>虚拟内存</td><td>${data.memory.virtual}</td></tr>
<tr><td>内存映射</td><td>${data.memory.mappings}</td></tr>
<tr><td>系统内存使用</td><td>${data.memory.system_usage}</td></tr>
<tr><td>交换空间使用</td><td>${data.memory.swap_usage}</td></tr>
`;
document.getElementById('memoryStatus').className = 'badge bg-success status-badge';
document.getElementById('memoryStatus').textContent = '监控中';
}
if (type === 'all' || type === 'gpu') {
document.getElementById('gpuTable').innerHTML = `
<tr><td>使用率</td><td>${data.gpu.usage}</td></tr>
<tr><td>显存使用</td><td>${data.gpu.memory}</td></tr>
`;
document.getElementById('gpuStatus').className = 'badge bg-success status-badge';
document.getElementById('gpuStatus').textContent = '监控中';
}
// 更新最后更新时间
document.getElementById('lastUpdate').textContent =
`最后更新: ${data.timestamp}`;
}
// 添加错误处理函数
function handleError(error, message) {
console.error(message, error);
['cpu', 'gpu', 'memory'].forEach(type => {
const statusElement = document.getElementById(`${type}Status`);
if (statusElement) {
statusElement.className = 'badge bg-danger status-badge';
statusElement.textContent = '错误';
}
});
alert(message);
}
// 窗口大小改变时调整图表大小
window.addEventListener('resize', function() {
if (cpuChart) cpuChart.resize();
if (memoryChart) memoryChart.resize();
if (gpuChart) gpuChart.resize();
});
// 更新进程详细信息的函数
function updateProcessDetails(process) {
if (!process) return;
// 检查元素是否存在
const basicInfo = document.getElementById('basicInfo');
const resourceInfo = document.getElementById('resourceInfo');
if (!basicInfo || !resourceInfo) {
console.error('找不到详情显示元素');
return;
}
try {
// 更新基本信息
basicInfo.innerHTML = `
<dl class="row mb-0">
<dt class="col-sm-4">PID</dt>
<dd class="col-sm-8">${process.pid}</dd>
<dt class="col-sm-4">进程名</dt>
<dd class="col-sm-8">${process.name}</dd>
<dt class="col-sm-4">命令行</dt>
<dd class="col-sm-8"><small class="text-muted">${process.command_line}</small></dd>
<dt class="col-sm-4">工作目录</dt>
<dd class="col-sm-8"><small class="text-muted">${process.working_directory}</small></dd>
<dt class="col-sm-4">创建时间</dt>
<dd class="col-sm-8">${process.create_time}</dd>
</dl>
`;
// 更新资源信息
resourceInfo.innerHTML = `
<dl class="row mb-0">
<dt class="col-sm-4">CPU使用率</dt>
<dd class="col-sm-8">${process.cpu_usage.toFixed(2)}%</dd>
<dt class="col-sm-4">内存使用</dt>
<dd class="col-sm-8">${process.memory_usage.toFixed(2)} MB</dd>
<dt class="col-sm-4">线程数</dt>
<dd class="col-sm-8">${process.threads}</dd>
<dt class="col-sm-4">GPU使用率</dt>
<dd class="col-sm-8">${process.gpu_info.usage}%</dd>
<dt class="col-sm-4">GPU内存</dt>
<dd class="col-sm-8">${process.gpu_info.memory.toFixed(2)} MB</dd>
</dl>
`;
} catch (error) {
console.error('更新进程详情失败:', error);
}
}
// 修改定期更新函数
function startPeriodicUpdate(directory) {
console.log('开始定期更新, 目录:', directory);
if (updateInterval) {
clearInterval(updateInterval);
}
// 立即执行一次更新
getProcessDetails(directory);
// 设置定时更新
updateInterval = setInterval(() => {
getProcessDetails(directory);
}, 5000);
}
// 修改获取进程详情的函数
function getProcessDetails(directory) {
if (!directory || !currentDirectory) { // 添加currentDirectory检查
console.log('没有目录或已停止监控');
return;
}
// 使用 AbortController 来控制fetch请求
if (window.currentFetch) {
window.currentFetch.abort();
}
window.currentFetch = new AbortController();
fetch(`/monitor/directory-status/?directory=${encodeURIComponent(directory)}`, {
signal: window.currentFetch.signal
})
.then(response => response.json())
.then(data => {
if (!currentDirectory) { // 再次检查是否已停止监控
console.log('监控已停止,不更新数据');
return;
}
console.log('收到进程数据:', data);
if (data.status === 'success' && data.processes && data.processes.length > 0) {
updateProcessTable(data.processes);
if (selectedPid) {
const selectedProcess = data.processes.find(p => p.pid.toString() === selectedPid);
if (selectedProcess) {
updateCharts(selectedProcess);
updateProcessDetails(selectedProcess);
}
}
}
})
.catch(error => {
if (error.name === 'AbortError') {
console.log('请求被中止');
} else {
console.error('获取进程详情失败:', error);
}
});
}
// 获取所有正在监控的进程ID
function getAllMonitoredPids() {
const table = document.getElementById('processTable');
if (!table) return [];
const pids = [];
const rows = table.getElementsByTagName('tr');
for (let row of rows) {
const firstCell = row.cells[0];
if (firstCell && !isNaN(firstCell.textContent)) {
pids.push(firstCell.textContent);
}
}
return pids;
}
// 修改清理监控状态的函数
function cleanupMonitoringState() {
console.log('清理监控状态');
// 先取消所有正在进行的请求
if (window.currentFetch) {
window.currentFetch.abort();
window.currentFetch = null;
}
// 清除定时器
if (updateInterval) {
clearInterval(updateInterval);
updateInterval = null;
}
// 清除状态变量(在清理完其他内容后再清除)
const oldDirectory = currentDirectory;
currentDirectory = null;
selectedPid = null;
console.log('已清除的目录:', oldDirectory);
// 清空图表
clearCharts();
// 清空进程列表
const processTable = document.getElementById('processTable');
if (processTable) {
processTable.innerHTML = `
<tr>
<td colspan="8" class="text-center">未开始监控</td>
</tr>
`;
}
// 清空详细信息
const basicInfo = document.getElementById('basicInfo');
const resourceInfo = document.getElementById('resourceInfo');
if (basicInfo) {
basicInfo.innerHTML = '<p class="text-center text-muted">未选择进程</p>';
}
if (resourceInfo) {
resourceInfo.innerHTML = '<p class="text-center text-muted">未选择进程</p>';
}
// 更新按钮状态
const startBtn = document.getElementById('startDirectoryMonitor');
const stopBtn = document.getElementById('stopDirectoryMonitor');
if (startBtn) startBtn.disabled = false;
if (stopBtn) {
stopBtn.disabled = true;
stopBtn.textContent = '停止监控';
}
}
// 添加显示消息的函数
function showMessage(message, type = 'info') {
const statusDiv = document.getElementById('directoryMonitorStatus');
if (statusDiv) {
statusDiv.style.display = 'block';
statusDiv.className = `alert alert-${type}`;
statusDiv.textContent = message;
// 3秒后自动隐藏
setTimeout(() => {
statusDiv.style.display = 'none';
}, 3000);
}
}

View File

@ -0,0 +1,176 @@
{% load static %}
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>高资源进程列表</title>
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<style>
.resource-table {
font-size: 0.9rem;
}
.process-row:hover {
background-color: #f8f9fa;
}
.threshold-warning {
color: #ffc107;
}
.threshold-danger {
color: #dc3545;
}
.status-active {
color: #28a745;
}
.status-inactive {
color: #dc3545;
}
</style>
</head>
<body>
<div class="container mt-4">
<h2 class="mb-4">高资源进程列表</h2>
<!-- 资源类型切换按钮 -->
<div class="btn-group mb-4" role="group">
<button type="button" class="btn btn-primary active" data-type="cpu">CPU</button>
<button type="button" class="btn btn-success" data-type="memory">内存</button>
<button type="button" class="btn btn-warning" data-type="gpu">GPU</button>
</div>
<!-- CPU进程表格 -->
<div id="cpuTable" class="resource-table">
<h4>CPU密集型进程</h4>
<table class="table table-hover">
<thead>
<tr>
<th>PID</th>
<th>进程名</th>
<th>CPU使用率</th>
<th>状态</th>
<th>最后更新时间</th>
</tr>
</thead>
<tbody>
{% for process in cpu_processes %}
<tr class="process-row">
<td>{{ process.pid }}</td>
<td>{{ process.process_name }}</td>
<td>{{ process.cpu_usage }}%</td>
<td>
<span class="{% if process.is_active %}status-active{% else %}status-inactive{% endif %}">
{{ process.get_status_display }}
</span>
</td>
<td>{{ process.updated_at|date:"Y-m-d H:i:s" }}</td>
</tr>
{% empty %}
<tr>
<td colspan="5" class="text-center">暂无数据</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- 内存进程表格 -->
<div id="memoryTable" class="resource-table" style="display: none;">
<h4>内存密集型进程</h4>
<table class="table table-hover">
<thead>
<tr>
<th>PID</th>
<th>进程名</th>
<th>内存使用</th>
<th>内存占用率</th>
<th>状态</th>
<th>最后更新时间</th>
</tr>
</thead>
<tbody>
{% for process in memory_processes %}
<tr class="process-row">
<td>{{ process.pid }}</td>
<td>{{ process.process_name }}</td>
<td>{{ process.memory_usage }}MB</td>
<td>{{ process.memory_percent }}%</td>
<td>
<span class="{% if process.is_active %}status-active{% else %}status-inactive{% endif %}">
{{ process.get_status_display }}
</span>
</td>
<td>{{ process.updated_at|date:"Y-m-d H:i:s" }}</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="text-center">暂无数据</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- GPU进程表格 -->
<div id="gpuTable" class="resource-table" style="display: none;">
<h4>GPU密集型进程</h4>
<table class="table table-hover">
<thead>
<tr>
<th>PID</th>
<th>进程名</th>
<th>GPU使用率</th>
<th>显存使用</th>
<th>状态</th>
<th>最后更新时间</th>
</tr>
</thead>
<tbody>
{% for process in gpu_processes %}
<tr class="process-row">
<td>{{ process.pid }}</td>
<td>{{ process.process_name }}</td>
<td>{{ process.gpu_usage }}%</td>
<td>{{ process.gpu_memory }}MB</td>
<td>
<span class="{% if process.is_active %}status-active{% else %}status-inactive{% endif %}">
{{ process.get_status_display }}
</span>
</td>
<td>{{ process.updated_at|date:"Y-m-d H:i:s" }}</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="text-center">暂无数据</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
// 切换资源类型显示
document.querySelectorAll('.btn-group button').forEach(button => {
button.addEventListener('click', function() {
// 更新按钮状态
document.querySelectorAll('.btn-group button').forEach(btn => {
btn.classList.remove('active');
});
this.classList.add('active');
// 隐藏所有表格
document.querySelectorAll('.resource-table').forEach(table => {
table.style.display = 'none';
});
// 显示选中的表格
const type = this.getAttribute('data-type');
document.getElementById(`${type}Table`).style.display = 'block';
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,298 @@
{% load static %}
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>进程监控</title>
<link rel="icon" type="image/x-icon" href="{% static 'img/favicon.ico' %}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
<script>
console.log('页面开始加载');
</script>
<style>
.status-badge {
width: 80px;
text-align: center;
}
.resource-table {
font-size: 0.9rem;
}
.monitor-card {
margin-bottom: 20px;
}
.btn-group-sm > .btn {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
}
.alert {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
display: none;
}
.process-row:hover {
background-color: #f8f9fa;
}
.resource-value {
font-weight: bold;
}
.threshold-warning {
color: #ffc107;
}
.threshold-danger {
color: #dc3545;
}
</style>
</head>
<body>
{% csrf_token %}
<div class="container mt-4">
<!-- 在控制面板上方添加导航链接 -->
<div class="row mb-4">
<div class="col-12">
<a href="{% url 'high_resource_list' %}" class="btn btn-info">
查看高资源进程列表
</a>
</div>
</div>
<!-- 添加自动检测控制按钮 -->
<div class="row mb-4">
<div class="col-12">
<button id="startAutoDetectBtn" class="btn btn-warning">
开始自动检测高资源进程
</button>
<button id="stopAutoDetectBtn" class="btn btn-danger" disabled>
停止自动检测
</button>
</div>
</div>
<!-- 控制面板 -->
<div class="row mb-4">
<div class="col-md-6">
<div class="input-group">
<input type="text" class="form-control" id="pidInput" placeholder="输入进程ID">
<button class="btn btn-primary" data-type="cpu">监控CPU</button>
<button class="btn btn-success" data-type="memory">监控内存</button>
<button class="btn btn-warning" data-type="gpu">监控GPU</button>
<button class="btn btn-danger" id="stopMonitor">停止监控</button>
</div>
</div>
</div>
<!-- 监控数据显示 -->
<div class="row">
<!-- CPU监控卡片 -->
<div class="col-md-4">
<div class="card monitor-card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">CPU监控</h5>
<span id="cpuStatus" class="badge bg-secondary status-badge">未监控</span>
</div>
<div class="card-body">
<table class="table table-sm resource-table">
<thead>
<tr>
<th>指标</th>
<th></th>
</tr>
</thead>
<tbody id="cpuTable">
<tr>
<td colspan="2" class="text-center">暂无数据</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- GPU监控卡片 -->
<div class="col-md-4">
<div class="card monitor-card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">GPU监控</h5>
<span id="gpuStatus" class="badge bg-secondary status-badge">未监控</span>
</div>
<div class="card-body">
<table class="table table-sm resource-table">
<thead>
<tr>
<th>指标</th>
<th></th>
</tr>
</thead>
<tbody id="gpuTable">
<tr>
<td colspan="2" class="text-center">暂无数据</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 内存监控卡片 -->
<div class="col-md-4">
<div class="card monitor-card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">内存监控</h5>
<span id="memoryStatus" class="badge bg-secondary status-badge">未监控</span>
</div>
<div class="card-body">
<table class="table table-sm resource-table">
<thead>
<tr>
<th>指标</th>
<th></th>
</tr>
</thead>
<tbody id="memoryTable">
<tr>
<td colspan="2" class="text-center">暂无数据</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- 目录监控部分 -->
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title mb-0">目录监控</h5>
</div>
<div class="card-body">
<div class="row g-3">
<div class="col-md-8">
<input type="text" class="form-control" id="directoryInput"
placeholder="输入要监控的目录路径">
</div>
<div class="col-md-4">
<button class="btn btn-primary me-2" id="startDirectoryMonitor">开始监控</button>
<button class="btn btn-danger" id="stopDirectoryMonitor" disabled>停止监控</button>
</div>
</div>
<div id="directoryMonitorStatus" class="alert mt-3" style="display: none;"></div>
</div>
</div>
<!-- 进程列表 -->
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title mb-0">进程列表</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>PID</th>
<th>进程信息</th>
<th>CPU</th>
<th>内存</th>
<th>IO</th>
<th>线程</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody id="processTable">
<tr>
<td colspan="8" class="text-center">等待数据加载...</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- 图表展示 -->
<div class="row">
<div class="col-md-4">
<div class="card mb-4">
<div class="card-header">CPU使用率</div>
<div class="card-body">
<div id="cpuChart" style="height: 300px;"></div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mb-4">
<div class="card-header">内存使用量</div>
<div class="card-body">
<div id="memoryChart" style="height: 300px;"></div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mb-4">
<div class="card-header">GPU使用率</div>
<div class="card-body">
<div id="gpuChart" style="height: 300px;"></div>
</div>
</div>
</div>
</div>
<!-- 进程详细信息 -->
<div class="row">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title mb-0">基本信息</h5>
</div>
<div class="card-body" id="basicInfo">
<p class="text-center text-muted">选择进程查看详细信息</p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title mb-0">资源使用</h5>
</div>
<div class="card-body" id="resourceInfo">
<p class="text-center text-muted">选择进程查看详细信息</p>
</div>
</div>
</div>
</div>
<!-- 最后更新时间 -->
<div class="row mt-3">
<div class="col-12">
<p id="lastUpdate" class="text-muted text-end">最后更新: -</p>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
console.log('准备加载 monitor.js');
</script>
<script src="{% static 'js/monitor.js' %}?v={{ STATIC_VERSION }}"></script>
<script>
console.log('monitor.js 加载完成后');
// 添加直接的事件绑定测试
window.onload = function() {
console.log('window loaded');
const startBtn = document.getElementById('startDirectoryMonitor');
if (startBtn) {
console.log('找到开始按钮');
startBtn.onclick = function() {
console.log('按钮被点击');
}
} else {
console.error('未找到开始按钮');
}
}
</script>
</body>
</html>

View File

@ -2,8 +2,17 @@ from django.urls import path
from . import views
urlpatterns = [
path('start_monitor/', views.start_monitor, name='start_monitor'),
path('stop_monitor/<int:pid>/', views.stop_monitor, name='stop_monitor'),
path('metrics/<int:pid>/', views.get_process_metrics, name='get_process_metrics'),
path('auto_detect/', views.auto_detect_monitor, name='auto_detect_monitor'),
path('', views.index, name='index'),
path('api/process/<int:pid>/status/', views.get_process_status, name='get_process_status'),
path('monitor/start/', views.start_monitor, name='start_monitor'),
path('monitor/stop/', views.stop_monitor, name='stop_monitor'),
path('auto_detect/', views.auto_detect_high_resource_processes, name='auto_detect'),
path('stop_auto_detect/', views.stop_auto_detect, name='stop_auto_detect'),
path('high-resource/', views.high_resource_list, name='high_resource_list'),
path('scan-directory/', views.scan_directory, name='scan_directory'),
path('start/', views.start_monitor, name='start_monitor'),
path('stop/', views.stop_monitor, name='stop_monitor'),
path('status/<int:pid>/', views.get_process_status, name='get_process_status'),
path('stop-directory-monitor/', views.stop_directory_monitor, name='stop_directory_monitor'),
path('directory-status/', views.get_directory_status, name='directory_status'),
]

File diff suppressed because it is too large Load Diff

18
test_program/main.py Normal file
View File

@ -0,0 +1,18 @@
import time
import os
def light_task():
"""轻量级任务"""
count = 0
while True:
# 简单的计数和休眠
count += 1
print(f"运行次数: {count}, PID: {os.getpid()}")
time.sleep(2) # 每2秒执行一次
if __name__ == "__main__":
print(f"程序启动PID: {os.getpid()}")
try:
light_task()
except KeyboardInterrupt:
print("程序已停止")