1 |
/*****************************************************************
|
2 |
|
3 |
cal_cpu.c Type:Func
|
4 |
|
5 |
calcul du cpu
|
6 |
|
7 |
Date de creation : Wed Apr 17 10:49:02 1996
|
8 |
|
9 |
Derniere version : Mon May 5 10:22:10 1997
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
Vincent FRANCOIS
|
17 |
|
18 |
*****************************************************************/
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
/**************************/
|
25 |
/* include */
|
26 |
#include <stdio.h>
|
27 |
#include <math.h>
|
28 |
#include <time.h>
|
29 |
#include <string.h>
|
30 |
#include "struct.h"
|
31 |
/**************************/
|
32 |
/* variables globales */
|
33 |
extern environnement env;
|
34 |
|
35 |
|
36 |
|
37 |
/**************************/
|
38 |
/* programme principal */
|
39 |
|
40 |
void cal_cpu(void)
|
41 |
{
|
42 |
static long cpu_actuel,cpu_avant ;
|
43 |
double cpu_ecoule ;
|
44 |
static int passe=1;
|
45 |
|
46 |
|
47 |
|
48 |
if (passe==1)
|
49 |
{
|
50 |
cpu_avant=clock();
|
51 |
passe=0;
|
52 |
}
|
53 |
else
|
54 |
{
|
55 |
cpu_actuel = clock() ;
|
56 |
cpu_ecoule = (double) (cpu_actuel - cpu_avant)/CLK_TCK ;
|
57 |
env.cpu=cpu_ecoule;
|
58 |
}
|
59 |
}
|