On Mon, Oct 22, 2001 at 04:01:12PM +0200, Der Herr Hofrat wrote:
> Hi !
>
> same code just a bit more human redable...to check the jitter of a system -
> note that the jitter reported is a theorectical one as it is the delay that
> can be introced between any two calls on a non-rt system. compile it and run
> it on a idle box - if you let it run long enough you will see 1s maximum !
> if you load the box heavaly (pingflood , multiple ls -lR / , compile kernel
> with make -j 60 ...) you will find half second jumps happening quite soon.
> (just ran it on a PIII/800). You also might want to look at the gethrtime
> function in rtlinux (rtlinux-3.X/schedulers/i386/rtl_time.h)
Hi.
Thank-you VERY much for this, it's really helpful. Except...
Currently, it works fine for user-space stuff. It quite happily sits
there teling me how long it took between calls.
Except that as soon as I migrate it to kernel-space [rt or not], I get
nada. Below is a butchered variant on hello.c. Am I missing anything
horrible obvious?
Gary (-;
PS I've also discovered that calling the macro "rdtsc" is bad, because
someone else already got that name, and it was causing many compile
issues
<snip>
#include <rtl.h>
#include <asm/io.h>
#include <time.h>
#include <pthread.h>
pthread_t thread;
__inline__ unsigned long long int rdtsc_counter(void)
{
unsigned long long int x;
/* the CPUID instruction is mostly irrelevant; it just
flushes the pipeline for good measure */
__asm__("cpuid\n\t"
"rdtsc\n\t"
"mov %%edx, %%ecx\n\t"
:"=A" (x));
return x;
}
void * start_routine(void *arg)
{
struct sched_param p;
int f = 0;
unsigned long long int cpu_ticks_before,cpu_ticks_after;
p . sched_priority = 1;
pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);
/* Mental note: 500000000 nanoseconds is 1/2s */
pthread_make_periodic_np (pthread_self(), gethrtime(), 500000000);
while (1) {
cpu_ticks_before = rdtsc_counter();
pthread_wait_np ();
rtl_printf("I'm here; I've got to %i, ", (int) f);
f++;
cpu_ticks_after = rdtsc_counter();
rtl_printf("And it took %i clock cycles\n", (int) (cpu_ticks_after -
cpu_ticks_before));
}
return 0;
}
int init_module(void) {
return pthread_create (&thread, NULL, start_routine, 0);
}
void cleanup_module(void) {
pthread_delete_np (thread);
}
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/