All of lore.kernel.org
 help / color / mirror / Atom feed
* Assistance Needed with EVL4 Monitoring Data Not Updating
@ 2024-06-22  5:48 YinJie LI
  2024-06-22 10:25 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: YinJie LI @ 2024-06-22  5:48 UTC (permalink / raw)
  To: xenomai

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, &param);

	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!



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Assistance Needed with EVL4 Monitoring Data Not Updating
  2024-06-22  5:48 Assistance Needed with EVL4 Monitoring Data Not Updating YinJie LI
@ 2024-06-22 10:25 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2024-06-22 10:25 UTC (permalink / raw)
  To: YinJie LI; +Cc: xenomai


YinJie LI <liyinjie0418@gmail.com> writes:

> 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, &param);
>
> 	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(...)

> 		usleep(50);

evl_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!

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/

-- 
Philippe.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-22 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-22  5:48 Assistance Needed with EVL4 Monitoring Data Not Updating YinJie LI
2024-06-22 10:25 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.