mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Add getter for cmd line args & align channel names in log
This commit is contained in:
parent
8b88e67360
commit
2894af803b
|
@ -24,4 +24,4 @@ SINK+=" --transport shmem"
|
||||||
SINK+=" --channel-config name=data1,type=pull,method=connect,address=tcp://127.0.0.1:5555"
|
SINK+=" --channel-config name=data1,type=pull,method=connect,address=tcp://127.0.0.1:5555"
|
||||||
SINK+=" name=data2,type=pull,method=connect,address=tcp://127.0.0.1:5556,transport=nanomsg"
|
SINK+=" name=data2,type=pull,method=connect,address=tcp://127.0.0.1:5556,transport=nanomsg"
|
||||||
SINK+=" name=ack,type=pub,method=connect,address=tcp://127.0.0.1:5557,transport=zeromq"
|
SINK+=" name=ack,type=pub,method=connect,address=tcp://127.0.0.1:5557,transport=zeromq"
|
||||||
xterm -geometry 80x30+500+0 -hold -e @EX_BIN_DIR@/$SINK &
|
xterm -geometry 80x30+500+225 -hold -e @EX_BIN_DIR@/$SINK &
|
||||||
|
|
|
@ -56,6 +56,8 @@ auto DeviceRunner::Run() -> int
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDevice->SetRawCmdLineArgs(fRawCmdLineArgs);
|
||||||
|
|
||||||
// Handle --print-channels
|
// Handle --print-channels
|
||||||
fDevice->RegisterChannelEndpoints();
|
fDevice->RegisterChannelEndpoints();
|
||||||
if (fConfig.Count("print-channels"))
|
if (fConfig.Count("print-channels"))
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <algorithm> // std::max
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ FairMQDevice::FairMQDevice()
|
||||||
, fVersion({0, 0, 0})
|
, fVersion({0, 0, 0})
|
||||||
, fRate(0.)
|
, fRate(0.)
|
||||||
, fLastTime(0)
|
, fLastTime(0)
|
||||||
|
, fRawCmdLineArgs()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +90,7 @@ FairMQDevice::FairMQDevice(const fair::mq::tools::Version version)
|
||||||
, fVersion(version)
|
, fVersion(version)
|
||||||
, fRate(0.)
|
, fRate(0.)
|
||||||
, fLastTime(0)
|
, fLastTime(0)
|
||||||
|
, fRawCmdLineArgs()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,6 +873,8 @@ void FairMQDevice::LogSocketRates()
|
||||||
vector<int> logIntervals;
|
vector<int> logIntervals;
|
||||||
vector<int> intervalCounters;
|
vector<int> intervalCounters;
|
||||||
|
|
||||||
|
size_t chanNameLen = 0;
|
||||||
|
|
||||||
// iterate over the channels map
|
// iterate over the channels map
|
||||||
for (const auto& mi : fChannels)
|
for (const auto& mi : fChannels)
|
||||||
{
|
{
|
||||||
|
@ -881,6 +887,7 @@ void FairMQDevice::LogSocketRates()
|
||||||
logIntervals.push_back(vi->fRateLogging);
|
logIntervals.push_back(vi->fRateLogging);
|
||||||
intervalCounters.push_back(0);
|
intervalCounters.push_back(0);
|
||||||
filteredChannelNames.push_back(fair::mq::tools::ToString(mi.first, "[", vi - (mi.second).begin(), "]"));
|
filteredChannelNames.push_back(fair::mq::tools::ToString(mi.first, "[", vi - (mi.second).begin(), "]"));
|
||||||
|
chanNameLen = max(chanNameLen, filteredChannelNames.back().length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -949,9 +956,9 @@ void FairMQDevice::LogSocketRates()
|
||||||
bytesOut.at(i) = bytesOutNew.at(i);
|
bytesOut.at(i) = bytesOutNew.at(i);
|
||||||
msgOut.at(i) = msgOutNew.at(i);
|
msgOut.at(i) = msgOutNew.at(i);
|
||||||
|
|
||||||
LOG(info) << filteredChannelNames.at(i) << ": "
|
LOG(info) << setw(chanNameLen) << filteredChannelNames.at(i) << ": "
|
||||||
<< "in: " << msgPerSecIn.at(i) << " (" << mbPerSecIn.at(i) << " MB) "
|
<< "in: " << msgPerSecIn.at(i) << " (" << mbPerSecIn.at(i) << " MB) "
|
||||||
<< "out: " << msgPerSecOut.at(i) << " (" << mbPerSecOut.at(i) << " MB)";
|
<< "out: " << msgPerSecOut.at(i) << " (" << mbPerSecOut.at(i) << " MB)";
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
|
|
@ -413,6 +413,9 @@ class FairMQDevice : public FairMQStateMachine
|
||||||
void SetInitializationTimeoutInS(int initializationTimeoutInS) { fInitializationTimeoutInS = initializationTimeoutInS; }
|
void SetInitializationTimeoutInS(int initializationTimeoutInS) { fInitializationTimeoutInS = initializationTimeoutInS; }
|
||||||
int GetInitializationTimeoutInS() const { return fInitializationTimeoutInS; }
|
int GetInitializationTimeoutInS() const { return fInitializationTimeoutInS; }
|
||||||
|
|
||||||
|
void SetRawCmdLineArgs(const std::vector<std::string>& args) { fRawCmdLineArgs = args; }
|
||||||
|
std::vector<std::string> GetRawCmdLineArgs() const { return fRawCmdLineArgs; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<FairMQTransportFactory> fTransportFactory; ///< Default transport factory
|
std::shared_ptr<FairMQTransportFactory> fTransportFactory; ///< Default transport factory
|
||||||
std::unordered_map<fair::mq::Transport, std::shared_ptr<FairMQTransportFactory>> fTransports; ///< Container for transports
|
std::unordered_map<fair::mq::Transport, std::shared_ptr<FairMQTransportFactory>> fTransports; ///< Container for transports
|
||||||
|
@ -532,6 +535,7 @@ class FairMQDevice : public FairMQStateMachine
|
||||||
const fair::mq::tools::Version fVersion;
|
const fair::mq::tools::Version fVersion;
|
||||||
float fRate; ///< Rate limiting for ConditionalRun
|
float fRate; ///< Rate limiting for ConditionalRun
|
||||||
size_t fLastTime; ///< Rate limiting for ConditionalRun
|
size_t fLastTime; ///< Rate limiting for ConditionalRun
|
||||||
|
std::vector<std::string> fRawCmdLineArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FAIRMQDEVICE_H_ */
|
#endif /* FAIRMQDEVICE_H_ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user