diff -r 7c986b717411 -r 9f4ea66d89a3 rt/msr_jitter.c --- a/rt/msr_jitter.c Wed Feb 22 17:36:28 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/****************************************************************************** - * - * msr_jitter.c - * - * Autor: Wilhelm Hagemeister - * - * (C) Copyright IgH 2002 - * Ingenieurgemeinschaft IgH - * Heinz-Bäcker Str. 34 - * D-45356 Essen - * Tel.: +49 201/61 99 31 - * Fax.: +49 201/61 98 36 - * E-mail: hm@igh-essen.com - * - * $Id$ - * - *****************************************************************************/ - -#ifndef __KERNEL__ -# define __KERNEL__ -#endif -#ifndef MODULE -# define MODULE -#endif - -#include -#include -#include -#include -#include /* maschine-specific registers */ -#include /* fuer HZ */ - -#include -#include "msr_jitter.h" - -/*--includes-----------------------------------------------------------------*/ - -/*--external functions-------------------------------------------------------*/ - -/*--external data------------------------------------------------------------*/ - -/*--public data--------------------------------------------------------------*/ - -/*--local data---------------------------------------------------------------*/ - -#define NUMCLASSES 16 - -static int jittime[NUMCLASSES]={0,1,2,5,10,20,50,100,200,500, - 1000,2000,5000,10000,20000,50000}; //in usec -static int jitcount[NUMCLASSES]; -static double jitpercent[NUMCLASSES]; -static unsigned int tcount = 1; - -static void msr_jit_read(void) -{ - int i; - for(i=0;i100) { - jitpercent[i] = jitcount[i]*100.0/tcount; - } - } -} - -void msr_jitter_init(void) -{ - msr_reg_int_list("/Taskinfo/Jitter/Classes","usec", - &jittime[0],MSR_R,NUMCLASSES,NULL,NULL,NULL); - msr_reg_int_list("/Taskinfo/Jitter/Count","", - &jitcount[0],MSR_R,NUMCLASSES,NULL,NULL,NULL); - msr_reg_dbl_list("/Taskinfo/Jitter/percent","%", - &jitpercent[0],MSR_R,NUMCLASSES,NULL,NULL,&msr_jit_read); -} - -/****************************************************************************** - * - * Function: msr_jitter_run - * - * Beschreibung: - * - * - * Parameter: Zeiger auf msr_data - * - * Rückgabe: - * - * Status: exp - * - *****************************************************************************/ - -void msr_jitter_run(unsigned int hz) { - - int i,hit; - static int firstrun = 1; - static unsigned long k,j = 0; - unsigned int dt,jitter; - - - rdtscl(k); - - tcount++; - - //Zeitabstand zwischen zwei Interrupts in usec - - dt = ((unsigned long)(100000/HZ)*((unsigned long)(k-j))) - /(current_cpu_data.loops_per_jiffy/10); - - jitter = (unsigned int)abs((int)dt-(int)1000000/hz); - //jitter errechnet zum Sollabtastrate - - //in die Klassen einsortieren - if(!firstrun) { //das erste mal nicht einsortieren - hit = 0; - for(i=0;i=jittime[i] && jitter