Assistance Needed with EVL4 Monitoring Data Not Updating
Hi,all
I recently started working with EVL and wrote a simple piece of code to understand its behavior. However, I’ve encountered an issue where the monitoring data does not update as expected, while latmus tests show changes.
Here’s the code snippet:
#include <sys/types.h>
#include <unistd.h>
#include <error.h>
#include <sched.h>
#include <pthread.h>
#include <evl/sched.h>
#include <evl/evl.h>
#include <evl/thread.h>
int main(int argc, char *const argv[]) {
struct sched_param param;
int ret, tfd;
ret = evl_init();
if (ret)
error(1, -ret, "cannot initialize EVL”);
param.sched_priority = 8;
ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
tfd = evl_attach_thread(EVL_CLONE_PUBLIC, "evl-example-%d", getpid());
if (tfd < 0)
error(1, -tfd, "evl_attach_self() failed”);
for (;;) {
struct evl_version ver_t = evl_get_version();
printf("Hello, EVL! %s \n", ver_t.version_string);
usleep(50);
}
return 0;
}The monitoring command (evl ps -tsp) shows the following, which does not change over time:
Every 1.0s: evl ps -tsp
CPU PID SCHED PRIO ISW CTXSW SYS RWA STAT TIMEOUT %CPU CPUTIME NAME
3 96822 fifo 8 1 1 1 0 X - 0.0 0:000.009 evl-example-96822
The relevant versions used are as follows:
libevl:r46
Linux-evl: v6.6.23-evl2
Gcc : 8.4
Linux : x64 intel
Could anyone help me understand why the monitoring data isn’t updating or suggest what I might be missing?
Thanks in advance for your assistance!
Quoted 28 lines · YinJie LI
Hi,all
I recently started working with EVL and wrote a simple piece of code to understand its behavior. However, I’ve encountered an issue where the monitoring data does not update as expected, while latmus tests show changes.
Here’s the code snippet:
#include <
sys/types.h>
#include <unistd.h>
#include <error.h>
#include <sched.h>
#include <pthread.h>
#include <evl/sched.h>
#include <evl/evl.h>
#include <evl/thread.h>int main(int argc, char *const argv[]) { struct sched_param param; int ret, tfd; ret = evl_init(); if (ret) error(1, -ret, "cannot initialize EVL”); param.sched_priority = 8; ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
Quoted 7 lines
tfd = evl_attach_thread(EVL_CLONE_PUBLIC, "evl-example-%d", getpid());
if (tfd < 0)
error(1, -tfd, "evl_attach_self() failed”);
for (;;) {
struct evl_version ver_t = evl_get_version();
printf("Hello, EVL! %s \n", ver_t.version_string);evl_printf(...)
Quoted 1 line
usleep(50);
evl_usleep(50)
Quoted 18 lines
} return 0; }The monitoring command (evl ps -tsp) shows the following, which does not change over time:
Every 1.0s: evl ps -tsp
CPU PID SCHED PRIO ISW CTXSW SYS RWA STAT TIMEOUT %CPU CPUTIME NAME
3 96822 fifo 8 1 1 1 0 X - 0.0 0:000.009 evl-example-96822The relevant versions used are as follows:
libevl:r46
Linux-evl: v6.6.23-evl2
Gcc : 8.4
Linux : x64 intel
Quoted 3 lines
Could anyone help me understand why the monitoring data isn’t updating or suggest what I might be missing?
Thanks in advance for your assistance!
This code loop never runs real-time evl-wise, because it's using plain so-called "in-band" calls from the regular kernel logic, not evl services. The first call to printf() downgrades the thread execution mode to in-band, leaving it there indefinitely since there is no evl call causing a switch back to out-of-band scheduling. As a result, this thread does not perform any evl context switch as reported by 'evl ps' in the CTXSW column, consumes no time in real-time mode and so on.
You may want to read this:
https://v4.xenomai.org/core/user-api/thread/
https://v4.xenomai.org/dovetail/altsched/
Signature · 1 line
Philippe.