text.cc (5884:cba4b5495d7b) | text.cc (5886:12431dc9a30a) |
---|---|
1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 129 unchanged lines hidden (view full) --- 138 stat_list_t::const_iterator i, end = stats().end(); 139 for (i = stats().begin(); i != end; ++i) 140 (*i)->visit(*this); 141 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 142 stream->flush(); 143} 144 145bool | 1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 129 unchanged lines hidden (view full) --- 138 stat_list_t::const_iterator i, end = stats().end(); 139 for (i = stats().begin(); i != end; ++i) 140 (*i)->visit(*this); 141 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 142 stream->flush(); 143} 144 145bool |
146Text::noOutput(const StatData &data) | 146Text::noOutput(const Info &info) |
147{ | 147{ |
148 if (!(data.flags & print)) | 148 if (!(info.flags & print)) |
149 return true; 150 | 149 return true; 150 |
151 if (data.prereq && data.prereq->zero()) | 151 if (info.prereq && info.prereq->zero()) |
152 return true; 153 154 return false; 155} 156 157string 158ValueToString(Result value, int precision, bool compat) 159{ --- 370 unchanged lines hidden (view full) --- 530 print(stream); 531 } 532 533 if (compat) 534 ccprintf(stream, "%send_dist\n\n", base); 535} 536 537void | 152 return true; 153 154 return false; 155} 156 157string 158ValueToString(Result value, int precision, bool compat) 159{ --- 370 unchanged lines hidden (view full) --- 530 print(stream); 531 } 532 533 if (compat) 534 ccprintf(stream, "%send_dist\n\n", base); 535} 536 537void |
538Text::visit(const ScalarData &data) | 538Text::visit(const ScalarInfoBase &info) |
539{ | 539{ |
540 if (noOutput(data)) | 540 if (noOutput(info)) |
541 return; 542 543 ScalarPrint print; | 541 return; 542 543 ScalarPrint print; |
544 print.value = data.result(); 545 print.name = data.name; 546 print.desc = data.desc; 547 print.flags = data.flags; | 544 print.value = info.result(); 545 print.name = info.name; 546 print.desc = info.desc; 547 print.flags = info.flags; |
548 print.compat = compat; 549 print.descriptions = descriptions; | 548 print.compat = compat; 549 print.descriptions = descriptions; |
550 print.precision = data.precision; | 550 print.precision = info.precision; |
551 print.pdf = NAN; 552 print.cdf = NAN; 553 554 print(*stream); 555} 556 557void | 551 print.pdf = NAN; 552 print.cdf = NAN; 553 554 print(*stream); 555} 556 557void |
558Text::visit(const VectorData &data) | 558Text::visit(const VectorInfoBase &info) |
559{ | 559{ |
560 if (noOutput(data)) | 560 if (noOutput(info)) |
561 return; 562 | 561 return; 562 |
563 size_type size = data.size(); | 563 size_type size = info.size(); |
564 VectorPrint print; 565 | 564 VectorPrint print; 565 |
566 print.name = data.name; 567 print.desc = data.desc; 568 print.flags = data.flags; | 566 print.name = info.name; 567 print.desc = info.desc; 568 print.flags = info.flags; |
569 print.compat = compat; 570 print.descriptions = descriptions; | 569 print.compat = compat; 570 print.descriptions = descriptions; |
571 print.precision = data.precision; 572 print.vec = data.result(); 573 print.total = data.total(); | 571 print.precision = info.precision; 572 print.vec = info.result(); 573 print.total = info.total(); |
574 | 574 |
575 if (!data.subnames.empty()) { | 575 if (!info.subnames.empty()) { |
576 for (off_type i = 0; i < size; ++i) { | 576 for (off_type i = 0; i < size; ++i) { |
577 if (!data.subnames[i].empty()) { 578 print.subnames = data.subnames; | 577 if (!info.subnames[i].empty()) { 578 print.subnames = info.subnames; |
579 print.subnames.resize(size); 580 for (off_type i = 0; i < size; ++i) { | 579 print.subnames.resize(size); 580 for (off_type i = 0; i < size; ++i) { |
581 if (!data.subnames[i].empty() && 582 !data.subdescs[i].empty()) { 583 print.subdescs = data.subdescs; | 581 if (!info.subnames[i].empty() && 582 !info.subdescs[i].empty()) { 583 print.subdescs = info.subdescs; |
584 print.subdescs.resize(size); 585 break; 586 } 587 } 588 break; 589 } 590 } 591 } 592 593 print(*stream); 594} 595 596void | 584 print.subdescs.resize(size); 585 break; 586 } 587 } 588 break; 589 } 590 } 591 } 592 593 print(*stream); 594} 595 596void |
597Text::visit(const Vector2dData &data) | 597Text::visit(const Vector2dInfoBase &info) |
598{ | 598{ |
599 if (noOutput(data)) | 599 if (noOutput(info)) |
600 return; 601 602 bool havesub = false; 603 VectorPrint print; 604 | 600 return; 601 602 bool havesub = false; 603 VectorPrint print; 604 |
605 print.subnames = data.y_subnames; 606 print.flags = data.flags; | 605 print.subnames = info.y_subnames; 606 print.flags = info.flags; |
607 print.compat = compat; 608 print.descriptions = descriptions; | 607 print.compat = compat; 608 print.descriptions = descriptions; |
609 print.precision = data.precision; | 609 print.precision = info.precision; |
610 | 610 |
611 if (!data.subnames.empty()) { 612 for (off_type i = 0; i < data.x; ++i) 613 if (!data.subnames[i].empty()) | 611 if (!info.subnames.empty()) { 612 for (off_type i = 0; i < info.x; ++i) 613 if (!info.subnames[i].empty()) |
614 havesub = true; 615 } 616 | 614 havesub = true; 615 } 616 |
617 VResult tot_vec(data.y); | 617 VResult tot_vec(info.y); |
618 Result super_total = 0.0; | 618 Result super_total = 0.0; |
619 for (off_type i = 0; i < data.x; ++i) { 620 if (havesub && (i >= data.subnames.size() || data.subnames[i].empty())) | 619 for (off_type i = 0; i < info.x; ++i) { 620 if (havesub && (i >= info.subnames.size() || info.subnames[i].empty())) |
621 continue; 622 | 621 continue; 622 |
623 off_type iy = i * data.y; 624 VResult yvec(data.y); | 623 off_type iy = i * info.y; 624 VResult yvec(info.y); |
625 626 Result total = 0.0; | 625 626 Result total = 0.0; |
627 for (off_type j = 0; j < data.y; ++j) { 628 yvec[j] = data.cvec[iy + j]; | 627 for (off_type j = 0; j < info.y; ++j) { 628 yvec[j] = info.cvec[iy + j]; |
629 tot_vec[j] += yvec[j]; 630 total += yvec[j]; 631 super_total += yvec[j]; 632 } 633 | 629 tot_vec[j] += yvec[j]; 630 total += yvec[j]; 631 super_total += yvec[j]; 632 } 633 |
634 print.name = data.name + "_" + 635 (havesub ? data.subnames[i] : to_string(i)); 636 print.desc = data.desc; | 634 print.name = info.name + "_" + 635 (havesub ? info.subnames[i] : to_string(i)); 636 print.desc = info.desc; |
637 print.vec = yvec; 638 print.total = total; 639 print(*stream); 640 } 641 | 637 print.vec = yvec; 638 print.total = total; 639 print(*stream); 640 } 641 |
642 if ((data.flags & ::Stats::total) && (data.x > 1)) { 643 print.name = data.name; 644 print.desc = data.desc; | 642 if ((info.flags & ::Stats::total) && (info.x > 1)) { 643 print.name = info.name; 644 print.desc = info.desc; |
645 print.vec = tot_vec; 646 print.total = super_total; 647 print(*stream); 648 } 649} 650 651void | 645 print.vec = tot_vec; 646 print.total = super_total; 647 print(*stream); 648 } 649} 650 651void |
652Text::visit(const DistData &data) | 652Text::visit(const DistInfoBase &info) |
653{ | 653{ |
654 if (noOutput(data)) | 654 if (noOutput(info)) |
655 return; 656 657 DistPrint print; 658 | 655 return; 656 657 DistPrint print; 658 |
659 print.name = data.name; 660 print.desc = data.desc; 661 print.flags = data.flags; | 659 print.name = info.name; 660 print.desc = info.desc; 661 print.flags = info.flags; |
662 print.compat = compat; 663 print.descriptions = descriptions; | 662 print.compat = compat; 663 print.descriptions = descriptions; |
664 print.precision = data.precision; | 664 print.precision = info.precision; |
665 | 665 |
666 print.min_val = data.data.min_val; 667 print.max_val = data.data.max_val; 668 print.underflow = data.data.underflow; 669 print.overflow = data.data.overflow; 670 print.vec.resize(data.data.cvec.size()); | 666 const DistData &data = info.data; 667 668 print.min_val = data.min_val; 669 print.max_val = data.max_val; 670 print.underflow = data.underflow; 671 print.overflow = data.overflow; 672 print.vec.resize(data.cvec.size()); |
671 for (off_type i = 0; i < print.vec.size(); ++i) | 673 for (off_type i = 0; i < print.vec.size(); ++i) |
672 print.vec[i] = (Result)data.data.cvec[i]; 673 print.sum = data.data.sum; 674 print.squares = data.data.squares; 675 print.samples = data.data.samples; | 674 print.vec[i] = (Result)data.cvec[i]; 675 print.sum = data.sum; 676 print.squares = data.squares; 677 print.samples = data.samples; |
676 | 678 |
677 print.min = data.data.min; 678 print.max = data.data.max; 679 print.bucket_size = data.data.bucket_size; 680 print.size = data.data.size; 681 print.fancy = data.data.fancy; | 679 print.min = data.min; 680 print.max = data.max; 681 print.bucket_size = data.bucket_size; 682 print.size = data.size; 683 print.fancy = data.fancy; |
682 683 print(*stream); 684} 685 686void | 684 685 print(*stream); 686} 687 688void |
687Text::visit(const VectorDistData &data) | 689Text::visit(const VectorDistInfoBase &info) |
688{ | 690{ |
689 if (noOutput(data)) | 691 if (noOutput(info)) |
690 return; 691 | 692 return; 693 |
692 for (off_type i = 0; i < data.size(); ++i) { | 694 for (off_type i = 0; i < info.size(); ++i) { |
693 DistPrint print; 694 | 695 DistPrint print; 696 |
695 print.name = data.name + "_" + 696 (data.subnames[i].empty() ? (to_string(i)) : data.subnames[i]); 697 print.desc = data.subdescs[i].empty() ? data.desc : data.subdescs[i]; 698 print.flags = data.flags; | 697 print.name = info.name + "_" + 698 (info.subnames[i].empty() ? (to_string(i)) : info.subnames[i]); 699 print.desc = info.subdescs[i].empty() ? info.desc : info.subdescs[i]; 700 print.flags = info.flags; |
699 print.compat = compat; 700 print.descriptions = descriptions; | 701 print.compat = compat; 702 print.descriptions = descriptions; |
701 print.precision = data.precision; | 703 print.precision = info.precision; |
702 | 704 |
703 print.min_val = data.data[i].min_val; 704 print.max_val = data.data[i].max_val; 705 print.underflow = data.data[i].underflow; 706 print.overflow = data.data[i].overflow; 707 print.vec.resize(data.data[i].cvec.size()); | 705 print.min_val = info.data[i].min_val; 706 print.max_val = info.data[i].max_val; 707 print.underflow = info.data[i].underflow; 708 print.overflow = info.data[i].overflow; 709 print.vec.resize(info.data[i].cvec.size()); |
708 for (off_type j = 0; j < print.vec.size(); ++j) | 710 for (off_type j = 0; j < print.vec.size(); ++j) |
709 print.vec[j] = (Result)data.data[i].cvec[j]; 710 print.sum = data.data[i].sum; 711 print.squares = data.data[i].squares; 712 print.samples = data.data[i].samples; | 711 print.vec[j] = (Result)info.data[i].cvec[j]; 712 print.sum = info.data[i].sum; 713 print.squares = info.data[i].squares; 714 print.samples = info.data[i].samples; |
713 | 715 |
714 print.min = data.data[i].min; 715 print.max = data.data[i].max; 716 print.bucket_size = data.data[i].bucket_size; 717 print.size = data.data[i].size; 718 print.fancy = data.data[i].fancy; | 716 print.min = info.data[i].min; 717 print.max = info.data[i].max; 718 print.bucket_size = info.data[i].bucket_size; 719 print.size = info.data[i].size; 720 print.fancy = info.data[i].fancy; |
719 720 print(*stream); 721 } 722} 723 724void | 721 722 print(*stream); 723 } 724} 725 726void |
725Text::visit(const FormulaData &data) | 727Text::visit(const FormulaInfoBase &info) |
726{ | 728{ |
727 visit((const VectorData &)data); | 729 visit((const VectorInfoBase &)info); |
728} 729 730bool 731initText(const string &filename, bool desc, bool compat) 732{ 733 static Text text; 734 static bool connected = false; 735 --- 15 unchanged lines hidden --- | 730} 731 732bool 733initText(const string &filename, bool desc, bool compat) 734{ 735 static Text text; 736 static bool connected = false; 737 --- 15 unchanged lines hidden --- |