diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-17 14:24:56 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-06-17 14:24:56 +0200 |
commit | 5950cd21ae4ad1b9ddc98a6f1c8716e1627ebbd2 (patch) | |
tree | 617d2af1c25f71fb3511639430a20848c9d8dace | |
parent | e48df9cb5ec9e48cd836ec227127f42c5cc99aa1 (diff) | |
download | dabmod-5950cd21ae4ad1b9ddc98a6f1c8716e1627ebbd2.tar.gz dabmod-5950cd21ae4ad1b9ddc98a6f1c8716e1627ebbd2.tar.bz2 dabmod-5950cd21ae4ad1b9ddc98a6f1c8716e1627ebbd2.zip |
Set custom names to threads
-rw-r--r-- | src/DabMod.cpp | 1 | ||||
-rw-r--r-- | src/FIRFilter.cpp | 1 | ||||
-rw-r--r-- | src/InputZeroMQReader.cpp | 2 | ||||
-rw-r--r-- | src/Log.cpp | 1 | ||||
-rw-r--r-- | src/OutputUHD.cpp | 2 | ||||
-rw-r--r-- | src/RemoteControl.cpp | 3 | ||||
-rw-r--r-- | src/Utils.cpp | 7 | ||||
-rw-r--r-- | src/Utils.h | 2 |
8 files changed, 19 insertions, 0 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp index b5e3568..6f35e22 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -755,6 +755,7 @@ int launch_modulator(int argc, char* argv[]) if (int r = set_realtime_prio(1)) { etiLog.level(error) << "Could not set priority for modulator:" << r; } + set_thread_name("modulator"); while (run_again) { Flowgraph flowgraph; diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp index ebd4518..77e2305 100644 --- a/src/FIRFilter.cpp +++ b/src/FIRFilter.cpp @@ -57,6 +57,7 @@ void FIRFilterWorker::process(struct FIRFilterWorkerData *fwd) struct timespec time_end; set_realtime_prio(1); + set_thread_name("firfilter"); // This thread creates the dataOut buffer, and deletes // the incoming buffer diff --git a/src/InputZeroMQReader.cpp b/src/InputZeroMQReader.cpp index 96e3223..763c77c 100644 --- a/src/InputZeroMQReader.cpp +++ b/src/InputZeroMQReader.cpp @@ -40,6 +40,7 @@ #include "porting.h" #include "InputReader.h" #include "PcDebug.h" +#include "Utils.h" #define NUM_FRAMES_PER_ZMQ_MESSAGE 4 /* A concatenation of four ETI frames, @@ -124,6 +125,7 @@ void InputZeroMQReader::PrintInfo() void InputZeroMQWorker::RecvProcess(struct InputZeroMQThreadData* workerdata) { + set_thread_name("zmqinput"); size_t queue_size = 0; bool buffer_full = false; diff --git a/src/Log.cpp b/src/Log.cpp index 7d6d6f5..55a4ebf 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -27,6 +27,7 @@ #include <chrono> #include "Log.h" +#include "Utils.h" using namespace std; diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index dff0fd2..1b84b7c 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -601,6 +601,8 @@ void UHDWorker::process_errhandler() etiLog.level(error) << "Could not set priority for UHD worker:" << ret; } + set_thread_name("uhdworker"); + process(); uwd->running = false; etiLog.level(warn) << "UHD worker terminated"; diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp index fa797ef..3872dc3 100644 --- a/src/RemoteControl.cpp +++ b/src/RemoteControl.cpp @@ -30,6 +30,7 @@ #include <boost/thread.hpp> #include "RemoteControl.h" +#include "Utils.h" using boost::asio::ip::tcp; using namespace std; @@ -58,6 +59,7 @@ void RemoteControllerTelnet::restart_thread(long) void RemoteControllerTelnet::process(long) { + set_thread_name("telnet_rc"); std::string m_welcome = "ODR-DabMod Remote Control CLI\n" "Write 'help' for help.\n" "**********\n"; @@ -298,6 +300,7 @@ void RemoteControllerZmq::send_fail_reply(zmq::socket_t &pSocket, const std::str void RemoteControllerZmq::process() { + set_thread_name("zmq_rc"); // create zmq reply socket for receiving ctrl parameters etiLog.level(info) << "Starting zmq remote control thread"; try { diff --git a/src/Utils.cpp b/src/Utils.cpp index ab1866c..aafd6af 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -27,6 +27,8 @@ #include "Utils.h" #include "GainControl.h" +#include <sys/prctl.h> +#include <pthread.h> void printUsage(char* progName) { @@ -124,3 +126,8 @@ int set_realtime_prio(int prio) return ret; } +void set_thread_name(const char *name) +{ + prctl(PR_SET_NAME,name,0,0,0); +} + diff --git a/src/Utils.h b/src/Utils.h index 7f65fa3..46c46d5 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -60,5 +60,7 @@ inline long timespecdiff_us(struct timespec& oldTime, struct timespec& time) // Set SCHED_RR with priority prio (0=lowest) int set_realtime_prio(int prio); +void set_thread_name(const char *name); + #endif |