text.cc (12334:e0ab29a34764) | text.cc (14205:197360deaa20) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2019 Arm Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * |
|
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; 9 * redistributions in binary form must reproduce the above copyright --- 138 unchanged lines hidden (view full) --- 148 149void 150Text::end() 151{ 152 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 153 stream->flush(); 154} 155 | 14 * Copyright (c) 2004-2005 The Regents of The University of Michigan 15 * All rights reserved. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions are 19 * met: redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer; 21 * redistributions in binary form must reproduce the above copyright --- 138 unchanged lines hidden (view full) --- 160 161void 162Text::end() 163{ 164 ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); 165 stream->flush(); 166} 167 |
168std::string 169Text::statName(const std::string &name) const 170{ 171 if (path.empty()) 172 return name; 173 else 174 return csprintf("%s.%s", path.top(), name); 175} 176 177void 178Text::beginGroup(const char *name) 179{ 180 if (path.empty()) { 181 path.push(name); 182 } else { 183 path.push(csprintf("%s.%s", path.top(), name)); 184 } 185} 186 187void 188Text::endGroup() 189{ 190 assert(!path.empty()); 191 path.pop(); 192} 193 |
|
156bool 157Text::noOutput(const Info &info) 158{ 159 if (!info.flags.isSet(display)) 160 return true; 161 162 if (info.prereq && info.prereq->zero()) 163 return true; --- 199 unchanged lines hidden (view full) --- 363 364 if (!info.subdescs[i].empty()) 365 desc = info.subdescs[i]; 366} 367 368void 369DistPrint::init(const Text *text, const Info &info) 370{ | 194bool 195Text::noOutput(const Info &info) 196{ 197 if (!info.flags.isSet(display)) 198 return true; 199 200 if (info.prereq && info.prereq->zero()) 201 return true; --- 199 unchanged lines hidden (view full) --- 401 402 if (!info.subdescs[i].empty()) 403 desc = info.subdescs[i]; 404} 405 406void 407DistPrint::init(const Text *text, const Info &info) 408{ |
371 name = info.name; | 409 name = text->statName(info.name); |
372 separatorString = info.separatorString; 373 desc = info.desc; 374 flags = info.flags; 375 precision = info.precision; 376 descriptions = text->descriptions; 377} 378 379void --- 126 unchanged lines hidden (view full) --- 506void 507Text::visit(const ScalarInfo &info) 508{ 509 if (noOutput(info)) 510 return; 511 512 ScalarPrint print; 513 print.value = info.result(); | 410 separatorString = info.separatorString; 411 desc = info.desc; 412 flags = info.flags; 413 precision = info.precision; 414 descriptions = text->descriptions; 415} 416 417void --- 126 unchanged lines hidden (view full) --- 544void 545Text::visit(const ScalarInfo &info) 546{ 547 if (noOutput(info)) 548 return; 549 550 ScalarPrint print; 551 print.value = info.result(); |
514 print.name = info.name; | 552 print.name = statName(info.name); |
515 print.desc = info.desc; 516 print.flags = info.flags; 517 print.descriptions = descriptions; 518 print.precision = info.precision; 519 print.pdf = NAN; 520 print.cdf = NAN; 521 522 print(*stream); 523} 524 525void 526Text::visit(const VectorInfo &info) 527{ 528 if (noOutput(info)) 529 return; 530 531 size_type size = info.size(); 532 VectorPrint print; 533 | 553 print.desc = info.desc; 554 print.flags = info.flags; 555 print.descriptions = descriptions; 556 print.precision = info.precision; 557 print.pdf = NAN; 558 print.cdf = NAN; 559 560 print(*stream); 561} 562 563void 564Text::visit(const VectorInfo &info) 565{ 566 if (noOutput(info)) 567 return; 568 569 size_type size = info.size(); 570 VectorPrint print; 571 |
534 print.name = info.name; | 572 print.name = statName(info.name); |
535 print.separatorString = info.separatorString; 536 print.desc = info.desc; 537 print.flags = info.flags; 538 print.descriptions = descriptions; 539 print.precision = info.precision; 540 print.vec = info.result(); 541 print.total = info.total(); 542 print.forceSubnames = false; --- 58 unchanged lines hidden (view full) --- 601 602 Result total = 0.0; 603 for (off_type j = 0; j < info.y; ++j) { 604 yvec[j] = info.cvec[iy + j]; 605 tot_vec[j] += yvec[j]; 606 total += yvec[j]; 607 } 608 | 573 print.separatorString = info.separatorString; 574 print.desc = info.desc; 575 print.flags = info.flags; 576 print.descriptions = descriptions; 577 print.precision = info.precision; 578 print.vec = info.result(); 579 print.total = info.total(); 580 print.forceSubnames = false; --- 58 unchanged lines hidden (view full) --- 639 640 Result total = 0.0; 641 for (off_type j = 0; j < info.y; ++j) { 642 yvec[j] = info.cvec[iy + j]; 643 tot_vec[j] += yvec[j]; 644 total += yvec[j]; 645 } 646 |
609 print.name = info.name + "_" + 610 (havesub ? info.subnames[i] : std::to_string(i)); | 647 print.name = statName( 648 info.name + "_" + 649 (havesub ? info.subnames[i] : std::to_string(i))); |
611 print.desc = info.desc; 612 print.vec = yvec; 613 print.total = total; 614 print(*stream); 615 } 616 617 // Create a subname for printing the total 618 vector<string> total_subname; 619 total_subname.push_back("total"); 620 621 if (info.flags.isSet(::Stats::total) && (info.x > 1)) { | 650 print.desc = info.desc; 651 print.vec = yvec; 652 print.total = total; 653 print(*stream); 654 } 655 656 // Create a subname for printing the total 657 vector<string> total_subname; 658 total_subname.push_back("total"); 659 660 if (info.flags.isSet(::Stats::total) && (info.x > 1)) { |
622 print.name = info.name; | 661 print.name = statName(info.name); |
623 print.subnames = total_subname; 624 print.desc = info.desc; 625 print.vec = VResult(1, info.total()); 626 print.flags = print.flags & ~total; 627 print(*stream); 628 } 629} 630 --- 51 unchanged lines hidden (view full) --- 682{ 683 init(text, info); 684} 685 686/* Initialization function */ 687void 688SparseHistPrint::init(const Text *text, const Info &info) 689{ | 662 print.subnames = total_subname; 663 print.desc = info.desc; 664 print.vec = VResult(1, info.total()); 665 print.flags = print.flags & ~total; 666 print(*stream); 667 } 668} 669 --- 51 unchanged lines hidden (view full) --- 721{ 722 init(text, info); 723} 724 725/* Initialization function */ 726void 727SparseHistPrint::init(const Text *text, const Info &info) 728{ |
690 name = info.name; | 729 name = text->statName(info.name); |
691 separatorString = info.separatorString; 692 desc = info.desc; 693 flags = info.flags; 694 precision = info.precision; 695 descriptions = text->descriptions; 696} 697 698/* Grab data from map and write to output stream */ --- 55 unchanged lines hidden --- | 730 separatorString = info.separatorString; 731 desc = info.desc; 732 flags = info.flags; 733 precision = info.precision; 734 descriptions = text->descriptions; 735} 736 737/* Grab data from map and write to output stream */ --- 55 unchanged lines hidden --- |