diff options
Diffstat (limited to 'src/ats/perf_ats_solver.c')
-rw-r--r-- | src/ats/perf_ats_solver.c | 116 |
1 files changed, 42 insertions, 74 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 845326bcd..3f3627bc4 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -40,22 +40,22 @@ | |||
40 | #define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 40 | #define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
41 | "set datafile separator ';' \n" \ | 41 | "set datafile separator ';' \n" \ |
42 | "set title \"Execution time Proportional solver \" \n" \ | 42 | "set title \"Execution time Proportional solver \" \n" \ |
43 | "set xlabel \"Time in us\" \n" \ | 43 | "set xlabel \"Number of peers\" \n" \ |
44 | "set ylabel \"Bytes/s\" \n" \ | 44 | "set ylabel \"Execution time in us\" \n" \ |
45 | "set grid \n" | 45 | "set grid \n" |
46 | 46 | ||
47 | #define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 47 | #define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
48 | "set datafile separator ';' \n" \ | 48 | "set datafile separator ';' \n" \ |
49 | "set title \"Execution time MLP solver \" \n" \ | 49 | "set title \"Execution time MLP solver \" \n" \ |
50 | "set xlabel \"Time in us\" \n" \ | 50 | "set xlabel \"Number of peers\" \n" \ |
51 | "set ylabel \"Bytes/s\" \n" \ | 51 | "set ylabel \"Execution time in us\" \n" \ |
52 | "set grid \n" | 52 | "set grid \n" |
53 | 53 | ||
54 | #define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 54 | #define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
55 | "set datafile separator ';' \n" \ | 55 | "set datafile separator ';' \n" \ |
56 | "set title \"Execution time RIL solver \" \n" \ | 56 | "set title \"Execution time RIL solver \" \n" \ |
57 | "set xlabel \"Time in us\" \n" \ | 57 | "set xlabel \"Number of peers\" \n" \ |
58 | "set ylabel \"Bytes/s\" \n" \ | 58 | "set ylabel \"Execution time in us\" \n" \ |
59 | "set grid \n" | 59 | "set grid \n" |
60 | 60 | ||
61 | /** | 61 | /** |
@@ -375,8 +375,10 @@ perf_create_address (int cp, int ca) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | static void | 377 | static void |
378 | solver_info_cb (void *cls, enum GAS_Solver_Operation op, | 378 | solver_info_cb (void *cls, |
379 | enum GAS_Solver_Status stat) | 379 | enum GAS_Solver_Operation op, |
380 | enum GAS_Solver_Status stat, | ||
381 | enum GAS_Solver_Additional_Information add) | ||
380 | { | 382 | { |
381 | 383 | ||
382 | struct Result *tmp; | 384 | struct Result *tmp; |
@@ -509,22 +511,14 @@ solver_info_cb (void *cls, enum GAS_Solver_Operation op, | |||
509 | } | 511 | } |
510 | 512 | ||
511 | static void | 513 | static void |
512 | write_gnuplot_script () | 514 | write_gnuplot_script (char * data_fn) |
513 | { | 515 | { |
514 | struct Result *cur; | ||
515 | struct Result *next; | ||
516 | struct GNUNET_DISK_FileHandle *f; | 516 | struct GNUNET_DISK_FileHandle *f; |
517 | char * gfn; | 517 | char * gfn; |
518 | char *data; | 518 | char *data; |
519 | char *template; | 519 | char *template; |
520 | int c_s; | 520 | |
521 | int index; | 521 | GNUNET_asprintf (&gfn, "perf_%s_%u_%u_%u.gnuplot", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); |
522 | int plot_d_total; | ||
523 | int plot_d_setup; | ||
524 | int plot_d_lp; | ||
525 | int plot_d_mlp; | ||
526 | |||
527 | GNUNET_asprintf (&gfn, "perf_%s_%u_%u_%u", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); | ||
528 | f = GNUNET_DISK_file_open (gfn, | 522 | f = GNUNET_DISK_file_open (gfn, |
529 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | 523 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, |
530 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 524 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
@@ -536,7 +530,6 @@ write_gnuplot_script () | |||
536 | } | 530 | } |
537 | 531 | ||
538 | /* Write header */ | 532 | /* Write header */ |
539 | |||
540 | switch (ph.ats_mode) { | 533 | switch (ph.ats_mode) { |
541 | case MODE_PROPORTIONAL: | 534 | case MODE_PROPORTIONAL: |
542 | template = GNUPLOT_PROP_TEMPLATE; | 535 | template = GNUPLOT_PROP_TEMPLATE; |
@@ -550,55 +543,37 @@ write_gnuplot_script () | |||
550 | default: | 543 | default: |
551 | break; | 544 | break; |
552 | } | 545 | } |
553 | |||
554 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template))) | 546 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template))) |
555 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | 547 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); |
556 | #if 0 | ||
557 | cur = ph.head->d_total; | ||
558 | if (cur->d_total != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
559 | plot_d_total = GNUNET_YES; | ||
560 | |||
561 | if (cur->d_total != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
562 | plot_d_total = GNUNET_YES; | ||
563 | if (cur->d_setup != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
564 | plot_d_setup = GNUNET_YES; | ||
565 | if (cur->d_lp != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
566 | plot_d_lp = GNUNET_YES; | ||
567 | if (cur->d_mlp != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
568 | plot_d_mlp = GNUNET_YES; | ||
569 | |||
570 | |||
571 | GNUNET_asprintf (&data, "plot "\ | ||
572 | "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ | ||
573 | "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\ | ||
574 | "%s\n", | ||
575 | "\n pause -1", | ||
576 | fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, lp->peer->partners[c_s].dest->no, | ||
577 | fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, lp->peer->partners[c_s].dest->no); | ||
578 | |||
579 | GNUNET_free (data); | ||
580 | #endif | ||
581 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
582 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
583 | |||
584 | 548 | ||
585 | #if 0 | 549 | if (MODE_PROPORTIONAL == ph.ats_mode) |
586 | index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; | ||
587 | for (c_s = 0; c_s < lp->peer->num_partners; c_s++) | ||
588 | { | 550 | { |
589 | GNUNET_asprintf (&data, "%s"\ | 551 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve'\n" \ |
590 | "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ | 552 | "pause -1", |
591 | "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\ | 553 | data_fn, 3); |
592 | "%s\n", | 554 | } |
593 | (0 == c_s) ? "plot " :"", | 555 | if (MODE_MLP == ph.ats_mode) |
594 | fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, lp->peer->partners[c_s].dest->no, | 556 | { |
595 | fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, lp->peer->partners[c_s].dest->no, | 557 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve',\\\n" \ |
596 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); | 558 | "'%s' using 1:%u with lines title 'Time to setup',\\\n" |
597 | 559 | "'%s' using 1:%u with lines title 'Time to solve LP',\\\n" | |
598 | GNUNET_free (data); | 560 | "'%s' using 1:%u with lines title 'Total time to solve MLP'\n" \ |
599 | index += LOG_ITEMS_PER_PEER; | 561 | "pause -1", |
562 | data_fn, 3, | ||
563 | data_fn, 4, | ||
564 | data_fn, 5, | ||
565 | data_fn, 6); | ||
566 | } | ||
567 | if (MODE_RIL == ph.ats_mode) | ||
568 | { | ||
569 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve'\n" \ | ||
570 | "pause -1", | ||
571 | data_fn, 3); | ||
600 | } | 572 | } |
601 | #endif | 573 | |
574 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
575 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
576 | GNUNET_free (data); | ||
602 | 577 | ||
603 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | 578 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) |
604 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); | 579 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); |
@@ -624,21 +599,19 @@ evaluate () | |||
624 | 599 | ||
625 | if (ph.create_plot) | 600 | if (ph.create_plot) |
626 | { | 601 | { |
627 | GNUNET_asprintf (&data_fn, "perf_%s_%u_%u_%u_data", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); | 602 | GNUNET_asprintf (&data_fn, "perf_%s_%u_%u_%u.data", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); |
628 | f = GNUNET_DISK_file_open (data_fn, | 603 | f = GNUNET_DISK_file_open (data_fn, |
629 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | 604 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, |
630 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 605 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
631 | if (NULL == f) | 606 | if (NULL == f) |
632 | { | 607 | { |
633 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", data_fn); | 608 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", data_fn); |
634 | GNUNET_free (data_fn); | ||
635 | return; | 609 | return; |
636 | } | 610 | } |
637 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; | 611 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; |
638 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | 612 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) |
639 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file `%s'\n", data_fn); | 613 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file `%s'\n", data_fn); |
640 | 614 | write_gnuplot_script (data_fn); | |
641 | write_gnuplot_script (); | ||
642 | } | 615 | } |
643 | 616 | ||
644 | next = ph.head; | 617 | next = ph.head; |
@@ -697,9 +670,7 @@ evaluate () | |||
697 | GNUNET_free (str_d_lp); | 670 | GNUNET_free (str_d_lp); |
698 | GNUNET_free (str_d_mlp); | 671 | GNUNET_free (str_d_mlp); |
699 | GNUNET_free (data); | 672 | GNUNET_free (data); |
700 | |||
701 | } | 673 | } |
702 | |||
703 | GNUNET_CONTAINER_DLL_remove (ph.head, ph.tail, cur); | 674 | GNUNET_CONTAINER_DLL_remove (ph.head, ph.tail, cur); |
704 | GNUNET_free (cur); | 675 | GNUNET_free (cur); |
705 | } | 676 | } |
@@ -707,11 +678,8 @@ evaluate () | |||
707 | if (GNUNET_YES == ph.create_plot) | 678 | if (GNUNET_YES == ph.create_plot) |
708 | { | 679 | { |
709 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | 680 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) |
710 | { | ||
711 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", data_fn); | 681 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", data_fn); |
712 | GNUNET_free (data_fn); | 682 | GNUNET_free (data_fn); |
713 | } | ||
714 | |||
715 | } | 683 | } |
716 | } | 684 | } |
717 | 685 | ||