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;
RpcConnection *conn = new RpcConnection(socketDescriptor, service);
thread->setObjectName("RPC");
conn->moveToThread(thread);
connect(thread, SIGNAL(started()), conn, SLOT(start()));

View File

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

View File

@ -316,6 +316,7 @@ void LinuxPort::populateInterfaceInfo()
LinuxPort::StatsMonitor::StatsMonitor()
: QThread()
{
setObjectName("StatsMon");
stop_ = false;
setupDone_ = false;
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] = "";
bool noLocalCapture;
setObjectName(QString("Mon%1:%2")
.arg(direction == kDirectionRx ? "Rx" : "Tx")
.arg(device));
direction_ = direction;
isDirectional_ = true;
isPromisc_ = true;
@ -354,6 +357,7 @@ void PcapPort::PortMonitor::stop()
PcapPort::PortCapturer::PortCapturer(const char *device)
{
device_ = QString::fromLatin1(device);
setObjectName(QString("Capture:%1").arg(device_));
stop_ = false;
state_ = kNotStarted;
@ -507,6 +511,7 @@ PcapPort::EmulationTransceiver::EmulationTransceiver(const char *device,
DeviceManager *deviceManager)
{
device_ = QString::fromLatin1(device);
setObjectName(QString("EmulXcvr:%1").arg(device_));
deviceManager_ = deviceManager;
stop_ = false;
state_ = kNotStarted;

View File

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

View File

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