34 , durationEdit(new QLineEdit(this))
35 , timestepEdit(new QLineEdit(this))
36 , maxDurationEdit(new QLineEdit(this))
37 , maxTimestepEdit(new QLineEdit(this))
38 , timestepJitterEdit(new QLineEdit(this))
39 , AppCpuPercentEdit(new QLineEdit(this))
43 const QString suffix = QString(
"s)").prepend(QChar(0x3BC));
46 auto* gridLayout =
new QGridLayout;
48 durationEdit->setReadOnly(
true);
49 gridLayout->addWidget(
50 new QLabel(tr(
"Computation Time (").append(suffix)), 1, 0);
51 gridLayout->addWidget(durationEdit, 1, 1);
53 maxDurationEdit->setReadOnly(
true);
54 gridLayout->addWidget(
55 new QLabel(tr(
"Peak Computation Time (").append(suffix)), 2, 0);
56 gridLayout->addWidget(maxDurationEdit, 2, 1);
58 timestepEdit->setReadOnly(
true);
59 gridLayout->addWidget(
60 new QLabel(tr(
"Real-time Period (").append(suffix)), 3, 0);
61 gridLayout->addWidget(timestepEdit, 3, 1);
63 maxTimestepEdit->setReadOnly(
true);
64 gridLayout->addWidget(
65 new QLabel(tr(
"Peak Real-time Period (").append(suffix)), 4, 0);
66 gridLayout->addWidget(maxTimestepEdit, 4, 1);
68 timestepJitterEdit->setReadOnly(
true);
69 gridLayout->addWidget(
70 new QLabel(tr(
"Real-time Jitter (").append(suffix)), 5, 0);
71 gridLayout->addWidget(timestepJitterEdit, 5, 1);
73 AppCpuPercentEdit->setReadOnly(
true);
74 gridLayout->addWidget(
new QLabel(
"RTXI App Cpu Usage(%)"), 6, 0);
75 gridLayout->addWidget(AppCpuPercentEdit, 6, 1);
77 auto* resetButton =
new QPushButton(
"Reset",
this);
78 gridLayout->addWidget(resetButton, 7, 1);
79 QObject::connect(resetButton, SIGNAL(released()),
this, SLOT(
reset()));
85 setLayout(gridLayout);
89 this->
getMdiWindow()->setFixedSize(this->minimumSizeHint());
90 auto* timer =
new QTimer(
this);
91 timer->setInterval(1000);
108 "PerformanceMeasurement::Component::Component : Unable to craate " 121 stats.duration =
static_cast<double>(*(end_ticks) - *(start_ticks));
122 stats.timestep =
static_cast<double>(*(start_ticks)-last_start_ticks);
123 stats.latency = stats.timestep -
static_cast<double>(period);
124 stats.max_timestep = std::max(stats.max_timestep, stats.timestep);
125 stats.max_duration = std::max(stats.max_duration, stats.duration);
126 stats.max_latency = std::max(stats.max_latency, stats.latency);
127 latencyStat.push(stats.latency);
128 stats.jitter = latencyStat.std();
130 switch (this->getState()) {
132 this->fifo->writeRT(&this->stats,
137 latencyStat.push(0.0);
138 this->stats = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
150 last_start_ticks = *start_ticks;
156 this->start_ticks = s_ticks;
157 this->end_ticks = e_ticks;
164 const double nano2micro = 1e-3;
166 hostplugin->getSampleStat();
167 durationEdit->setText(QString::number(stats.
duration * nano2micro));
168 maxDurationEdit->setText(QString::number(stats.
max_duration * nano2micro));
169 timestepEdit->setText(QString::number(stats.
timestep * nano2micro));
170 maxTimestepEdit->setText(QString::number(stats.
max_timestep * nano2micro));
171 timestepJitterEdit->setText(QString::number(stats.
jitter * nano2micro));
184 auto component = std::make_unique<PerformanceMeasurement::Component>(
this);
185 std::vector<Event::Object> events;
189 auto* performance_measurement_component =
192 std::any_cast<int64_t*>(events[0].getParam(
"pre-period")),
193 std::any_cast<int64_t*>(events[1].getParam(
"post-period")));
195 this->component_fifo = component->getFIfoPtr();
203 while (this->component_fifo->read(
214 return std::make_unique<PerformanceMeasurement::Plugin>(ev_manager);
229 return std::make_unique<PerformanceMeasurement::Component>(
nullptr);
void postEvent(Object *event)
void ERROR_MSG(const std::string &errmsg, Args... args)
Connection Oriented Classes.
struct IO::channel_t channel_t
int getFifo(std::unique_ptr< Fifo > &fifo, size_t fifo_size)
const int64_t DEFAULT_PERIOD