summaryrefslogtreecommitdiff
path: root/test_general/proto_gaisler/src/test_cp_spoc.c
blob: 9b78b8d5b1fa164591a994b036442497a2eff2e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    test_cp_spoc.c
 * \brief   « brief description »
 * \ingroup « module »
 *
 * « long description »
 */
#include "define_spoc_c.h"
#include "sys/time.h"

void
spoc_compute_all (spoc_prec_t rho)
{
    spoc_MCoeff (rho);
    spoc_CG (rho, 3072, reg_CG_N);
    spoc_CG (rho, -3072, reg_CG_FC10);
    spoc_CG (rho, 372, reg_CG_PR1);
    spoc_CG (rho, 1140, reg_CG_PR2);
}

int
main(int argc, char** argv)
{
    struct timeval tv0, tv1;
    int cpt = 0;
    int log_step;
    int sub_step;
    int rho_eps;
    gettimeofday (&tv0, NULL);
    spoc_compute_all (50*1e-6);
    gettimeofday (&tv1, NULL);
    printf ("test duration [SPOC] %d \n", (int) ((tv1.tv_sec*1000000+tv1.tv_usec)-(tv0.tv_sec*1000000 + tv0.tv_usec)));
    gettimeofday (&tv0, NULL);
    for (log_step = 1; log_step <= 100000; log_step = log_step*10 )
    {
        //printf ("rho = %5.15g\n", -10*log_step*1e-9);
        for (sub_step = -10; sub_step<=10; sub_step++)
        {
            //printf ("rho = %5.15g\n", sub_step*log_step*1e-9);
            spoc_compute_all (sub_step*log_step*1e-9);
            //spoc_compute_all (50*1e-6);
            cpt++;
        }
    }
    gettimeofday (&tv1, NULL);
    uint dt =  (int) ((tv1.tv_sec*1000000+tv1.tv_usec)-(tv0.tv_sec*1000000 + tv0.tv_usec));
    printf ("test duration [SPOC] %d/%d=%g \n", dt, cpt, (1.0*dt)/cpt );
    return 0;
}