Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1085 pj 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: test8.c,v 1.1.1.1 2002-09-02 09:37:48 pj Exp $
20
 
21
 File:        $File$
22
 Revision:    $Revision: 1.1.1.1 $
23
 Last update: $Date: 2002-09-02 09:37:48 $
24
 ------------
25
 
26
 Test Number 8:
27
 
28
 timer test
29
 
30
**/
31
 
32
/*
33
 * Copyright (C) 2000 Paolo Gai
34
 *
35
 * This program is free software; you can redistribute it and/or modify
36
 * it under the terms of the GNU General Public License as published by
37
 * the Free Software Foundation; either version 2 of the License, or
38
 * (at your option) any later version.
39
 *
40
 * This program is distributed in the hope that it will be useful,
41
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43
 * GNU General Public License for more details.
44
 *
45
 * You should have received a copy of the GNU General Public License
46
 * along with this program; if not, write to the Free Software
47
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
48
 *
49
 */
50
 
51
#include "kernel/kern.h"
52
 
53
#define NT 10
54
 
55
int main(int argc, char **argv)
56
{
57
 
58
    struct timespec t[NT];
59
    int i;
60
 
61
    kern_printf("Test di correttezza ll_gettime(). dura 1 secondo. ");
62
 
63
    for (i=0; i<NT; i++) NULL_TIMESPEC(&t[i]);
64
 
65
    do {
66
      for (i=0; i<NT-1; i++) t[i+1] = t[i];
67
 
68
      kern_cli();
69
      ll_gettime(TIME_EXACT, &t[0]);
70
      kern_sti();
71
 
72
      if (TIMESPEC_A_LT_B(&t[0],&t[1])) {
73
        for (i=0; i<NT; i++)
74
          kern_printf("%d %ld\n",i, t[i].tv_nsec);
75
        sys_end();
76
      }
77
    } while (t[0].tv_sec < 1);
78
 
79
    return 0;
80
}
81