3 /* chrono - demo of GRAS benchmarking features */
5 /* Copyright (c) 2005 Martin Quinson, Arnaud Legrand. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
13 XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono,"Messages specific to this example");
16 /* Function prototypes */
17 int multiplier (int argc,char *argv[]);
19 int multiplier (int argc,char *argv[])
27 gras_init(&argc, argv);
29 A = malloc(n*n*sizeof(double));
30 B = malloc(n*n*sizeof(double));
31 C = malloc(n*n*sizeof(double));
33 start=now=gras_os_time();
35 INFO1("Begin matrix multiplication loop (time: %g)", start);
39 GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
50 C[i*n+j] += A[i*n+k]*B[k*n+j];
52 GRAS_BENCH_ONCE_RUN_ONCE_END();
53 now=gras_os_time()-now;
54 INFO2("Iteration %d : %g ", l, now);
57 now=gras_os_time()-start;
58 INFO2("End matrix multiplication loop (time: %g; Duration: %g)", gras_os_time(), now);
60 start=now=gras_os_time();
61 INFO1("Begin malloc loop (time: %g)", start);
64 GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
66 A = malloc(n*n*sizeof(double));
67 GRAS_BENCH_ONCE_RUN_ONCE_END();
68 now=gras_os_time()-now;
69 INFO2("Iteration %d : %g ", l, now);
72 start=now=gras_os_time();
73 INFO1("Begin integer incrementation loop (time: %g)", start);
75 GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
77 GRAS_BENCH_ONCE_RUN_ONCE_END();