Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
 *
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
 *               Gerardo Lamastra <gerardo@sssup.it>
 *
 * Authors     : Paolo Gai <pj@hartik.sssup.it>
 * (see authors.txt for full list of hartik's authors)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://hartik.sssup.it
 */


/**
 ------------
 CVS :        $Id: perf4.c,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $

 File:        $File$
 Revision:    $Revision: 1.1.1.1 $
 Last update: $Date: 2002-09-02 09:37:48 $
 ------------

 Performance test 1:

 there is one RR task that is preempted N_EDF times by an EDF task.

 the test prints the differences of the execution time.

 the test have to be compiled with the one shot timer, and it does not
 use any init file.

**/


/*
 * Copyright (C) 2000 Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */



#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/rr.h"
#include "modules/dummy.h"
#include "modules/pi.h"

#define TIMESPEC_N        100
#define RR_N       1000000000
#define EDF_N            2500


TIME __kernel_register_levels__(void *arg)
{
  struct multiboot_info *mb = (struct multiboot_info *)arg;

  EDF_register_level(EDF_ENABLE_ALL);
  RR_register_level(1000*1000*1000, RR_MAIN_NO, mb);
  RR_register_level(10000, RR_MAIN_YES, mb);
  dummy_register_level();

  PI_register_module();

  return 1200;
}

void *crash_RR(void *arg);
void *crash_EDF(void *arg);

void *__init__(void *arg)
{
    TIME t1, t2;
    PI_mutexattr_t a;
    mutex_t m1;
    int i;

    PI_mutexattr_default(a);

    mutex_init(&m1, &a);

    t1 = sys_gettime(NULL);
    for (i=0; i<1000; i++) {
      mutex_lock(&m1);
      mutex_unlock(&m1);
    }
    t2 = sys_gettime(NULL);

    kern_printf("t1=%ld, t2=%ld\n",t1,t2);

    return 0;
}

// not used !!!
int main(int argc, char **argv)
{
  return 0;
}