Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
deal with trace
[simgrid.git] / teshsuite / msg / trace_integration / trace_integration.c
1 /* Copyright (c) 2009-2010, 2012-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "simgrid/msg.h"
8
9 XBT_LOG_NEW_DEFAULT_CATEGORY(test_trace_integration, "Messages specific for this msg example");
10
11 /** test the trace integration cpu model */
12 static int test_trace(int argc, char *argv[])
13 {
14   double task_comp_size = 2800;
15   double task_prio = 1.0;
16
17   xbt_assert (argc == 3,"Wrong number of arguments!\nUsage: %s <task computational size in FLOPS> <task priority>", argv[0]);
18
19   task_comp_size = xbt_str_parse_double(argv[1],"Invalid computational size: %s");
20   task_prio = xbt_str_parse_double(argv[2], "Invalid task priority: %s");
21
22   XBT_INFO("Testing the trace integration cpu model: CpuTI");
23   XBT_INFO("Task size: %f", task_comp_size);
24   XBT_INFO("Task prio: %f", task_prio);
25
26   /* Create and execute a single task. */
27   msg_task_t task = MSG_task_create("proc 0", task_comp_size, 0, NULL);
28   MSG_task_set_priority(task, task_prio);
29   MSG_task_execute(task);
30   MSG_task_destroy(task);
31
32   XBT_INFO("Test finished");
33
34   return 0;
35 }
36
37 int main(int argc, char *argv[])
38 {
39   msg_error_t res = MSG_OK;
40
41   MSG_init(&argc, argv);
42   xbt_assert(argc > 2, "Usage: %s test_trace_integration_model.xml deployment.xml\n", argv[0]);
43
44   MSG_function_register("test_trace", test_trace);
45   MSG_create_environment(argv[1]);
46   MSG_launch_application(argv[2]);
47
48   res = MSG_main();
49
50   return res != MSG_OK;
51 }