7 Star 0 Fork 18

src-openEuler/irqbalance

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
feature-add-the-switch-of-printing-log.patch 3.58 KB
一键复制 编辑 原始数据 按行查看 历史
SuperSix173 提交于 2021-04-17 17:14 . upgrade to v1.8.0
From b697a97436dafa13f0ae3febde299bfc20498f9d Mon Sep 17 00:00:00 2001
From: liuchao <[email protected]>
Date: Wed, 23 Oct 2019 11:42:26 +0000
Subject: [PATCH] feature: add the switch of printing log
add the switch of printing log
---
cputree.c | 16 ++++++++--------
irqbalance.c | 11 ++++++++++-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/cputree.c b/cputree.c
index 010e672..48d3d0d 100644
--- a/cputree.c
+++ b/cputree.c
@@ -399,23 +399,23 @@ static void dump_irq(struct irq_info *info, void *data)
indent[i] = log_indent[0];
indent[i] = '\0';
- log(TO_CONSOLE, LOG_INFO, "%sInterrupt %i node_num is %d (%s/%" PRIu64 ":%" PRIu64 ") \n", indent,
+ log(TO_ALL, LOG_INFO, "%sInterrupt %i node_num is %d (%s/%" PRIu64 ":%" PRIu64 ") \n", indent,
info->irq, irq_numa_node(info)->number, classes[info->class], info->load, (info->irq_count - info->last_irq_count));
free(indent);
}
static void dump_numa_node_num(struct topo_obj *p, void *data __attribute__((unused)))
{
- log(TO_CONSOLE, LOG_INFO, "%d ", p->number);
+ log(TO_ALL, LOG_INFO, "%d ", p->number);
}
static void dump_balance_obj(struct topo_obj *d, void *data __attribute__((unused)))
{
struct topo_obj *c = (struct topo_obj *)d;
- log(TO_CONSOLE, LOG_INFO, "%s%s%s%sCPU number %i numa_node is ",
+ log(TO_ALL, LOG_INFO, "%s%s%s%sCPU number %i numa_node is ",
log_indent, log_indent, log_indent, log_indent, c->number);
for_each_object(cpu_numa_node(c), dump_numa_node_num, NULL);
- log(TO_CONSOLE, LOG_INFO, "(load %lu)\n", (unsigned long)c->load);
+ log(TO_ALL, LOG_INFO, "(load %lu)\n", (unsigned long)c->load);
if (c->interrupts)
for_each_irq(c->interrupts, dump_irq, (void *)18);
}
@@ -424,10 +424,10 @@ static void dump_cache_domain(struct topo_obj *d, void *data)
{
char *buffer = data;
cpumask_scnprintf(buffer, 4095, d->mask);
- log(TO_CONSOLE, LOG_INFO, "%s%sCache domain %i: numa_node is ",
+ log(TO_ALL, LOG_INFO, "%s%sCache domain %i: numa_node is ",
log_indent, log_indent, d->number);
for_each_object(d->numa_nodes, dump_numa_node_num, NULL);
- log(TO_CONSOLE, LOG_INFO, "cpu mask is %s (load %lu) \n", buffer,
+ log(TO_ALL, LOG_INFO, "cpu mask is %s (load %lu) \n", buffer,
(unsigned long)d->load);
if (d->children)
for_each_object(d->children, dump_balance_obj, NULL);
@@ -439,9 +439,9 @@ static void dump_package(struct topo_obj *d, void *data)
{
char *buffer = data;
cpumask_scnprintf(buffer, 4096, d->mask);
- log(TO_CONSOLE, LOG_INFO, "Package %i: numa_node ", d->number);
+ log(TO_ALL, LOG_INFO, "Package %i: numa_node ", d->number);
for_each_object(d->numa_nodes, dump_numa_node_num, NULL);
- log(TO_CONSOLE, LOG_INFO, "cpu mask is %s (load %lu)\n",
+ log(TO_ALL, LOG_INFO, "cpu mask is %s (load %lu)\n",
buffer, (unsigned long)d->load);
if (d->children)
for_each_object(d->children, dump_cache_domain, buffer);
diff --git a/irqbalance.c b/irqbalance.c
index ecc3eca..450a1ff 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -266,6 +266,15 @@ gboolean force_rescan(gpointer data __attribute__((unused)))
return TRUE;
}
+static int check_debug()
+{
+ int ret = 0;
+
+ process_one_line("/etc/sysconfig/irqbalance_debug", get_int, &ret);
+
+ return ret;
+}
+
gboolean scan(gpointer data __attribute__((unused)))
{
log(TO_CONSOLE, LOG_INFO, "\n\n\n-----------------------------------------------------------------------------\n");
@@ -310,7 +319,7 @@ gboolean scan(gpointer data __attribute__((unused)))
activate_mappings();
out:
- if (debug_mode)
+ if (debug_mode || check_debug())
dump_tree();
if (one_shot_mode)
keep_going = 0;
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/irqbalance.git
[email protected]:src-openeuler/irqbalance.git
src-openeuler
irqbalance
irqbalance
master

搜索帮助