Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
taskbus
提交
2019aaeb
taskbus
项目概览
colorEagleStdio
/
taskbus
通知
162
Star
11
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
taskbus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2019aaeb
编写于
4月 24, 2022
作者:
M
manjaro-xfce
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化Linux进程优先级设置
上级
9354a00e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
15 deletion
+41
-15
taskbusplatform/core/process_prctl.cpp
taskbusplatform/core/process_prctl.cpp
+7
-6
taskbusplatform/core/process_prctl.h
taskbusplatform/core/process_prctl.h
+5
-2
taskbusplatform/gui/pdesignerview.cpp
taskbusplatform/gui/pdesignerview.cpp
+29
-7
未找到文件。
taskbusplatform/core/process_prctl.cpp
浏览文件 @
2019aaeb
...
...
@@ -18,14 +18,15 @@
namespace
TASKBUS
{
#ifdef WIN32
const
int
pnice_
min
=
0
;
const
int
pnice_
max
=
5
;
const
int
pnice_
idle
=
0
;
const
int
pnice_
realtime
=
5
;
const
int
pnice_norm
=
2
;
#endif
#ifdef linux
const
int
pnice_min
=
PRIO_MIN
;
const
int
pnice_max
=
PRIO_MAX
;
//in Linux, nice = -20 means realtime
const
int
pnice_idle
=
PRIO_MAX
;
const
int
pnice_realtime
=
PRIO_MIN
;
const
int
pnice_norm
=
0
;
#endif
...
...
@@ -56,7 +57,7 @@ namespace TASKBUS {
#ifdef linux
__PID_T_TYPE
id
=
p
->
processId
();
if
(
nice
<
-
PRIO_MIN
)
nice
=
PRIO_MIN
;
if
(
nice
<
PRIO_MIN
)
nice
=
PRIO_MIN
;
if
(
nice
>
PRIO_MAX
)
nice
=
PRIO_MAX
;
setpriority
(
PRIO_PROCESS
,
id
,
nice
);
#endif
...
...
@@ -82,7 +83,7 @@ namespace TASKBUS {
#ifdef linux
__PID_T_TYPE
id
=
getpid
();
if
(
nice
<
-
PRIO_MIN
)
nice
=
PRIO_MIN
;
if
(
nice
<
PRIO_MIN
)
nice
=
PRIO_MIN
;
if
(
nice
>
PRIO_MAX
)
nice
=
PRIO_MAX
;
setpriority
(
PRIO_PROCESS
,
id
,
nice
);
#endif
...
...
taskbusplatform/core/process_prctl.h
浏览文件 @
2019aaeb
...
...
@@ -22,8 +22,11 @@ namespace TASKBUS {
bool
get_memory
(
qint64
p
,
tagMemoryInfo
*
info
);
extern
const
int
pnice_min
;
extern
const
int
pnice_max
;
//Idle Nice
extern
const
int
pnice_idle
;
//Busy Nice
extern
const
int
pnice_realtime
;
//Normal Nice
extern
const
int
pnice_norm
;
}
...
...
taskbusplatform/gui/pdesignerview.cpp
浏览文件 @
2019aaeb
...
...
@@ -772,9 +772,19 @@ void PDesignerView::on_actionNiceUp_triggered()
if
(
node
>=
0
&&
node
<
sz
)
{
int
nic
=
project
()
->
get_nice
(
node
);
++
nic
;
if
(
nic
>
TASKBUS
::
pnice_max
)
nic
=
TASKBUS
::
pnice_max
;
if
(
TASKBUS
::
pnice_realtime
<
TASKBUS
::
pnice_idle
)
{
--
nic
;
if
(
nic
<
TASKBUS
::
pnice_realtime
)
nic
=
TASKBUS
::
pnice_realtime
;
}
else
{
++
nic
;
if
(
nic
>
TASKBUS
::
pnice_realtime
)
nic
=
TASKBUS
::
pnice_realtime
;
}
project
()
->
set_nice
(
node
,
nic
);
}
ui
->
graphicsView_main
->
scale
(
0.5
,
1
);
...
...
@@ -789,10 +799,22 @@ void PDesignerView::on_actionNiceDown_triggered()
if
(
node
>=
0
&&
node
<
sz
)
{
int
nic
=
project
()
->
get_nice
(
node
);
--
nic
;
if
(
nic
<
TASKBUS
::
pnice_min
)
nic
=
TASKBUS
::
pnice_min
;
project
()
->
set_nice
(
node
,
nic
);
if
(
TASKBUS
::
pnice_realtime
<
TASKBUS
::
pnice_idle
)
{
++
nic
;
if
(
nic
>
TASKBUS
::
pnice_idle
)
nic
=
TASKBUS
::
pnice_idle
;
project
()
->
set_nice
(
node
,
nic
);
}
else
{
--
nic
;
if
(
nic
<
TASKBUS
::
pnice_idle
)
nic
=
TASKBUS
::
pnice_idle
;
project
()
->
set_nice
(
node
,
nic
);
}
}
ui
->
graphicsView_main
->
scale
(
0.5
,
1
);
ui
->
graphicsView_main
->
scale
(
2
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录