-SUBDIRS= ping timer # bandwidth alnem saturate
+SUBDIRS= ping timer chrono # bandwidth alnem saturate
--- /dev/null
+INCLUDES= -I$(top_srcdir)/include
+AM_CFLAGS=-g
+#TESTS= test_rl test_sg
+EXTRA_DIST=chrono_deployment.xml
+
+# AUTOMAKE variable definition
+noinst_PROGRAMS=chrono_simulator chrono_multiplier
+
+chrono_simulator_SOURCES= _chrono_simulator.c chrono.c
+chrono_simulator_LDADD= $(top_builddir)/src/libsimgrid.la
+
+chrono_multiplier_SOURCES= _chrono_multiplier.c chrono.c
+chrono_multiplier_LDADD= $(top_builddir)/src/libgras.la
+
+
+# cleanup temps
+CLEANFILES= _chrono_simulator.c _chrono_multiplier.c
+
+# generate temps
+
+# A rule to generate the source file each time the deployment file changes
+_chrono_multiplier.c _chrono_simulator.c: chrono_deployment.xml $(top_srcdir)/tools/gras/gras_stub_generator
+ $(top_srcdir)/tools/gras/gras_stub_generator chrono chrono_deployment.xml >/dev/null
+
--- /dev/null
+/* $Id$ */
+
+/* chrono - demo of GRAS benchmarking features */
+
+/* Copyright (c) 2005 Martin Quinson, Arnaud Legrand. 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. */
+
+#include "gras.h"
+
+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 i,j,k;
+ double *A,*B,*C;
+ int n = 500;
+ gras_init(&argc, argv, NULL);
+
+ A = malloc(n*n*sizeof(double));
+ B = malloc(n*n*sizeof(double));
+ C = malloc(n*n*sizeof(double));
+
+ INFO1("Before computation : %lg", gras_os_time());
+ for(i=0; i<n; i++)
+ for(j=0; j<n; j++) {
+ A[i*n+j]=2/n;
+ B[i*n+j]=1/n;
+ C[i*n+j]=0.0;
+ }
+
+ for(i=0; i<n; i++)
+ for(j=0; j<n; j++)
+ for(k=0; k<n; k++)
+ C[i*n+j] += A[i*n+k]*B[k*n+j];
+
+ INFO1("After computation : %lg", gras_os_time());
+
+ return 0;
+}
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform_description SYSTEM "surfxml.dtd">
+<platform_description>
+ <process host="Tremblay" function="multiplier"/>
+</platform_description>
--- /dev/null
+#! @BASH@ -e
+if [ x@EXEEXT@ = x ] ; then
+ wine=
+else
+ wine=wine
+fi
+
+$wine ./chrono_server@EXEEXT@ $@ &
+sleep 1
+$wine ./chrono_client@EXEEXT@ $@
--- /dev/null
+#! @BASH@
+if test -x ./chrono_simulator ; then
+ exec ./chrono_simulator @top_srcdir@/examples/msg/small_platform.xml @srcdir@/chrono_deployment.xml
+fi
+exit 77
gras/datadesc.h gras/transport.h \
gras/virtu.h gras/cond.h gras/process.h \
\
- gras/messages.h gras/timer.h\
+ gras/messages.h gras/timer.h gras/chrono.h\
\
amok/base.h \
amok/bandwidth.h
#include <gras/process.h>
#include <gras/virtu.h>
#include <gras/cond.h>
+#include <gras/chrono.h>
#include <gras/transport.h>
#include <gras/datadesc.h>
--- /dev/null
+/* $Id$ */
+
+/* chrono.h - timer macros for GRAS */
+
+/* Copyright (c) 2005 Martin Quinson, Arnaud Legrand. 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. */
+
+
+#ifndef GRAS_CHRONO_H
+#define GRAS_CHRONO_H
+
+#include "xbt/misc.h"
+
+BEGIN_DECL()
+
+void gras_bench_always_begin(const char *location);
+void gras_bench_always_end(void);
+
+/** \brief Start benchmark this part of the code
+ \hideinitializer */
+#define GRAS_BENCH_ALWAYS_BEGIN gras_bench_always_begin(__FILE__ __LINE__ __FUNCTION__)
+/** \brief Stop benchmark this part of the code
+ \hideinitializer */
+#define GRAS_BENCH_ALWAYS_END gras_bench_always_end()
+
+/** \brief Start benchmark this part of the code if it has never been benchmarked before
+ \hideinitializer */
+#define GRAS_BENCH_ONCE_BEGIN
+/** \brief Stop benchmarking this part of the code
+ \hideinitializer */
+#define GRAS_BENCH_ONCE_END
+
+END_DECL()
+
+#endif /* GRAS_CHRONO_H */
char buff[512];
sprintf(buff,"some very precious data");
- xbt_dict_set(mydict,"my data", strdump(buff), free);
+ xbt_dict_set(mydict,"my data", strdup(buff), free);
sprintf(buff,"another good stuff");
xbt_dict_set(mydict,"my data", strdup(buff), free); // previous data gets erased (and freed) by second add \endverbatim
msg/global.c msg/environment.c msg/deployment.c \
\
gras/gras.c \
+ gras/chrono.c \
\
gras/Transport/transport.c gras/Transport/transport_private.h gras/Transport/transport_plugin_buf.c \
\
--- /dev/null
+/* $Id$ */
+
+/* chrono.c - code benchmarking for emulation */
+
+/* Copyright (c) 2005 Martin Quinson, Arnaud Legrand. 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. */
+
+#include "gras/chrono.h"
+
+void gras_bench_always_begin(const char *location)
+{
+}
+
+void gras_bench_always_end(void)
+{
+}