Skip to content

Commit 0502736

Browse files
Adjust log levels of /proc/cpuinfo parsing (#209)
There are a few steps in our parsing logic where we skip lines that don't match the expectations of the /proc/cpuinfo node. Reduce the log level of these lines to 'debug', as these are not generally errors and are noisy on systems that have unique cpuinfo key-value pairs. When parsing logic encounters a higher-than-expected processor number, increase the level to warning, to indicate that an error may have occurred in the parsing step. This does not fully address #19 but resolves the underlying noise reported.
1 parent 42bff7a commit 0502736

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/arm/linux/cpuinfo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static bool parse_line(
742742
}
743743
/* Skip line if no ':' separator was found. */
744744
if (separator == line_end) {
745-
cpuinfo_log_info(
745+
cpuinfo_log_debug(
746746
"Line %.*s in /proc/cpuinfo is ignored: key/value separator ':' not found",
747747
(int)(line_end - line_start),
748748
line_start);
@@ -758,7 +758,7 @@ static bool parse_line(
758758
}
759759
/* Skip line if key contains nothing but spaces. */
760760
if (key_end == line_start) {
761-
cpuinfo_log_info(
761+
cpuinfo_log_debug(
762762
"Line %.*s in /proc/cpuinfo is ignored: key contains only spaces",
763763
(int)(line_end - line_start),
764764
line_start);
@@ -774,7 +774,7 @@ static bool parse_line(
774774
}
775775
/* Value part contains nothing but spaces. Skip line. */
776776
if (value_start == line_end) {
777-
cpuinfo_log_info(
777+
cpuinfo_log_debug(
778778
"Line %.*s in /proc/cpuinfo is ignored: value contains only spaces",
779779
(int)(line_end - line_start),
780780
line_start);
@@ -918,7 +918,7 @@ static bool parse_line(
918918
} else if (new_processor_index > processor_index + 1) {
919919
/* Strange, but common: skipped
920920
* processor $(processor_index + 1) */
921-
cpuinfo_log_info(
921+
cpuinfo_log_warning(
922922
"unexpectedly high processor number %" PRIu32
923923
" following processor %" PRIu32 " in /proc/cpuinfo",
924924
new_processor_index,

src/x86/linux/cpuinfo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static bool parse_line(
9999
}
100100
/* Skip line if no ':' separator was found. */
101101
if (separator == line_end) {
102-
cpuinfo_log_info(
102+
cpuinfo_log_debug(
103103
"Line %.*s in /proc/cpuinfo is ignored: key/value separator ':' not found",
104104
(int)(line_end - line_start),
105105
line_start);
@@ -115,7 +115,7 @@ static bool parse_line(
115115
}
116116
/* Skip line if key contains nothing but spaces. */
117117
if (key_end == line_start) {
118-
cpuinfo_log_info(
118+
cpuinfo_log_debug(
119119
"Line %.*s in /proc/cpuinfo is ignored: key contains only spaces",
120120
(int)(line_end - line_start),
121121
line_start);
@@ -131,7 +131,7 @@ static bool parse_line(
131131
}
132132
/* Value part contains nothing but spaces. Skip line. */
133133
if (value_start == line_end) {
134-
cpuinfo_log_info(
134+
cpuinfo_log_debug(
135135
"Line %.*s in /proc/cpuinfo is ignored: value contains only spaces",
136136
(int)(line_end - line_start),
137137
line_start);
@@ -177,7 +177,7 @@ static bool parse_line(
177177
} else if (new_processor_index > processor_index + 1) {
178178
/* Strange, but common: skipped
179179
* processor $(processor_index + 1) */
180-
cpuinfo_log_info(
180+
cpuinfo_log_warning(
181181
"unexpectedly high processor number %" PRIu32
182182
" following processor %" PRIu32 " in /proc/cpuinfo",
183183
new_processor_index,

0 commit comments

Comments
 (0)