Name threads for easier debugging

This commit is contained in:
Srivats P 2020-05-15 18:55:03 +05:30
parent 6f7cbae2dd
commit f7ace4c5c2
6 changed files with 11 additions and 0 deletions

View File

@ -59,6 +59,7 @@ void RpcServer::incomingConnection(qintptr socketDescriptor)
QThread *thread = new QThread; QThread *thread = new QThread;
RpcConnection *conn = new RpcConnection(socketDescriptor, service); RpcConnection *conn = new RpcConnection(socketDescriptor, service);
thread->setObjectName("RPC");
conn->moveToThread(thread); conn->moveToThread(thread);
connect(thread, SIGNAL(started()), conn, SLOT(start())); connect(thread, SIGNAL(started()), conn, SLOT(start()));

View File

@ -301,6 +301,7 @@ void BsdPort::populateInterfaceInfo()
BsdPort::StatsMonitor::StatsMonitor() BsdPort::StatsMonitor::StatsMonitor()
: QThread() : QThread()
{ {
setObjectName("StatsMon");
stop_ = false; stop_ = false;
setupDone_ = false; setupDone_ = false;
} }

View File

@ -316,6 +316,7 @@ void LinuxPort::populateInterfaceInfo()
LinuxPort::StatsMonitor::StatsMonitor() LinuxPort::StatsMonitor::StatsMonitor()
: QThread() : QThread()
{ {
setObjectName("StatsMon");
stop_ = false; stop_ = false;
setupDone_ = false; setupDone_ = false;
ioctlSocket_ = socket(AF_INET, SOCK_DGRAM, 0); ioctlSocket_ = socket(AF_INET, SOCK_DGRAM, 0);

View File

@ -207,6 +207,9 @@ PcapPort::PortMonitor::PortMonitor(const char *device, Direction direction,
char errbuf[PCAP_ERRBUF_SIZE] = ""; char errbuf[PCAP_ERRBUF_SIZE] = "";
bool noLocalCapture; bool noLocalCapture;
setObjectName(QString("Mon%1:%2")
.arg(direction == kDirectionRx ? "Rx" : "Tx")
.arg(device));
direction_ = direction; direction_ = direction;
isDirectional_ = true; isDirectional_ = true;
isPromisc_ = true; isPromisc_ = true;
@ -354,6 +357,7 @@ void PcapPort::PortMonitor::stop()
PcapPort::PortCapturer::PortCapturer(const char *device) PcapPort::PortCapturer::PortCapturer(const char *device)
{ {
device_ = QString::fromLatin1(device); device_ = QString::fromLatin1(device);
setObjectName(QString("Capture:%1").arg(device_));
stop_ = false; stop_ = false;
state_ = kNotStarted; state_ = kNotStarted;
@ -507,6 +511,7 @@ PcapPort::EmulationTransceiver::EmulationTransceiver(const char *device,
DeviceManager *deviceManager) DeviceManager *deviceManager)
{ {
device_ = QString::fromLatin1(device); device_ = QString::fromLatin1(device);
setObjectName(QString("EmulXcvr:%1").arg(device_));
deviceManager_ = deviceManager; deviceManager_ = deviceManager;
stop_ = false; stop_ = false;
state_ = kNotStarted; state_ = kNotStarted;

View File

@ -25,6 +25,7 @@ PcapTransmitter::PcapTransmitter(
: streamStats_(portStreamStats), txThread_(device) : streamStats_(portStreamStats), txThread_(device)
{ {
adjustRxStreamStats_ = false; adjustRxStreamStats_ = false;
txStats_.setObjectName(QString("TxStats:%1").arg(device));
memset(&stats_, 0, sizeof(stats_)); memset(&stats_, 0, sizeof(stats_));
txStats_.setTxThreadStats(&stats_); txStats_.setTxThreadStats(&stats_);
txStats_.start(); // TODO: alongwith user transmit start txStats_.start(); // TODO: alongwith user transmit start

View File

@ -26,6 +26,8 @@ PcapTxThread::PcapTxThread(const char *device)
{ {
char errbuf[PCAP_ERRBUF_SIZE] = ""; char errbuf[PCAP_ERRBUF_SIZE] = "";
setObjectName(QString("Tx:%1").arg(device));
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
LARGE_INTEGER freq; LARGE_INTEGER freq;
if (QueryPerformanceFrequency(&freq)) if (QueryPerformanceFrequency(&freq))