X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/509304ee1435b62cd49eb9071995fab468f68f58..e552466303fbb7a0de83633a72d1bb3570a11e28:/testsuite/surf/trace_usage.c diff --git a/testsuite/surf/trace_usage.c b/testsuite/surf/trace_usage.c index c203163c6c..0f2dcdee01 100644 --- a/testsuite/surf/trace_usage.c +++ b/testsuite/surf/trace_usage.c @@ -1,47 +1,54 @@ +/* $Id$ */ + /* A few tests for the trace library */ -/* Authors: Arnaud Legrand */ +/* Copyright (c) 2004 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. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ #include #include #include #include "surf/trace_mgr.h" +#include "surf/surf.h" void test(void); void test(void) { tmgr_history_t history = tmgr_history_new(); - tmgr_trace_t trace_A= tmgr_trace_new("trace_A.txt"); - tmgr_trace_t trace_B= tmgr_trace_new("trace_B.txt"); - xbt_heap_float_t next_event_date=-1.0; - xbt_maxmin_float_t value = -1.0; + tmgr_trace_t trace_A = tmgr_trace_new("trace_A.txt"); + tmgr_trace_t trace_B = tmgr_trace_new("trace_B.txt"); + double next_event_date = -1.0; + double value = -1.0; char *resource = NULL; char *host_A = strdup("Host A"); char *host_B = strdup("Host B"); tmgr_history_add_trace(history, trace_A, 1.0, 2, host_A); tmgr_history_add_trace(history, trace_B, 0.0, 0, host_B); - - while((next_event_date=tmgr_history_next_date(history))!=-1.0) { - printf(XBT_HEAP_FLOAT_T " : \n",next_event_date); - while(tmgr_history_get_next_event_leq(history, next_event_date, - &value, (void**) &resource)){ - printf("\t %s : " XBT_MAXMIN_FLOAT_T "\n",resource,value); + + while ((next_event_date = tmgr_history_next_date(history)) != -1.0) { + printf("%lg" " : \n", next_event_date); + while (tmgr_history_get_next_event_leq(history, next_event_date, + &value, (void **) &resource)) { + printf("\t %s : " "%lg" "\n", resource, value); } - if(next_event_date>1000) break; + if (next_event_date > 1000) + break; } tmgr_trace_free(trace_A); tmgr_trace_free(trace_B); tmgr_history_free(history); -} + free(host_B); + free(host_A); +} int main(int argc, char **argv) { + surf_init(&argc,argv); test(); return 0; }