Subversion Repositories shark

Rev

Rev 1655 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1655 giacomo 1
/*
2
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *               Gerardo Lamastra <gerardo@sssup.it>
6
 *
7
 * Authors     : Paolo Gai <pj@hartik.sssup.it>
8
 * (see authors.txt for full list of hartik's authors)
9
 *
10
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
11
 *
12
 * http://www.sssup.it
13
 * http://retis.sssup.it
14
 * http://hartik.sssup.it
15
 */
16
 
17
/**
18
 ------------
19
 CVS :        $Id: perf4.c,v 1.1.1.1 2004-05-24 18:03:39 giacomo Exp $
20
 
21
 File:        $File$
22
 Revision:    $Revision: 1.1.1.1 $
23
 Last update: $Date: 2004-05-24 18:03:39 $
24
 ------------
25
 
26
 Performance test 1:
27
 
28
 there is one RR task that is preempted N_EDF times by an EDF task.
29
 
30
 the test prints the differences of the execution time.
31
 
32
 the test have to be compiled with the one shot timer, and it does not
33
 use any init file.
34
 
35
**/
36
 
37
/*
38
 * Copyright (C) 2000 Paolo Gai
39
 *
40
 * This program is free software; you can redistribute it and/or modify
41
 * it under the terms of the GNU General Public License as published by
42
 * the Free Software Foundation; either version 2 of the License, or
43
 * (at your option) any later version.
44
 *
45
 * This program is distributed in the hope that it will be useful,
46
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
48
 * GNU General Public License for more details.
49
 *
50
 * You should have received a copy of the GNU General Public License
51
 * along with this program; if not, write to the Free Software
52
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
53
 *
54
 */
55
 
56
 
57
#include "kernel/kern.h"
58
#include "modules/edf.h"
59
#include "modules/rr.h"
60
#include "modules/dummy.h"
61
#include "modules/pi.h"
62
 
63
#define TIMESPEC_N        100
64
#define RR_N       1000000000
65
#define EDF_N            2500
66
 
67
 
68
TIME __kernel_register_levels__(void *arg)
69
{
70
  struct multiboot_info *mb = (struct multiboot_info *)arg;
71
 
72
  EDF_register_level(EDF_ENABLE_ALL);
73
  RR_register_level(1000*1000*1000, RR_MAIN_NO, mb);
74
  RR_register_level(10000, RR_MAIN_YES, mb);
75
  dummy_register_level();
76
 
77
  PI_register_module();
78
 
79
  return 1200;
80
}
81
 
82
void *crash_RR(void *arg);
83
void *crash_EDF(void *arg);
84
 
85
void *__init__(void *arg)
86
{
87
    TIME t1, t2;
88
    PI_mutexattr_t a;
89
    mutex_t m1;
90
    int i;
91
 
92
    PI_mutexattr_default(a);
93
 
94
    mutex_init(&m1, &a);
95
 
96
    t1 = sys_gettime(NULL);
97
    for (i=0; i<1000; i++) {
98
      mutex_lock(&m1);
99
      mutex_unlock(&m1);
100
    }
101
    t2 = sys_gettime(NULL);
102
 
103
    kern_printf("t1=%ld, t2=%ld\n",t1,t2);
104
 
105
    return 0;
106
}
107
 
108
// not used !!!
109
int main(int argc, char **argv)
110
{
111
  return 0;
112
}