Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set compression threads priority #1457

Merged
merged 10 commits into from
Dec 16, 2023
Prev Previous commit
Next Next commit
Address grammar in log messages
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
  • Loading branch information
morlov-apexai authored and Janosch Machowinski committed Dec 12, 2023
commit 3cc1b5b76d21f0af61b7a38302bb699b5bf78076
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ void SequentialCompressionWriter::compression_thread_fn()
int wanted_thread_priority = *compression_options_.thread_priority;
if (!SetThreadPriority(GetCurrentThread(), wanted_thread_priority)) {
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
"Could not set thread priority of compression thread to the: " << wanted_thread_priority <<
"Could not set thread priority of compression thread to: " << wanted_thread_priority <<
". Error code: " << GetLastError());
} else {
auto detected_thread_priority = GetThreadPriority(GetCurrentThread());
@@ -84,7 +84,7 @@ void SequentialCompressionWriter::compression_thread_fn()
"Failed to get current thread priority. Error code: " << GetLastError());
} else if (wanted_thread_priority != detected_thread_priority) {
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
"Could not set thread priority of compression thread to the: " <<
"Could not set thread priority of compression thread to: " <<
wanted_thread_priority << ". Detected thread priority: " << detected_thread_priority);
}
}
@@ -95,13 +95,13 @@ void SequentialCompressionWriter::compression_thread_fn()
int cur_nice_value = getpriority(PRIO_PROCESS, 0);
if (cur_nice_value == -1 && errno != 0) {
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
"Could not set nice value of compression thread to the: " << wanted_nice_value <<
"Could not set nice value of compression thread to: " << wanted_nice_value <<
" : Could not determine cur nice value");
} else {
int new_nice_value = nice(wanted_nice_value - cur_nice_value);
if ((new_nice_value == -1 && errno != 0)) {
ROSBAG2_COMPRESSION_LOG_WARN_STREAM(
"Could not set nice value of compression thread to the: " << wanted_nice_value <<
"Could not set nice value of compression thread to: " << wanted_nice_value <<
". Error : " << std::strerror(errno));
}
}