X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d3546624f31ddb7580a5d7e7e4f66e00e05041d6..d19029c26682d4c5ae520a8ee7bb34a7b18e5471:/examples/gras/chrono/chrono.c diff --git a/examples/gras/chrono/chrono.c b/examples/gras/chrono/chrono.c index eb31f9a882..8dba5771f5 100644 --- a/examples/gras/chrono/chrono.c +++ b/examples/gras/chrono/chrono.c @@ -1,8 +1,7 @@ -/* $Id$ */ - /* chrono - demo of GRAS benchmarking features */ -/* Copyright (c) 2005 Martin Quinson, Arnaud Legrand. All rights reserved. */ +/* Copyright (c) 2005, 2007, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -10,46 +9,77 @@ #include "gras.h" #include "xbt/log.h" -XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono,"Messages specific to this example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono, "Messages specific to this example"); /* Function prototypes */ -int multiplier (int argc,char *argv[]); +int multiplier(int argc, char *argv[]); -int multiplier (int argc,char *argv[]) +int multiplier(int argc, char *argv[]) { - int i,j,k,l; - double *A,*B,*C; - int n = 500; + int i, j, k, l; + double *A, *B, *C; + int n = 100; double start = 0.0; + double now = 0.0; + + gras_init(&argc, argv); - gras_init(&argc, argv, NULL); + A = malloc(n * n * sizeof(double)); + B = malloc(n * n * sizeof(double)); + C = malloc(n * n * sizeof(double)); - A = malloc(n*n*sizeof(double)); - B = malloc(n*n*sizeof(double)); - C = malloc(n*n*sizeof(double)); + start = now = gras_os_time(); - INFO1("Before computation: %lg", start=gras_os_time()); + XBT_INFO("Begin matrix multiplication loop (time: %g)", start); - for(l=0; l<4; l++) { + for (l = 0; l < 4; l++) { + now = gras_os_time(); GRAS_BENCH_ONCE_RUN_ONCE_BEGIN(); - for(i=0; i